Files
fulpstation/code/__DEFINES/directional.dm
SgtHunk 26a9e97803 August TGU: Wall leaning, ponies, cardboard IDs, smoothbore disablers and MUCH MORE! (#1032)
* this shit is like the ship of theseus bruh

* forgor dme

* updates maps

* some fixes just halfway through

* guhh

* ok

* whoops

* this one too

* that was such a stupid fix WHY

* fixes fulp ruin
2023-08-20 16:42:16 -07:00

48 lines
1.4 KiB
Plaintext

// Byond direction defines, because I want to put them somewhere.
// #define NORTH 1
// #define SOUTH 2
// #define EAST 4
// #define WEST 8
/// North direction as a string "[1]"
#define TEXT_NORTH "[NORTH]"
/// South direction as a string "[2]"
#define TEXT_SOUTH "[SOUTH]"
/// East direction as a string "[4]"
#define TEXT_EAST "[EAST]"
/// West direction as a string "[8]"
#define TEXT_WEST "[WEST]"
//dir macros
///Returns true if the dir is diagonal, false otherwise
#define ISDIAGONALDIR(d) (d&(d-1))
///True if the dir is north or south, false therwise
#define NSCOMPONENT(d) (d&(NORTH|SOUTH))
///True if the dir is east/west, false otherwise
#define EWCOMPONENT(d) (d&(EAST|WEST))
///Flips the dir for north/south directions
#define NSDIRFLIP(d) (d^(NORTH|SOUTH))
///Flips the dir for east/west directions
#define EWDIRFLIP(d) (d^(EAST|WEST))
/// Inverse direction, taking into account UP|DOWN if necessary.
#define REVERSE_DIR(dir) ( ((dir & 85) << 1) | ((dir & 170) >> 1) )
/// Create directional subtypes for a path to simplify mapping.
#define MAPPING_DIRECTIONAL_HELPERS(path, offset) ##path/directional/north {\
dir = NORTH; \
pixel_y = offset; \
} \
##path/directional/south {\
dir = SOUTH; \
pixel_y = -offset; \
} \
##path/directional/east {\
dir = EAST; \
pixel_x = offset; \
} \
##path/directional/west {\
dir = WEST; \
pixel_x = -offset; \
}