mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-29 19:43:16 +00:00
Huge commit! Standardizes var definitions in most places.
Signed-off-by: Mloc <colmohici@gmail.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:04
|
||||
|
||||
/* base 64 procs
|
||||
These procs convert plain text to a hexidecimal string to 64 encoded text and vice versa.
|
||||
|
||||
@@ -33,12 +35,11 @@ proc
|
||||
pad_code = the character or ASCII code used to pad the base64 text.
|
||||
DEFAULT: 67 (= sign)
|
||||
RETURNS: the hexidecimal text */
|
||||
var
|
||||
pos = 1
|
||||
offset = 2
|
||||
current = 0
|
||||
padding = 0
|
||||
hextext = ""
|
||||
var/pos = 1
|
||||
var/offset = 2
|
||||
var/current = 0
|
||||
var/padding = 0
|
||||
var/hextext = ""
|
||||
if(istext(pad_code)) pad_code = text2ascii(pad_code)
|
||||
while(pos <= length(encode64))
|
||||
var/val = text2ascii(encode64, pos++)
|
||||
@@ -80,15 +81,14 @@ proc
|
||||
pad_char = the character or ASCII code used to pad the base64 text.
|
||||
DEFAULT: "=" (ASCII 67)
|
||||
RETURNS: the base 64 encoded text */
|
||||
var
|
||||
key64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
encode64 = ""
|
||||
pos = 1
|
||||
offset = 2
|
||||
current = 0
|
||||
len = length(hextext)
|
||||
end = len
|
||||
padding = end%6
|
||||
var/key64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
var/encode64 = ""
|
||||
var/pos = 1
|
||||
var/offset = 2
|
||||
var/current = 0
|
||||
var/len = length(hextext)
|
||||
var/end = len
|
||||
var/padding = end%6
|
||||
if(padding)
|
||||
padding = 6 - padding
|
||||
end += padding
|
||||
@@ -128,4 +128,4 @@ proc
|
||||
var/hex = ""
|
||||
for(var/loop = 1 to length(txt))
|
||||
hex += sd_dec2base(text2ascii(txt,loop),,2)
|
||||
return hex
|
||||
return hex
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:04
|
||||
|
||||
/* sd_color and procs
|
||||
sd_color is a special datum that contains color data in various
|
||||
formats. Sample colors are available in samplecolors.dm.
|
||||
|
||||
sd_color
|
||||
var
|
||||
name // the name of the color
|
||||
red // red componant of the color
|
||||
green // green componant of the color
|
||||
blue // red componant of the color
|
||||
html // html string for the color
|
||||
icon/Icon // contains the icon produced by the rgb2icon() proc
|
||||
var/name // the name of the color
|
||||
var/red // red componant of the color
|
||||
var/green // green componant of the color
|
||||
var/blue // red componant of the color
|
||||
var/html // html string for the color
|
||||
var/icon/Icon // contains the icon produced by the rgb2icon() proc
|
||||
|
||||
PROCS
|
||||
brightness()
|
||||
@@ -30,13 +31,12 @@ sd_color
|
||||
* Implimentation: No need to read further. *
|
||||
*********************************************/
|
||||
sd_color
|
||||
var
|
||||
name // the name of the color
|
||||
red = 0 // red componant of the color
|
||||
green = 0 // green componant of the color
|
||||
blue = 0 // red componant of the color
|
||||
html // html string for the color
|
||||
icon/Icon // contains the icon produced by the rgb2icon() proc
|
||||
var/name // the name of the color
|
||||
var/red = 0 // red componant of the color
|
||||
var/green = 0 // green componant of the color
|
||||
var/blue = 0 // red componant of the color
|
||||
var/html // html string for the color
|
||||
var/icon/Icon // contains the icon produced by the rgb2icon() proc
|
||||
|
||||
proc
|
||||
brightness()
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:04
|
||||
|
||||
/* HSL procs
|
||||
These procs convert between RGB (red, green, blu) and HSL (hue, saturation, light)
|
||||
color spaces. The algorithms used for these procs were found at
|
||||
@@ -80,20 +82,18 @@ proc
|
||||
sat /= scale
|
||||
lgh /= scale
|
||||
|
||||
var
|
||||
red
|
||||
grn
|
||||
blu
|
||||
var/red
|
||||
var/grn
|
||||
var/blu
|
||||
|
||||
if(!sat) // greyscale
|
||||
red = lgh
|
||||
grn = lgh
|
||||
blu = lgh
|
||||
else
|
||||
var
|
||||
temp1
|
||||
temp2
|
||||
temp3
|
||||
var/temp1
|
||||
var/temp2
|
||||
var/temp3
|
||||
if(lgh < 0.5) temp2 = lgh * (1 + sat)
|
||||
else temp2 = lgh + sat - lgh * sat
|
||||
temp1 = 2 * lgh - temp2
|
||||
@@ -160,12 +160,11 @@ proc
|
||||
red /= 255
|
||||
grn /= 255
|
||||
blu /= 255
|
||||
var
|
||||
lo = min(red, grn, blu)
|
||||
hi = max(red, grn, blu)
|
||||
hue = 0
|
||||
sat = 0
|
||||
lgh = (lo + hi)/2
|
||||
var/lo = min(red, grn, blu)
|
||||
var/hi = max(red, grn, blu)
|
||||
var/hue = 0
|
||||
var/sat = 0
|
||||
var/lgh = (lo + hi)/2
|
||||
|
||||
if(lo != hi) // if equal, hue and sat may both stay 0
|
||||
if(lgh < 0.5) sat = (hi - lo) / (hi + lo)
|
||||
|
||||
Reference in New Issue
Block a user