If I switch to third-person view (or Tombraider mode as I call it), the camera whips back and the player appears in front just fine.
The question however, is how to detect that a specific sprite is the player's, and so prevent it from rotating when the player's angle changes. Tombraider mode should show the back of the player's sprite, right?
void analyzesprites(long dax, long day)
{
long i, j=0, k, *intptr;
point3d *ospr;
spritetype *tspr;
for(i=0,tspr=&tsprite[0];i<spritesortcnt;i++,tspr++)
{
#ifdef SUPERBUILD
if (usevoxels && tiletovox[tspr->picnum] >= 0 && bpp == 8)
{
tspr->cstat |= 48;
tspr->picnum = tiletovox[tspr->picnum];
}
#endif
switch(tspr->picnum)
{
//Rotating sprites
case PLAYER:
//Somehow detect that this is the local player's avatar and DON'T rotate it. Default to buttshot instead.
{
tspr->picnum += 4; //increase angle to buttshot
tspr->cstat &= ~4; //don't flip
tspr->cstat |= 2; //translucent
break;
}
case CIVILIAN1:
case CIVILIAN1_DIE1:
case CIVILIAN1_DIE2:
case CIVILIAN1_DEAD:
case CIVILIAN1_SIT:
case CIVILIAN1_WALK1:
case CRAZYFROG:
{
//Get which of the 8 angles of the sprite to draw (0-7)
//k ranges from 0-7
//initprintf("tspr->x = %i; dax = %i; tspr->y = %i; day = %i;\n",tspr->x,dax,tspr->y,day);
k = getangle(tspr->x-dax,tspr->y-day);
k = (((tspr->ang+3072+128-k)&2047)>>8)&7;
//This guy has only 5 pictures for 8 angles (3 are x-flipped)
if (k <= 4)
{
tspr->picnum += k; //(k<<2);
tspr->cstat &= ~4; //clear x-flipping bit
}
else
{
tspr->picnum += (8-k); //((8-k)<<2);
tspr->cstat |= 4; //set x-flipping bit
}
break;
}
}
//Interpolation and such follow... <snip>
Because it looks like shit now.