From c1f01419671ad084a6c048ec7900d008de53bfe2 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Sun, 20 Nov 2022 23:15:47 -0800 Subject: [PATCH] Fixes mineral turfs having weird lighting (#71219) ## About The Pull Request Pixel offsets, unlike transforms, offset overlays too. this was breaking lighting overlays for mineral walls. We did pixel offsets to save on init time, but we can acomplish the same thing using an initial matrix. It's static, so there's no additional cost. S free Damn moth ## Changelog :cl: fix: Mining walls won't have fucked lighting anymore /:cl: --- code/__DEFINES/matrices.dm | 2 ++ code/game/turfs/closed/minerals.dm | 11 ++++------- tgstation.dme | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 code/__DEFINES/matrices.dm diff --git a/code/__DEFINES/matrices.dm b/code/__DEFINES/matrices.dm new file mode 100644 index 00000000000..b7240751b63 --- /dev/null +++ b/code/__DEFINES/matrices.dm @@ -0,0 +1,2 @@ +/// Helper macro for compile time translation +#define TRANSLATE_MATRIX(offset_x, offset_y) matrix(1, 0, (offset_x), 0, 1, (offset_y)) diff --git a/code/game/turfs/closed/minerals.dm b/code/game/turfs/closed/minerals.dm index df88a56d4ce..bf4545a8106 100644 --- a/code/game/turfs/closed/minerals.dm +++ b/code/game/turfs/closed/minerals.dm @@ -2,8 +2,6 @@ /**********************Mineral deposits**************************/ -#define MINERAL_WALL_OFFSET -4 - /turf/closed/mineral //wall piece name = "rock" icon = MAP_SWITCH('icons/turf/smoothrocks.dmi', 'icons/turf/mining.dmi') @@ -17,10 +15,10 @@ plane = GAME_PLANE_UPPER base_icon_state = "smoothrocks" - base_pixel_x = MINERAL_WALL_OFFSET - base_pixel_y = MINERAL_WALL_OFFSET - pixel_x = MAP_SWITCH(MINERAL_WALL_OFFSET, 0) - pixel_y = MAP_SWITCH(MINERAL_WALL_OFFSET, 0) + // This is static + // Done like this to avoid needing to make it dynamic and save cpu time + // 4 to the left, 4 down + transform = MAP_SWITCH(TRANSLATE_MATRIX(-4, -4), matrix()) temperature = TCMB var/turf/open/floor/plating/turf_type = /turf/open/misc/asteroid/airless @@ -35,7 +33,6 @@ ///How long it takes to mine this turf without tools, if it's weak. var/hand_mine_speed = 15 SECONDS -#undef MINERAL_WALL_OFFSET /turf/closed/mineral/Initialize(mapload) var/static/list/smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_MINERAL_WALLS) diff --git a/tgstation.dme b/tgstation.dme index 3e56ca99bd0..a8d638a602a 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -117,6 +117,7 @@ #include "code\__DEFINES\maps.dm" #include "code\__DEFINES\materials.dm" #include "code\__DEFINES\maths.dm" +#include "code\__DEFINES\matrices.dm" #include "code\__DEFINES\MC.dm" #include "code\__DEFINES\mecha.dm" #include "code\__DEFINES\melee.dm"