Need some help to finalize AmigaOS4 port of AssaultCube
#29
@Tempest
A bit offtopic: still trying to fix the same problem in Cube1, and found that monsters.cpp with los() function are present here, and that how it looks like:

Quote:bool los(float lx, float ly, float lz, float bx, float by, float bz, vec &v) // height-correct line of sight for monster shooting/seeing
{
if(OUTBORD((int)lx, (int)ly) || OUTBORD((int)bx, (int)by)) return false;
float dx = bx-lx;
float dy = by-ly;
int steps = (int)(sqrt(dx*dx+dy*dy)/0.9);
if(!steps) return false;
float x = lx;
float y = ly;
int i = 0;
for(;;)
{
sqr *s = S(fast_f2nat(x), fast_f2nat(y));
if(SOLID(s)) break;
float floor = s->floor;
if(s->type==FHF) floor -= s->vdelta/4.0f;
float ceil = s->ceil;
if(s->type==CHF) ceil += s->vdelta/4.0f;
float rz = lz-((lz-bz)*(i/(float)steps));
if(rz<floor || rz>ceil) break;
v.x = x;
v.y = y;
v.z = rz;
x += dx/(float)steps;
y += dy/(float)steps;
i++;
};
return i>=steps;
};

And example of usage:

Quote:bool enemylos(dynent *m, vec &v)
{
v = m->o;
return los(m->o.x, m->o.y, m->o.z, m->enemy->o.x, m->enemy->o.y, m->enemy->o.z, v);
};

Still, functions are bool, return only one value, and as input want many of them. As author say that is can be replaced, so there is something pretty easy should be for anyone who know all that mathematic stuff.

In end i trying to do something like you do for assaulc cube:

Quote:readdepth(....)
{
.. code from los() ...

setorient(r, u); // that is need it for later usage
}

Maybe you can help there as well ?
Thanks given by:


Messages In This Thread
RE: Need some help to finalize AmigaOS4 port of AssaultCube - by kas1e - 17 Nov 10, 11:59AM