diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index fea06caff..5d1a81d4f 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -68,7 +68,6 @@ typedef struct gr_vissprite_s struct gr_vissprite_s *prev; struct gr_vissprite_s *next; float x1, x2; - float z1, z2; float tz, ty; lumpnum_t patchlumpnum; boolean flip; @@ -79,6 +78,7 @@ typedef struct gr_vissprite_s //Hurdler: 25/04/2000: now support colormap in hardware mode UINT8 *colormap; INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing + float z1, z2; } gr_vissprite_t; // -------- diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4429bafeb..ca9c56b13 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5190,7 +5190,6 @@ static void HWR_ProjectSprite(mobj_t *thing) float tr_x, tr_y; float tz; float x1, x2; - float z1, z2; float rightsin, rightcos; float this_scale; float gz, gzt; @@ -5202,7 +5201,7 @@ static void HWR_ProjectSprite(mobj_t *thing) angle_t ang; INT32 heightsec, phs; const boolean papersprite = (thing->frame & FF_PAPERSPRITE); - float ang_scale = 1.0f, ang_scalez = 0.0f; + float z1, z2; if (!thing) return; @@ -5257,25 +5256,7 @@ static void HWR_ProjectSprite(mobj_t *thing) I_Error("sprframes NULL for sprite %d\n", thing->sprite); #endif - if (papersprite) - { - // Use the actual view angle, rather than the angle formed - // between the view point and the thing - // this makes sure paper sprites always appear at the right angle! - // Note: DO NOT do this in software mode version, it actually - // makes papersprites look WORSE there (I know, I've tried) - // Monster Iestyn - 13/05/17 - ang = dup_viewangle - thing->angle; - ang_scale = FIXED_TO_FLOAT(FINESINE(ang>>ANGLETOFINESHIFT)); - ang_scalez = FIXED_TO_FLOAT(FINECOSINE(ang>>ANGLETOFINESHIFT)); - - if (ang_scale < 0) - { - ang_scale = -ang_scale; - ang_scalez = -ang_scalez; - } - } - else if (sprframe->rotate != SRF_SINGLE) + if (sprframe->rotate != SRF_SINGLE) { if (thing->player) ang = R_PointToAngle (thing->x, thing->y) - thing->player->frameangle; @@ -5289,6 +5270,14 @@ static void HWR_ProjectSprite(mobj_t *thing) rot = 0; //Fab: for vis->patch below lumpoff = sprframe->lumpid[0]; //Fab: see note above flip = sprframe->flip; // Will only be 0x00 or 0xFF + + if (papersprite && (R_PointToAngle (thing->x, thing->y) - thing->angle < ANGLE_180)) + { + if (flip) + flip = 0; + else + flip = 255; + } } else { @@ -5308,8 +5297,25 @@ static void HWR_ProjectSprite(mobj_t *thing) if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES) this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)thing->skin)->highresscale); - rightsin = FIXED_TO_FLOAT(FINESINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); - rightcos = FIXED_TO_FLOAT(FINECOSINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); + if (papersprite) + { + if (flip && sprframe->rotate != SRF_SINGLE) + { + rightsin = FIXED_TO_FLOAT(FINESINE((thing->angle+ANGLE_180)>>ANGLETOFINESHIFT)); + rightcos = FIXED_TO_FLOAT(FINECOSINE((thing->angle+ANGLE_180)>>ANGLETOFINESHIFT)); + } + else + { + rightsin = FIXED_TO_FLOAT(FINESINE((thing->angle)>>ANGLETOFINESHIFT)); + rightcos = FIXED_TO_FLOAT(FINECOSINE((thing->angle)>>ANGLETOFINESHIFT)); + } + } + else + { + rightsin = FIXED_TO_FLOAT(FINESINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); + rightcos = FIXED_TO_FLOAT(FINECOSINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); + } + if (flip) { x1 = (FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset) * this_scale);