Skip to content

Commit

Permalink
Adjusts space uses.
Browse files Browse the repository at this point in the history
  • Loading branch information
PsiOmegaDelta committed Sep 15, 2017
1 parent b6dd7ec commit 20833da
Show file tree
Hide file tree
Showing 67 changed files with 615 additions and 616 deletions.
8 changes: 4 additions & 4 deletions code/__datastructures/globals.dm
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//See controllers/globals.dm
#define GLOBAL_MANAGED(X, InitValue)\
/datum/controller/global_vars/proc/InitGlobal##X(){\
##X = ##InitValue;\
gvars_datum_init_order += #X;\
##X = ##InitValue;\
gvars_datum_init_order += #X;\
}
#define GLOBAL_UNMANAGED(X, InitValue) /datum/controller/global_vars/proc/InitGlobal##X()

#ifndef TESTING
#define GLOBAL_PROTECT(X)\
/datum/controller/global_vars/InitGlobal##X(){\
..();\
gvars_datum_protected_varlist += #X;\
..();\
gvars_datum_protected_varlist += #X;\
}
#else
#define GLOBAL_PROTECT(X)
Expand Down
20 changes: 10 additions & 10 deletions code/__defines/MC.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#define MC_SPLIT_TICK_INIT(phase_count) var/original_tick_limit = Master.current_ticklimit; var/split_tick_phases = ##phase_count
#define MC_SPLIT_TICK \
if(split_tick_phases > 1){\
Master.current_ticklimit = ((original_tick_limit - world.tick_usage) / split_tick_phases) + world.tick_usage;\
--split_tick_phases;\
} else {\
Master.current_ticklimit = original_tick_limit;\
}
if(split_tick_phases > 1){\
Master.current_ticklimit = ((original_tick_limit - world.tick_usage) / split_tick_phases) + world.tick_usage;\
--split_tick_phases;\
} else {\
Master.current_ticklimit = original_tick_limit;\
}

// Used to smooth out costs to try and avoid oscillation.
#define MC_AVERAGE_FAST(average, current) (0.7 * (average) + 0.3 * (current))
Expand Down Expand Up @@ -65,14 +65,14 @@

