Am Mittwoch, 29. November 2006 07:25 schrieb zz zz:
> >This is not really your definition of "square" is it? ;)
> >+            radSquared = psStats->radius * psStats->radius * 
> >psStats->radius;
>
> that is radCuded,to save a temporary variable in that function,I used the
> same variable name for radSquared and radCuded.
>
> >Why are those many ifs included? Eg at:
> >+                                                    if 
> >(psTempDroid->droidType == DROID_CONSTRUCT)
> >+                                                    {
> >+                                                            zdiff -=
> >(asConstructStats[psTempDroid->asBits[COMP_CONSTRUCT].nStat]).pIMD->ymax;
> >+                                                    }
>
> because those non-combat component uses different data storage name in
> memory,asRepairStats for repair turret,asConstructStats for
> contruct,asBrainStats for commander etc etc.
>
> zdiff -= somecomponent.imd.ymax is equal to
> z hitbox += display height of the component.img
So you use the real size of the turrets to calculate the hitbox?

> >Am Dienstag, 28. November 2006 20:41 schrieb zz zz:
> >+                            //Watermelon:fix turret pitch for more turrets
> >+                            if (((DROID *)psAttacker)->numWeaps > 0)
> >+                            {
> >+                                    if (weapon_slot >= 0)
> >+                                    {
> >+                                            ((DROID *) 
> >psAttacker)->turretPitch[weapon_slot] = psObj->pitch;
> >+                                    }
> >+                            }
> >+                            else
> >+                            {
> >+                                    ((DROID *) psAttacker)->turretPitch[0] 
> >= psObj->pitch;
> >+                            }
> >
> >Why can't just
> >((DROID *) psAttacker)->turretPitch[weapon_slot] = psObj->pitch;
> >be used? Is weapon_slot not 0 if we got 0 numWeaps?
> >And: Do we have negative wpn slots?
>
> actually it should never get to 'numWeaps <= 0',I'll remove the 'else
> {((DROID *) psAttacker)->turretPitch[0] = psObj->pitch;}' line.
>
> negative wpn slots = the projectile is created by another projectile,so the
> wpn slots is set to -1 (negative 1) in this particular case,to distinguish
> projectile sent by turret(draw muzzle flash) and projectile sent by other
> projectile(dont draw muzzle flash).
>
> >Just curious: Why is following done? To save dereferencings of pointers?
> >     if (psStats->penetrate)
> >     {
> >             bPenetrate = TRUE;
> >     }
>
> I need to pass a bool to send projectile function,I dont think passing
> 'psStats->penetrate' is a good idea,since the weapon nStat(aka Id in
> asWeaponStats,to retrieve weapon info read from weapon.txt) is already
> passed to that function as the first parameter.
>
> >Again curious: What does this do? (Is that the hitbox check?)
> >+                                    /* see if psCurrD is hit (don't hit 
> >main target twice) */
> >+                                    if (((BASE_OBJECT *)psCurrD != 
> >psObj->psDest) &&
> >+                                            ((SDWORD)psCurrD->x >= tarX0) &&
> >+                                            ((SDWORD)psCurrD->x <= tarX1) &&
> >+                                            ((SDWORD)psCurrD->y >= tarY0) &&
> >+                                            ((SDWORD)psCurrD->y <= tarY1) &&
> >+                                            ((SDWORD)psCurrD->z >= tarZ0) &&
> >+                                            ((SDWORD)psCurrD->z <= tarZ1))
>
> yes it's hitbox.
>
> >Everyone: Please fix all of the following, if you see it in the code:
> >+                                                            DBP1(("Damage 
> >to object %d, player %d\n",
> >+                                                                            
> >psCurrD->id, psCurrD->player));
> >This has to be some debug() call.
>
> ok I'll replace it with debug()
>
> >Does this mean that you can hit friendly units now?
> >+                    /* Do damage to everything in range */
> >+                    for (i=0; i<MAX_PLAYERS; i++)
>
> this check has been there for ages,only radius damage can 'hit' friendly
> units.
>
> >Again just curious: When I thought about an own engine (a long while ago)
> > I had the idea to use "hitbubbles" instead of hitboxes, so I don't need
> > to check whether something is between all sides of the box, but only need
> > to compare the distance to the mid of the bubble with the radius.
> >Why is this not a good approach, or: Why didn't you choose this approach?
>
> isnt distance calculation more costy(esp 3D vector ones) than few >=
> comparisons?
It would be something like
sqrt( (x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2 ) < radius
So yes, you are probably right. With all those ^2 and the sqrt it would 
probably have been slow.
On the paper draft for my engine I just compared the lines of math needed. ;)
What I just thought of (totally off topic): Does perhaps GL offer some way of 
doing vector math like this? (Add 2 vectors and calculate it's length.)

Attachment: pgpyCMW53WVFB.pgp
Description: PGP signature

_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to