From 3b782aba608af01a2b491fdf99e625f0173a3700 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 25 Oct 2018 23:33:32 +0000 Subject: [PATCH] Add CSTAT_SPRITE_ALIGNMENT_MASK. It's identical to CSTAT_SPRITE_ALIGNMENT_SLAB, but should be used in cases where you're checking either CSTAT_SPRITE_ALIGNMENT_WALL or CSTAT_SPRITE_ALIGNMENT_FLOOR rather than checking for a slab (voxel). git-svn-id: https://svn.eduke32.com/eduke32@7129 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/buildtypes.h | 8 +++++--- source/build/src/engine.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/build/include/buildtypes.h b/source/build/include/buildtypes.h index afc32a18e..8264fa6ee 100644 --- a/source/build/include/buildtypes.h +++ b/source/build/include/buildtypes.h @@ -129,9 +129,11 @@ enum enum { CSTAT_SPRITE_ALIGNMENT_FACING = 0, - CSTAT_SPRITE_ALIGNMENT_WALL = 1u<<4u, - CSTAT_SPRITE_ALIGNMENT_FLOOR = 1u<<5u, - CSTAT_SPRITE_ALIGNMENT_SLAB = 1u<<4u | 1u<<5u, + CSTAT_SPRITE_ALIGNMENT_WALL = 1u<<4u, + CSTAT_SPRITE_ALIGNMENT_FLOOR = 1u<<5u, + CSTAT_SPRITE_ALIGNMENT_SLAB = 1u<<4u | 1u<<5u, + + CSTAT_SPRITE_ALIGNMENT_MASK = 1u<<4u | 1u<<5u, }; #endif diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index ca9f68565..a95c14cad 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -11855,9 +11855,9 @@ restart_grand: #endif vec2_t v1 = *(vec2_t *)&sprite[j]; - switch (cstat&48) + switch (cstat & CSTAT_SPRITE_ALIGNMENT_MASK) { - case 0: + case CSTAT_SPRITE_ALIGNMENT_FACING: { int32_t k = walldist+(sprite[j].clipdist<<2)+1; if ((klabs(v1.x-pos->x) <= k) && (klabs(v1.y-pos->y) <= k)) @@ -11869,7 +11869,7 @@ restart_grand: break; } - case 16: + case CSTAT_SPRITE_ALIGNMENT_WALL: { vec2_t v2; get_wallspr_points((uspritetype *)&sprite[j], &v1.x, &v2.x, &v1.y, &v2.y); @@ -11884,7 +11884,7 @@ restart_grand: break; } - case 32: + case CSTAT_SPRITE_ALIGNMENT_FLOOR: { daz = sprite[j].z; daz2 = daz;