From afacf5506743644e0c44a0200529505266007af2 Mon Sep 17 00:00:00 2001 From: yamamama Date: Tue, 3 Mar 2026 08:08:04 -0500 Subject: [PATCH] FF_AFFINEPAPER and RF2_AFFINEPAPER He made a BANDAID so TRASH even his TEAM clowned him --- src/deh_tables.c | 2 ++ src/p_pspr.h | 3 +++ src/r_defs.h | 1 + src/r_things.cpp | 14 ++++++++++++-- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 5f7c4f28f..b8b55e9cb 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -949,6 +949,7 @@ struct int_const_s const INT_CONST[] = { {"FF_PAPERSPRITE",FF_PAPERSPRITE}, {"FF_FLOORSPRITE",FF_FLOORSPRITE}, {"FF_NOAFFINE",FF_NOAFFINE}, + {"FF_AFFINEPAPER",FF_AFFINEPAPER}, {"FF_BLENDMASK",FF_BLENDMASK}, {"FF_BLENDSHIFT",FF_BLENDSHIFT}, {"FF_ADD",FF_ADD}, @@ -1059,6 +1060,7 @@ struct int_const_s const INT_CONST[] = { {"RF_GHOSTLY",RF_GHOSTLY}, {"RF_GHOSTLYMASK",RF_GHOSTLYMASK}, {"RF2_NOAFFINE",RF2_NOAFFINE}, + {"RF2_AFFINEPAPER",RF2_AFFINEPAPER}, // Level flags {"LF_SCRIPTISFILE",LF_SCRIPTISFILE}, diff --git a/src/p_pspr.h b/src/p_pspr.h index d508f909e..12fbb3b95 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -93,6 +93,9 @@ extern "C" { /// \brief Frame flags: Turns off Mode 7-style scaling and rotation #define FF_NOAFFINE 0x04000000 +/// \brief Frame flags: Enables "affine papersprites" +#define FF_AFFINEPAPER 0x08000000 + /// \brief Frame flags - Animate: Simple stateless animation #define FF_ANIMATE 0x10000000 /// \brief Frame flags - Animate: Sync animation to global timer (mutually exclusive with below, currently takes priority) diff --git a/src/r_defs.h b/src/r_defs.h index d0db384f8..c84bf1bad 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1039,6 +1039,7 @@ typedef enum typedef enum { RF2_NOAFFINE = 0x00000001, // Disables affine drawing for this sprite + RF2_AFFINEPAPER = 0x00000002, // Enables "affine papersprites" } renderflags2_t; typedef enum diff --git a/src/r_things.cpp b/src/r_things.cpp index 9408877df..7ce247153 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -4296,12 +4296,22 @@ boolean R_ThingVerticallyFlipped(mobj_t *thing) boolean R_ThingIsPaperSprite(mobj_t *thing) { - return (thing->frame & FF_PAPERSPRITE || thing->renderflags & RF_PAPERSPRITE); + boolean affinepaper = (thing->frame & FF_AFFINEPAPER || thing->renderflags2 & RF2_AFFINEPAPER); + + return (thing->frame & FF_PAPERSPRITE || thing->renderflags & RF_PAPERSPRITE || affinepaper); } boolean R_ThingIsAffineSprite(mobj_t *thing) { - return (!(thing->frame & FF_NOAFFINE || thing->renderflags2 & RF2_NOAFFINE)); + boolean affinepaper = (thing->frame & FF_AFFINEPAPER || thing->renderflags2 & RF2_AFFINEPAPER); + + // Affine papersprites are messy in software rendering; let modders enable them at their own discretion. + // Yes, I'm lazy; I've been at this for TWO WEEKS. + boolean papersprite = (R_ThingIsPaperSprite(thing) && !affinepaper); + + boolean notaffine = ((thing->frame & FF_NOAFFINE || thing->renderflags2 & RF2_NOAFFINE) || papersprite); + + return (!notaffine); } boolean R_ThingIsFloorSprite(mobj_t *thing)