mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
* Update beefman.dm * Update beefman.dm * xsaxsfvvvvvvvv * Update shaded_bloodsucker.dm * yeah that thing * FUCK you * Update hunting_contract.dm * dd * vdvdfv * Update monsterhunter_weapons.dm * Update whiterabbit.dm * onokkn * Update monsterhunter_weapons.dm * Update monsterhunter_weapons.dm * efe * Update whiterabbit.dm * yeaywa * Update red_rabbit.dmi * oihop * Update HunterContract.js * wonderland.dm * gs * dcd * Update rabbit.dmi * ass * fvd * Update paradox_rabbit.dm * f * Update tgstation.dme * Delete heartbeatmoon.dmi * shtntb * sed * sfe * Update monsterhunter_weapons.dm * cdc * Update wonderland.dm * dgrd * wef * b * pipkk * Update hunting_contract.dm * Update paradox_rabbit.dm * wr * Update worn_mask.dmi * some documenting * Update areas.dm * eg * Update white_rabbit.dm * Update HunterContract.js * s * Update weapons.dmi * Update weapons.dmi * Jack in the bomb * some signals * ui * h * y * music * Update wonderlandmusic.ogg * f * v * cleanups * g * a * t * y * g * a * o * first commit * Adding our stuff back in * k * Before procs * proc refs * carps * Fixes * shuttles * dumb dumb names * I hate windows I hate windows * I hate windows I hate windows * h * Selenestation has issues * Update monsterhunter_weapons.dm * eretics * Update weapons.dmi * Update monsterhunter_weapons.dm * g * kpop * r * m * grgr * Update simple_animal_freeze.dm * Update wonderland_apocalypse.dm * Update wonderland_apocalypse.dm * d * Update fulp_defines.dm * ff * Update wonderland.dmm * Update tgstation.dme * Update infil_objectives.dm * Update infil_objectives.dm * Update monsterhunter_weapons.dm * Update monsterhunter_event.dm * Update monsterhunter_event.dm * Update areas.dm * Update monsterhunter_event.dm * Update monsterhunter_weapons.dm * Step 0, version 2 * step 0.5 - version 2 * step 1 - version 2 * 2.5 version 2 * fix * Mapping * okay fine * more mapping * uuuuu hhhh * fixes * help me * hurry * I'm killing the mf that did access helpers on this map * Welp, we lost. * Or did we? --------- Co-authored-by: SmoSmoSmoSmok <95004236+SmoSmoSmoSmok@users.noreply.github.com> Co-authored-by: Pepsilawn <reisenrui@gmail.com> Co-authored-by: SgtHunk <68669754+SgtHunk@users.noreply.github.com>
89 lines
5.3 KiB
Plaintext
89 lines
5.3 KiB
Plaintext
// This file contains helper macros for plane operations
|
|
// See the planes section of Visuals.md for more detail, but essentially
|
|
// When we render multiz, we do it by placing all atoms on lower levels on well, lower planes
|
|
// This is done with stacks of plane masters (things we use to apply effects to planes)
|
|
// These macros exist to facilitate working with this system, and other associated small bits
|
|
|
|
/// Takes an atom to change the plane of, a new plane value, and something that can be used as a reference to a z level as input
|
|
/// Modifies the new value to match the plane we actually want. Note, if you pass in an already offset plane the offsets will add up
|
|
/// Use PLANE_TO_TRUE() to avoid this
|
|
#define SET_PLANE(thing, new_value, z_reference) (thing.plane = MUTATE_PLANE(new_value, z_reference))
|
|
|
|
/// Takes a plane and a z reference, and offsets the plane by the mutation
|
|
/// The SSmapping.max_plane_offset bit here is technically redundant, but saves a bit of work in the base case
|
|
/// And the base case is important to me. Non multiz shouldn't get hit too bad by this code
|
|
#define MUTATE_PLANE(new_value, z_reference) ((SSmapping.max_plane_offset) ? GET_NEW_PLANE(new_value, GET_TURF_PLANE_OFFSET(z_reference)) : (new_value))
|
|
|
|
/// Takes a z reference that we are unsure of, sanity checks it
|
|
/// Returns either its offset, or 0 if it's not a valid ref
|
|
/// Will return the reference's PLANE'S offset if we can't get anything out of the z level. We do our best
|
|
#define GET_TURF_PLANE_OFFSET(z_reference) ((SSmapping.max_plane_offset && isatom(z_reference)) ? (z_reference.z ? GET_Z_PLANE_OFFSET(z_reference.z) : PLANE_TO_OFFSET(z_reference.plane)) : 0)
|
|
/// Essentially just an unsafe version of GET_TURF_PLANE_OFFSET()
|
|
/// Takes a z value we returns its offset with a list lookup
|
|
/// Will runtime during parts of init. Be careful :)
|
|
#define GET_Z_PLANE_OFFSET(z) (SSmapping.z_level_to_plane_offset[z])
|
|
|
|
/// Takes a plane to offset, and the multiplier to use, and well, does the offsetting
|
|
/// Respects a blacklist we use to remove redundant plane masters, such as hud objects
|
|
#define GET_NEW_PLANE(new_value, multiplier) (SSmapping.plane_offset_blacklist?["[new_value]"] ? new_value : (new_value) - (PLANE_RANGE * (multiplier)))
|
|
|
|
// Now for the more niche things
|
|
|
|
/// Takes an object, new plane, and multipler, and offsets the plane
|
|
/// This is for cases where you have a multipler precalculated, and just want to use it
|
|
/// Often an optimization, sometimes a necessity
|
|
#define SET_PLANE_W_SCALAR(thing, new_value, multiplier) (thing.plane = GET_NEW_PLANE(new_value, multiplier))
|
|
|
|
|
|
/// Implicit plane set. We take the turf from the object we're changing the plane of, and use ITS z as a spokesperson for our plane value
|
|
#define SET_PLANE_IMPLICIT(thing, new_value) SET_PLANE_EXPLICIT(thing, new_value, thing)
|
|
|
|
// This is an unrolled and optimized version of SET_PLANE, for use anywhere where you are unsure of a source's "turfness"
|
|
// We do also try and guess at what the thing's z level is, even if it's not a z
|
|
// The plane is cached to allow for fancy stuff to be eval'd once, rather then often
|
|
#define SET_PLANE_EXPLICIT(thing, new_value, source) \
|
|
do {\
|
|
if(SSmapping.max_plane_offset) {\
|
|
var/_cached_plane = new_value;\
|
|
var/turf/_our_turf = get_turf(source);\
|
|
if(_our_turf){\
|
|
thing.plane = GET_NEW_PLANE(_cached_plane, GET_Z_PLANE_OFFSET(_our_turf.z));\
|
|
}\
|
|
else if(source) {\
|
|
thing.plane = GET_NEW_PLANE(_cached_plane, PLANE_TO_OFFSET(source.plane));\
|
|
}\
|
|
else {\
|
|
thing.plane = _cached_plane;\
|
|
}\
|
|
}\
|
|
else {\
|
|
thing.plane = new_value;\
|
|
}\
|
|
}\
|
|
while (FALSE)
|
|
|
|
// Now for macros that exist to get info from SSmapping
|
|
// Mostly about details of planes, or z levels
|
|
|
|
/// Takes a z level, gets the lowest plane offset in its "stack"
|
|
#define GET_LOWEST_STACK_OFFSET(z) ((SSmapping.max_plane_offset) ? SSmapping.z_level_to_lowest_plane_offset[z] : 0)
|
|
/// Takes a plane, returns the canonical, unoffset plane it represents
|
|
#define PLANE_TO_TRUE(plane) ((SSmapping.plane_offset_to_true) ? SSmapping.plane_offset_to_true["[plane]"] : plane)
|
|
/// Takes a plane, returns the offset it uses
|
|
#define PLANE_TO_OFFSET(plane) ((SSmapping.plane_to_offset) ? SSmapping.plane_to_offset["[plane]"] : plane)
|
|
/// Takes a plane, returns TRUE if it is of critical priority, FALSE otherwise
|
|
#define PLANE_IS_CRITICAL(plane) ((SSmapping.plane_to_offset) ? !!SSmapping.critical_planes["[plane]"] : FALSE)
|
|
/// Takes a true plane, returns the offset planes that would canonically represent it
|
|
#define TRUE_PLANE_TO_OFFSETS(plane) ((SSmapping.true_to_offset_planes) ? SSmapping.true_to_offset_planes["[plane]"] : list(plane))
|
|
/// Takes a render target and an offset, returns a canonical render target string for it
|
|
#define OFFSET_RENDER_TARGET(render_target, offset) (_OFFSET_RENDER_TARGET(render_target, SSmapping.render_offset_blacklist?["[render_target]"] ? 0 : offset))
|
|
/// Helper macro for the above
|
|
/// Honestly just exists to make the pattern of render target strings more readable
|
|
#define _OFFSET_RENDER_TARGET(render_target, offset) ("[(render_target)] #[(offset)]")
|
|
|
|
// Known issues:
|
|
// Potentially too much client load? Hard to tell due to not having a potato pc to hand.
|
|
// This is solvable with lowspec preferences, which would not be hard to implement
|
|
// Player popups will now render their effects, like overlay lights. this is fixable, but I've not gotten to it
|
|
// I think overlay lights can render on the wrong z layer. s fucked
|