From e3664a1ccaf098d2b98a206ea1dd2abb65fd3d2c Mon Sep 17 00:00:00 2001 From: NepDisk Date: Thu, 23 Apr 2026 12:59:14 -0400 Subject: [PATCH] Add compat flag to disable compat sprite rotation This is to accmodate skins that place skins in the range of drift rnage unrotated ie simple animal skins such as pepsiman or ShadowSkates --- src/d_player.h | 1 + src/r_skins.c | 63 +++++++++++++++++++++++++++----------------------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 14eb3467f..b98241613 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -38,6 +38,7 @@ typedef enum { SF_MACHINE = 1, // Beep boop. Are you a robot? SF_OLDDEATH = 1<<1, // Kart V1 styled death animation + SF_NOCOMPATROTATE = 1<<2, // Kart V1 skins that should not be rotated (simple animal, etc) // free up to and including 1<<31 } skinflags_t; diff --git a/src/r_skins.c b/src/r_skins.c index 6f2fc4e24..fc4d94009 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -11,6 +11,7 @@ /// \file r_skins.c /// \brief Loading skins +#include "d_player.h" #include "doomdef.h" #include "console.h" #include "g_game.h" @@ -927,40 +928,43 @@ static void R_LoadSkinSprites(UINT16 wadnum, UINT16 *lump, UINT16 *lastlump, ski Z_Free(tmp.spriteframes); #undef SPR2COUNT - // now we have to rotate the drift frames. i hate this. - sd = &skin->sprites[SPR2_DRRN]; - for (i = 0; i < sd->numframes; i++) + if (!(skin->flags & SF_NOCOMPATROTATE)) { - sf = &sd->spriteframes[i]; - if (sf->rotate != SRF_3D) - continue; - lumpnum_t lastpat = sf->lumppat[7]; - size_t lastid = sf->lumpid[7]; - for (int r = 7; r >= 1; r--) + // now we have to rotate the drift frames. i hate this. + sd = &skin->sprites[SPR2_DRRN]; + for (i = 0; i < sd->numframes; i++) { - sf->lumppat[r] = sf->lumppat[r-1]; - sf->lumpid[r] = sf->lumpid[r-1]; + sf = &sd->spriteframes[i]; + if (sf->rotate != SRF_3D) + continue; + lumpnum_t lastpat = sf->lumppat[7]; + size_t lastid = sf->lumpid[7]; + for (int r = 7; r >= 1; r--) + { + sf->lumppat[r] = sf->lumppat[r-1]; + sf->lumpid[r] = sf->lumpid[r-1]; + } + sf->lumppat[0] = lastpat; + sf->lumpid[0] = lastid; + sf->flip = (sf->flip & 0xff00) | ((sf->flip & 0x80) >> 7) | ((sf->flip & 0x7f) << 1); } - sf->lumppat[0] = lastpat; - sf->lumpid[0] = lastid; - sf->flip = (sf->flip & 0xff00) | ((sf->flip & 0x80) >> 7) | ((sf->flip & 0x7f) << 1); - } - sd = &skin->sprites[SPR2_DRLN]; - for (i = 0; i < sd->numframes; i++) - { - sf = &sd->spriteframes[i]; - if (sf->rotate != SRF_3D) - continue; - lumpnum_t firstpat = sf->lumppat[0]; - size_t firstid = sf->lumpid[0]; - for (int r = 0; r < 8; r++) + sd = &skin->sprites[SPR2_DRLN]; + for (i = 0; i < sd->numframes; i++) { - sf->lumppat[r] = sf->lumppat[r+1]; - sf->lumpid[r] = sf->lumpid[r+1]; + sf = &sd->spriteframes[i]; + if (sf->rotate != SRF_3D) + continue; + lumpnum_t firstpat = sf->lumppat[0]; + size_t firstid = sf->lumpid[0]; + for (int r = 0; r < 8; r++) + { + sf->lumppat[r] = sf->lumppat[r+1]; + sf->lumpid[r] = sf->lumpid[r+1]; + } + sf->lumppat[7] = firstpat; + sf->lumpid[7] = firstid; + sf->flip = (sf->flip & 0xff00) | ((sf->flip & 0x01) << 7) | ((sf->flip & 0xfe) >> 1); } - sf->lumppat[7] = firstpat; - sf->lumpid[7] = firstid; - sf->flip = (sf->flip & 0xff00) | ((sf->flip & 0x01) << 7) | ((sf->flip & 0xfe) >> 1); } R_AddKartFaces(skin); @@ -1139,6 +1143,7 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value) // 1, true, yes are all valid values GETFLAG(MACHINE) GETFLAG(OLDDEATH) + GETFLAG(NOCOMPATROTATE) #undef GETFLAG #define GETPATCH(field) else if (compat && fasticmp(stoken, #field)) strncpy(skin->field, value, 8);