Thanks all for the kind words !
Look, I was exploring my own code to find out why this works... since the OBB collision is a bit dark for me yet.
I found out that, in the first c_trace (use_box), the 'spheroid' collides with the stair steps edges, thus returning a normal that can be anything between 0.1 and 0.9. This is what makes stairs look like slopes.
However, if we make this trace from BELOW the entity origin, the spheroid has already collided with the stairs! The c_trace (use_box) seems to ignore the already-collided surface and goes ahead, so the next surface it hits is the floor (normal.z == 1.00).
So, there is no need to compare old and new normals. Just, if normal.z is below a certain value (a certain floor slope), make a c_trace again from below the creature, and check for a slope again. if it's really a slope, normal.z will be the same value, otherwise it will be 1.00.
Here is the simpler code, without the need of a old_normal_z variable.
...
Code:
vec_set(mG_tempvec.x,my.x);
mG_tempvec.z -=200; //trace 200 quants below (floor)
mActor_height = c_trace(my.x,mG_tempvec.x,
ignore_me + activate_sonar +use_box); //normal first trace
slopecheck = off;
if ( normal.z < 0.707) //potential slope 45 degrees
{
c_trace(vector(my.x,my.y,my.z-8), mG_tempvec.x,ignore_me + use_box);
if (normal.z <0.707)
{
slopecheck = on;
}
}