#define SUBSYSTEM_DEF(X) GLOBAL_REAL(SS##X, /datum/controller/subsystem/##X);\
/datum/controller/subsystem/##X/New(){\
NEW_SS_GLOBAL(SS##X);\
PreInit();\
NEW_SS_GLOBAL(SS##X);\
PreInit();\
}\
/datum/controller/subsystem/##X

#define PROCESSING_SUBSYSTEM_DEF(X) GLOBAL_REAL(SS##X, /datum/controller/subsystem/processing/##X);\
/datum/controller/subsystem/processing/##X/New(){\
NEW_SS_GLOBAL(SS##X);\
PreInit();\
NEW_SS_GLOBAL(SS##X);\
PreInit();\
}\
/datum/controller/subsystem/processing/##X
10 changes: 5 additions & 5 deletions code/__defines/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@

//type and all subtypes should always call Initialize in New()
#define INITIALIZE_IMMEDIATE(X) ##X/New(loc, ...){\
..();\
if(!initialized) {\
args[1] = TRUE;\
SSatoms.InitAtom(src, args);\
}\
..();\
if(!initialized) {\
args[1] = TRUE;\
SSatoms.InitAtom(src, args);\
}\
}

// Subsystem init_order, from highest priority to lowest priority
Expand Down
4 changes: 2 additions & 2 deletions code/_helpers/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var/global/list/string_slot_flags = list(
//////////////////////////

/hook/global_init/proc/populateGlobalLists()
possible_cable_coil_colours = sortAssoc(list(
possible_cable_coil_colours = sortAssoc(list(
"Yellow" = COLOR_YELLOW,
"Green" = COLOR_LIME,
"Pink" = COLOR_PINK,
Expand All @@ -104,7 +104,7 @@ var/global/list/string_slot_flags = list(
"Red" = COLOR_RED,
"White" = COLOR_WHITE
))
return 1
return 1

/proc/get_mannequin(var/ckey)
if(!mannequins_)
Expand Down
116 changes: 58 additions & 58 deletions code/_helpers/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,57 +18,57 @@ remember you first need to setup an /icon var like so:
var/icon/my_icon = new('iconfile.dmi')
icon/ChangeOpacity(amount = 1)
A very common operation in DM is to try to make an icon more or less transparent. Making an icon more
transparent is usually much easier than making it less so, however. This proc basically is a frontend
for MapColors() which can change opacity any way you like, in much the same way that SetIntensity()
can make an icon lighter or darker. If amount is 0.5, the opacity of the icon will be cut in half.
If amount is 2, opacity is doubled and anything more than half-opaque will become fully opaque.
A very common operation in DM is to try to make an icon more or less transparent. Making an icon more
transparent is usually much easier than making it less so, however. This proc basically is a frontend
for MapColors() which can change opacity any way you like, in much the same way that SetIntensity()
can make an icon lighter or darker. If amount is 0.5, the opacity of the icon will be cut in half.
If amount is 2, opacity is doubled and anything more than half-opaque will become fully opaque.
icon/GrayScale()
Converts the icon to grayscale instead of a fully colored icon. Alpha values are left intact.
Converts the icon to grayscale instead of a fully colored icon. Alpha values are left intact.
icon/ColorTone(tone)
Similar to GrayScale(), this proc converts the icon to a range of black -> tone -> white, where tone is an
RGB color (its alpha is ignored). This can be used to create a sepia tone or similar effect.
See also the global ColorTone() proc.
Similar to GrayScale(), this proc converts the icon to a range of black -> tone -> white, where tone is an
RGB color (its alpha is ignored). This can be used to create a sepia tone or similar effect.
See also the global ColorTone() proc.
icon/MinColors(icon)
The icon is blended with a second icon where the minimum of each RGB pixel is the result.
Transparency may increase, as if the icons were blended with ICON_ADD. You may supply a color in place of an icon.
The icon is blended with a second icon where the minimum of each RGB pixel is the result.
Transparency may increase, as if the icons were blended with ICON_ADD. You may supply a color in place of an icon.
icon/MaxColors(icon)
The icon is blended with a second icon where the maximum of each RGB pixel is the result.
Opacity may increase, as if the icons were blended with ICON_OR. You may supply a color in place of an icon.
The icon is blended with a second icon where the maximum of each RGB pixel is the result.
Opacity may increase, as if the icons were blended with ICON_OR. You may supply a color in place of an icon.
icon/Opaque(background = "#000000")
All alpha values are set to 255 throughout the icon. Transparent pixels become black, or whatever background color you specify.
All alpha values are set to 255 throughout the icon. Transparent pixels become black, or whatever background color you specify.
icon/BecomeAlphaMask()
You can convert a simple grayscale icon into an alpha mask to use with other icons very easily with this proc.
The black parts become transparent, the white parts stay white, and anything in between becomes a translucent shade of white.
You can convert a simple grayscale icon into an alpha mask to use with other icons very easily with this proc.
The black parts become transparent, the white parts stay white, and anything in between becomes a translucent shade of white.
icon/AddAlphaMask(mask)
The alpha values of the mask icon will be blended with the current icon. Anywhere the mask is opaque,
the current icon is untouched. Anywhere the mask is transparent, the current icon becomes transparent.
Where the mask is translucent, the current icon becomes more transparent.
The alpha values of the mask icon will be blended with the current icon. Anywhere the mask is opaque,
the current icon is untouched. Anywhere the mask is transparent, the current icon becomes transparent.
Where the mask is translucent, the current icon becomes more transparent.
icon/UseAlphaMask(mask, mode)
Sometimes you may want to take the alpha values from one icon and use them on a different icon.
This proc will do that. Just supply the icon whose alpha mask you want to use, and src will change
so it has the same colors as before but uses the mask for opacity.
Sometimes you may want to take the alpha values from one icon and use them on a different icon.
This proc will do that. Just supply the icon whose alpha mask you want to use, and src will change
so it has the same colors as before but uses the mask for opacity.
COLOR MANAGEMENT AND HSV
RGB isn't the only way to represent color. Sometimes it's more useful to work with a model called HSV, which stands for hue, saturation, and value.
* The hue of a color describes where it is along the color wheel. It goes from red to yellow to green to
cyan to blue to magenta and back to red.
* The saturation of a color is how much color is in it. A color with low saturation will be more gray,
and with no saturation at all it is a shade of gray.
* The value of a color determines how bright it is. A high-value color is vivid, moderate value is dark,
and no value at all is black.
* The hue of a color describes where it is along the color wheel. It goes from red to yellow to green to
cyan to blue to magenta and back to red.
* The saturation of a color is how much color is in it. A color with low saturation will be more gray,
and with no saturation at all it is a shade of gray.
* The value of a color determines how bright it is. A high-value color is vivid, moderate value is dark,
and no value at all is black.
Just as BYOND uses "#rrggbb" to represent RGB values, a similar format is used for HSV: "#hhhssvv". The hue is three
hex digits because it ranges from 0 to 0x5FF.
* 0 to 0xFF - red to yellow
* 0x100 to 0x1FF - yellow to green
* 0x200 to 0x2FF - green to cyan
* 0x300 to 0x3FF - cyan to blue
* 0x400 to 0x4FF - blue to magenta
* 0x500 to 0x5FF - magenta to red
* 0 to 0xFF - red to yellow
* 0x100 to 0x1FF - yellow to green
* 0x200 to 0x2FF - green to cyan
* 0x300 to 0x3FF - cyan to blue
* 0x400 to 0x4FF - blue to magenta
* 0x500 to 0x5FF - magenta to red
Knowing this, you can figure out that red is "#000ffff" in HSV format, which is hue 0 (red), saturation 255 (as colorful as possible),
value 255 (as bright as possible). Green is "#200ffff" and blue is "#400ffff".
Expand All @@ -78,42 +78,42 @@ More than one HSV color can match the same RGB color.
Here are some procs you can use for color management:
ReadRGB(rgb)
Takes an RGB string like "#ffaa55" and converts it to a list such as list(255,170,85). If an RGBA format is used
that includes alpha, the list will have a fourth item for the alpha value.
Takes an RGB string like "#ffaa55" and converts it to a list such as list(255,170,85). If an RGBA format is used
that includes alpha, the list will have a fourth item for the alpha value.
hsv(hue, sat, val, apha)
Counterpart to rgb(), this takes the values you input and converts them to a string in "#hhhssvv" or "#hhhssvvaa"
format. Alpha is not included in the result if null.
Counterpart to rgb(), this takes the values you input and converts them to a string in "#hhhssvv" or "#hhhssvvaa"
format. Alpha is not included in the result if null.
ReadHSV(rgb)
Takes an HSV string like "#100FF80" and converts it to a list such as list(256,255,128). If an HSVA format is used that
includes alpha, the list will have a fourth item for the alpha value.
Takes an HSV string like "#100FF80" and converts it to a list such as list(256,255,128). If an HSVA format is used that
includes alpha, the list will have a fourth item for the alpha value.
RGBtoHSV(rgb)
Takes an RGB or RGBA string like "#ffaa55" and converts it into an HSV or HSVA color such as "#080aaff".
Takes an RGB or RGBA string like "#ffaa55" and converts it into an HSV or HSVA color such as "#080aaff".
HSVtoRGB(hsv)
Takes an HSV or HSVA string like "#080aaff" and converts it into an RGB or RGBA color such as "#ff55aa".
Takes an HSV or HSVA string like "#080aaff" and converts it into an RGB or RGBA color such as "#ff55aa".
BlendRGB(rgb1, rgb2, amount)
Blends between two RGB or RGBA colors using regular RGB blending. If amount is 0, the first color is the result;
if 1, the second color is the result. 0.5 produces an average of the two. Values outside the 0 to 1 range are allowed as well.
The returned value is an RGB or RGBA color.
Blends between two RGB or RGBA colors using regular RGB blending. If amount is 0, the first color is the result;
if 1, the second color is the result. 0.5 produces an average of the two. Values outside the 0 to 1 range are allowed as well.
The returned value is an RGB or RGBA color.
BlendHSV(hsv1, hsv2, amount)
Blends between two HSV or HSVA colors using HSV blending, which tends to produce nicer results than regular RGB
blending because the brightness of the color is left intact. If amount is 0, the first color is the result; if 1,
the second color is the result. 0.5 produces an average of the two. Values outside the 0 to 1 range are allowed as well.
The returned value is an HSV or HSVA color.
Blends between two HSV or HSVA colors using HSV blending, which tends to produce nicer results than regular RGB
blending because the brightness of the color is left intact. If amount is 0, the first color is the result; if 1,
the second color is the result. 0.5 produces an average of the two. Values outside the 0 to 1 range are allowed as well.
The returned value is an HSV or HSVA color.
BlendRGBasHSV(rgb1, rgb2, amount)
Like BlendHSV(), but the colors used and the return value are RGB or RGBA colors. The blending is done in HSV form.
Like BlendHSV(), but the colors used and the return value are RGB or RGBA colors. The blending is done in HSV form.
HueToAngle(hue)
Converts a hue to an angle range of 0 to 360. Angle 0 is red, 120 is green, and 240 is blue.
Converts a hue to an angle range of 0 to 360. Angle 0 is red, 120 is green, and 240 is blue.
AngleToHue(hue)
Converts an angle to a hue in the valid range.
Converts an angle to a hue in the valid range.
RotateHue(hsv, angle)
Takes an HSV or HSVA value and rotates the hue forward through red, green, and blue by an angle from 0 to 360.
(Rotating red by 60° produces yellow.) The result is another HSV or HSVA color with the same saturation and value
as the original, but a different hue.
Takes an HSV or HSVA value and rotates the hue forward through red, green, and blue by an angle from 0 to 360.
(Rotating red by 60° produces yellow.) The result is another HSV or HSVA color with the same saturation and value
as the original, but a different hue.
GrayScale(rgb)
Takes an RGB or RGBA color and converts it to grayscale. Returns an RGB or RGBA string.
Takes an RGB or RGBA color and converts it to grayscale. Returns an RGB or RGBA string.
ColorTone(rgb, tone)
Similar to GrayScale(), this proc converts an RGB or RGBA color to a range of black -> tone -> white instead of
using strict shades of gray. The tone value is an RGB color; any alpha value is ignored.
Similar to GrayScale(), this proc converts an RGB or RGBA color to a range of black -> tone -> white instead of
using strict shades of gray. The tone value is an RGB color; any alpha value is ignored.
*/

/*
Expand Down
4 changes: 2 additions & 2 deletions code/_helpers/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
return sqrt(squaredNorm(x, y))

/proc/IsPowerOfTwo(var/val)
return (val & (val-1)) == 0
return (val & (val-1)) == 0

/proc/RoundUpToPowerOfTwo(var/val)
return 2 ** -round(-log(2,val))
return 2 ** -round(-log(2,val))
14 changes: 7 additions & 7 deletions code/_helpers/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,13 @@ proc/arctan(x)

//returns random gauss number
proc/GaussRand(var/sigma)
var/x,y,rsq
do
x=2*rand()-1
y=2*rand()-1
rsq=x*x+y*y
while(rsq>1 || !rsq)
return sigma*y*sqrt(-2*log(rsq)/rsq)
var/x,y,rsq
do
x=2*rand()-1
y=2*rand()-1
rsq=x*x+y*y
while(rsq>1 || !rsq)
return sigma*y*sqrt(-2*log(rsq)/rsq)

//returns random gauss number, rounded to 'roundto'
proc/GaussRandRound(var/sigma,var/roundto)
Expand Down
14 changes: 4 additions & 10 deletions code/_helpers/vector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ increment()
return_angle()
Returns the direction (angle in degrees) the object is travelling in.
(N)
90°
^
|
(W) 180° <--+--> 0° (E)
|
v
-90°
(S)
* North = 90°
* East = 0°
* South = -90°
* West = 180°
return_hypotenuse()
Returns the distance of travel for each step of the vector, relative to each full step of movement. 1 is a full turf
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@

/mob/proc/TurfAdjacent(var/turf/T)
return T.AdjacentQuick(src)

/mob/observer/ghost/TurfAdjacent(var/turf/T)
if(!isturf(loc) || !client)
return FALSE
Expand Down
30 changes: 15 additions & 15 deletions code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
condition ? overlay_fullscreen(screen_name, screen_type, arg) : clear_fullscreen(screen_name)

/mob/proc/overlay_fullscreen(category, type, severity)
var/obj/screen/fullscreen/screen = screens[category]
var/obj/screen/fullscreen/screen = screens[category]

if(screen)
if(screen.type != type)
clear_fullscreen(category, FALSE)
screen = null
else if(!severity || severity == screen.severity)
return null
if(screen)
if(screen.type != type)
clear_fullscreen(category, FALSE)
screen = null
else if(!severity || severity == screen.severity)
return null

if(!screen)
screen = new type()
if(!screen)
screen = new type()

screen.icon_state = "[initial(screen.icon_state)][severity]"
screen.severity = severity
screen.icon_state = "[initial(screen.icon_state)][severity]"
screen.severity = severity

screens[category] = screen
if(client && stat != DEAD)
client.screen += screen
return screen
screens[category] = screen
if(client && stat != DEAD)
client.screen += screen
return screen

/mob/proc/clear_fullscreen(category, animated = 10)
var/obj/screen/fullscreen/screen = screens[category]
Expand Down
Loading

0 comments on commit 20833da

Please sign in to comment.