From c08e9674be3e9cc504ebbb393761e873eb5ba68a Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 20 Aug 2016 15:15:48 +0100 Subject: [PATCH] As requested by Nev3r and VAda, seperating MF_PAPER into FF_PAPERSPRITE and MF_PAPERCOLLISION. --- src/dehacked.c | 1 + src/doomdef.h | 2 +- src/p_map.c | 10 +++++----- src/p_mobj.h | 4 ++-- src/p_pspr.h | 4 +++- src/r_things.c | 12 ++++++------ 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 6b189a3ea..25c28d852 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7045,6 +7045,7 @@ struct { // Frame settings {"FF_FRAMEMASK",FF_FRAMEMASK}, + {"FF_PAPERSPRITE",FF_PAPERSPRITE}, {"FF_ANIMATE",FF_ANIMATE}, {"FF_FULLBRIGHT",FF_FULLBRIGHT}, {"FF_TRANSMASK",FF_TRANSMASK}, diff --git a/src/doomdef.h b/src/doomdef.h index 7cf3cff04..7ca379d99 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -498,7 +498,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// \note You should leave this enabled unless you're working with a future SRB2 version. #define MUSICSLOT_COMPATIBILITY -/// Experimental attempts at preventing MF_PAPER objects from getting stuck in walls. +/// Experimental attempts at preventing MF_PAPERCOLLISION objects from getting stuck in walls. //#define PAPER_COLLISIONCORRECTION #endif // __DOOMDEF__ diff --git a/src/p_map.c b/src/p_map.c index 0488c7b8c..5946f56d9 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -498,7 +498,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist) return true; // didn't hit it - if (thing->flags & MF_PAPER) // CAUTION! Very easy to get stuck inside MF_SOLID objects. Giving the player MF_PAPER is a bad idea unless you know what you're doing. + if (thing->flags & MF_PAPERCOLLISION) // CAUTION! Very easy to get stuck inside MF_SOLID objects. Giving the player MF_PAPERCOLLISION is a bad idea unless you know what you're doing. { fixed_t cosradius, sinradius; vertex_t v1, v2; // fake vertexes @@ -517,7 +517,7 @@ static boolean PIT_CheckThing(mobj_t *thing) junk.dx = v2.x - v1.x; junk.dy = v2.y - v1.y; - if (tmthing->flags & MF_PAPER) // more strenuous checking to prevent clipping issues + if (tmthing->flags & MF_PAPERCOLLISION) // more strenuous checking to prevent clipping issues { INT32 check1, check2, check3, check4; cosradius = FixedMul(tmthing->radius, FINECOSINE(tmthing->angle>>ANGLETOFINESHIFT)); @@ -538,7 +538,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; // the line doesn't cross between either pair of opposite corners } } - else if (tmthing->flags & MF_PAPER) + else if (tmthing->flags & MF_PAPERCOLLISION) { fixed_t cosradius, sinradius; vertex_t v1, v2; // fake vertexes @@ -557,7 +557,7 @@ static boolean PIT_CheckThing(mobj_t *thing) junk.dx = v2.x - v1.x; junk.dy = v2.y - v1.y; - // no need to check whether thing has MF_PAPER, since checked above + // no need to check whether thing has MF_PAPERCOLLISION, since checked above if ((P_PointOnLineSide(thing->x - thing->radius, thing->y - thing->radius, &junk) == P_PointOnLineSide(thing->x + thing->radius, thing->y + thing->radius, &junk)) @@ -1230,7 +1230,7 @@ static boolean PIT_CheckLine(line_t *ld) if (P_BoxOnLineSide(tmbbox, ld) != -1) return true; - if (tmthing->flags & MF_PAPER) // Caution! Turning whilst up against a wall will get you stuck. You probably shouldn't give the player this flag. + if (tmthing->flags & MF_PAPERCOLLISION) // Caution! Turning whilst up against a wall will get you stuck. You probably shouldn't give the player this flag. { fixed_t cosradius, sinradius; cosradius = FixedMul(tmthing->radius, FINECOSINE(tmthing->angle>>ANGLETOFINESHIFT)); diff --git a/src/p_mobj.h b/src/p_mobj.h index c6738d372..50af8acc9 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -107,8 +107,8 @@ typedef enum MF_NOSECTOR = 1<<3, // Don't use the blocklinks (inert but displayable) MF_NOBLOCKMAP = 1<<4, - // Paper-thin. Drawn like a midtexture, has a flat collision bound. - MF_PAPER = 1<<5, + // Thin, paper-like collision bound (for visual equivalent, see FF_PAPERSPRITE) + MF_PAPERCOLLISION = 1<<5, // You can push this object. It can activate switches and things by pushing it on top. MF_PUSHABLE = 1<<6, // Object is a boss. diff --git a/src/p_pspr.h b/src/p_pspr.h index 2fb232e73..c0064bc3e 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -36,7 +36,9 @@ #endif /// \brief Frame flags: only the frame number -#define FF_FRAMEMASK 0x3fff +#define FF_FRAMEMASK 0x1ff +/// \brief Frame flags: Thin, paper-like sprite (for collision equivalent, see MF_PAPERCOLLISION) +#define FF_PAPERSPRITE 0x800 /// \brief Frame flags: Simple stateless animation #define FF_ANIMATE 0x4000 /// \brief Frame flags: frame always appears full bright diff --git a/src/r_things.c b/src/r_things.c index 33b834ada..763f0cf86 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1123,7 +1123,7 @@ static void R_ProjectSprite(mobj_t *thing) fixed_t iscale; fixed_t scalestep; // toast '16 fixed_t offset, offset2; - boolean flatsprite = (thing->flags & MF_PAPER); + boolean papersprite = (thing->frame & FF_PAPERSPRITE); //SoM: 3/17/2000 fixed_t gz, gzt; @@ -1143,7 +1143,7 @@ static void R_ProjectSprite(mobj_t *thing) tz = gxt-gyt; // thing is behind view plane? - if (!(flatsprite) && (tz < FixedMul(MINZ, this_scale))) // flatsprite clipping is handled later + if (!(papersprite) && (tz < FixedMul(MINZ, this_scale))) // papersprite clipping is handled later return; gxt = -FixedMul(tr_x, viewsin); @@ -1203,10 +1203,10 @@ static void R_ProjectSprite(mobj_t *thing) I_Error("R_ProjectSprite: sprframes NULL for sprite %d\n", thing->sprite); #endif - if (sprframe->rotate != SRF_SINGLE || flatsprite) + if (sprframe->rotate != SRF_SINGLE || papersprite) { ang = R_PointToAngle (thing->x, thing->y) - thing->angle; - if (flatsprite) + if (papersprite) ang_scale = abs(FINESINE(ang>>ANGLETOFINESHIFT)); } @@ -1260,7 +1260,7 @@ static void R_ProjectSprite(mobj_t *thing) if (x2 < 0) return; - if (flatsprite) + if (papersprite) { fixed_t yscale2, cosmul, sinmul, tz2; INT32 range; @@ -1290,7 +1290,7 @@ static void R_ProjectSprite(mobj_t *thing) yscale2 = FixedDiv(projectiony, tz2); if (yscale2 < 64) return; // ditto - if (max(tz, tz2) < FixedMul(MINZ, this_scale)) // non-flatsprite clipping is handled earlier + if (max(tz, tz2) < FixedMul(MINZ, this_scale)) // non-papersprite clipping is handled earlier return; if (x2 > x1)