by Gez » Sun Jul 13, 2008 3:45 am
Looking
here, there's something that intrigues me.
The old code said:
Code: Select all
// Although there is a P_SpawnMissileZ function its
// aiming is much too bad to be of any use
self->z+=SpawnHeight-32*FRACUNIT;
AActor * missile = P_SpawnMissile (self, self->target, ti);
self->z-=SpawnHeight-32*FRACUNIT;
The new code says:
Code: Select all
// This seemingly senseless code is needed for proper aiming.
self->z+=SpawnHeight-32*FRACUNIT;
AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, ti, false);
self->z-=SpawnHeight-32*FRACUNIT;
I don't get what is the point of substracting 32*FRACUNIT in order to add it just after. Couldn't it be this instead?
Code: Select all
// This seemingly senseless code is needed for proper aiming.
self->z+=SpawnHeight;
AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z, self, self->target, ti, false);
self->z-=SpawnHeight;
Which in turn could be reduced to just this so that self->z isn't changed just for this function and reverted after...
Code: Select all
// Proper aiming code.
AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z + SpawnHeight, self, self->target, ti, false);
Looking [url=http://zdoom.org/svndiff/1071/zdoom/trunk/src/thingdef/thingdef_codeptr.cpp#0]here[/url], there's something that intrigues me.
The old code said:
[code] // Although there is a P_SpawnMissileZ function its
// aiming is much too bad to be of any use
self->z+=SpawnHeight-32*FRACUNIT;
AActor * missile = P_SpawnMissile (self, self->target, ti);
self->z-=SpawnHeight-32*FRACUNIT;[/code]
The new code says:
[code] // This seemingly senseless code is needed for proper aiming.
self->z+=SpawnHeight-32*FRACUNIT;
AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, ti, false);
self->z-=SpawnHeight-32*FRACUNIT;[/code]
I don't get what is the point of substracting 32*FRACUNIT in order to add it just after. Couldn't it be this instead?
[code] // This seemingly senseless code is needed for proper aiming.
self->z+=SpawnHeight;
AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z, self, self->target, ti, false);
self->z-=SpawnHeight;[/code]
Which in turn could be reduced to just this so that self->z isn't changed just for this function and reverted after...
[code] // Proper aiming code.
AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z + SpawnHeight, self, self->target, ti, false);[/code]