Skip to content

Commit 0e20f56

Browse files
committed
Revert "convert colors from 0..255 scale to 0..1"
This reverts commit 947e208.
1 parent 67a2eec commit 0e20f56

17 files changed

+89
-87
lines changed

android.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function androidDraw()
216216
local x, y, w, h = skin["center"][1]:getViewport()
217217
skinSpriteBatch:add(skin["center"][1], skinData["center"][1], skinData["center"][2], 0, skinData["center"][3]/w, skinData["center"][4]/h)
218218
end
219-
love.graphics.setColor(255, 255, 255)
219+
love.graphics.setColor(255,255,255)
220220
love.graphics.draw(skinSpriteBatch,0,0)
221221
for name, b in pairs(buttons) do
222222
if skinData.highlightonpress or not b.held then

animation.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ function animation:update(dt)
598598
playmusic()
599599
end
600600
elseif v[1] == "changebackgroundcolor" then
601-
love.graphics.setBackgroundColor(tonumber(v[2]), tonumber(v[3]), tonumber(v[4]))
601+
love.graphics.setBackgroundColor(tonumber(v[2]) or 255, tonumber(v[3]) or 255, tonumber(v[4]) or 255)
602602
elseif v[1] == "killplayer" then
603603
if v[2] == "everyone" then
604604
for i = 1, players do

characters.lua

+2-5
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ function loadcustomplayers()
2727
i = #characters["list"]+1,
2828

2929
--colors
30-
-- !! MAKE SURE to add any new RGB variables to `colorvariables` at the top !!
31-
-- !! to ensure they get automatically converted from 0..255 to 0..1 !!
3230
colorables = {"hat", "hair", "skin"},
3331
colors = {},
3432
defaultcolors = false,
@@ -468,18 +466,17 @@ function splitimage(img, color, exclude, imagedata) --split singe image into col
468466
for x = 0, input:getWidth()-1 do
469467
for y = 0, input:getHeight()-1 do
470468
local r, g, b, a = input:getPixel(x, y)
471-
local rr, rg, rb = r, g, b
472469
local place = false
473470
if exclude then
474471
place = true
475472
for i, c in pairs(color) do
476-
if rr == c[1] and rg == c[2] and rb == c[3] then
473+
if r == c[1] and g == c[2] and b == c[3] then
477474
place = false
478475
break
479476
end
480477
end
481478
else
482-
if rr == color[1] and rg == color[2] and rb == color[3] then
479+
if r == color[1] and g == color[2] and b == color[3] then
483480
place = true
484481
end
485482
end

clearpipe.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ function clearpipe:draw()
774774
ox, oy = t[2]*dx+self.sucklen*math.max(0,-dx), t[1]
775775
end
776776
local v = (t[2]/self.sucklen)
777-
love.graphics.setColor(255, 255, 255, 255*v)
777+
love.graphics.setColor(255,255,255,255*v)
778778
love.graphics.draw(dustimg, dustquad[t[5]], (x+ox-xscroll)*16*scale, (y+oy-.5-yscroll)*16*scale, t[3], scale, scale, 8, 8)
779779
if self.suckentranceportalx then
780780
local dir = self.suckentranceportalfacing
@@ -785,7 +785,7 @@ function clearpipe:draw()
785785
ox, oy = t[2]*dx+self.sucklen*math.max(0,-dx), t[1]
786786
end
787787
local v = (t[2]/self.sucklen)
788-
love.graphics.setColor(255, 255, 255, 255*v)
788+
love.graphics.setColor(255,255,255,255*v)
789789
love.graphics.draw(dustimg, dustquad[t[5]], (x+ox-xscroll)*16*scale, (y+oy-.5-yscroll)*16*scale, t[3], scale, scale, 8, 8)
790790
end
791791
end
@@ -798,7 +798,7 @@ function clearpipe:draw()
798798
ox, oy = t[2]*dx+self.sucklen*math.max(0,-dx), t[1]
799799
end
800800
local v = 1-(t[2]/self.sucklen)
801-
love.graphics.setColor(255, 255, 255, 255*v)
801+
love.graphics.setColor(255,255,255,255*v)
802802
love.graphics.draw(dustimg, dustquad[t[5]], (x+ox-xscroll)*16*scale, (y+oy-.5-yscroll)*16*scale, t[3], scale, scale, 8, 8)
803803
if self.suckexitportalx then
804804
local dir = self.suckexitportalfacing
@@ -809,7 +809,7 @@ function clearpipe:draw()
809809
ox, oy = t[2]*dx+self.sucklen*math.max(0,-dx), t[1]
810810
end
811811
local v = 1-(t[2]/self.sucklen)
812-
love.graphics.setColor(255, 255, 255, 255*v)
812+
love.graphics.setColor(255,255,255,255*v)
813813
love.graphics.draw(dustimg, dustquad[t[5]], (x+ox-xscroll)*16*scale, (y+oy-.5-yscroll)*16*scale, t[3], scale, scale, 8, 8)
814814
end
815815
end

editor.lua

+22-22
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function editor_load(player_position) --{x, y, xscroll, yscroll}
101101
mtsavehighlighttime = 5
102102
mtsavetimer = 0
103103
mtjustsaved = false
104-
mtsavecolors = {255, 112, 112, 127}
104+
mtsavecolors = {255, 112, 112, 128}
105105
pastingtiles = false
106106
pastemode = 1
107107
pastecenter = {0, 0}
@@ -272,11 +272,11 @@ function editor_load(player_position) --{x, y, xscroll, yscroll}
272272
guielements["portalbutton"].bordercolor = {0, 0, 255}
273273
guielements["portalbutton"].bordercolorhigh = {127, 127, 255}
274274
guielements["selectionbutton"] = guielement:new("button", 5, 58, TEXT["selection tool"], selectionbutton, 2, false, 1, 120)
275-
guielements["selectionbutton"].bordercolor = {1, 106, 0}
276-
guielements["selectionbutton"].bordercolorhigh = {1, 206, .5}
275+
guielements["selectionbutton"].bordercolor = {255, 106, 0}
276+
guielements["selectionbutton"].bordercolorhigh = {255, 206, 127}
277277
guielements["powerlinebutton"] = guielement:new("button", 5, 76, TEXT["power line draw"], powerlinebutton, 2, false, 1, 120)
278-
guielements["powerlinebutton"].bordercolor = {1, 216, 0}
279-
guielements["powerlinebutton"].bordercolorhigh = {1, 1, 220}
278+
guielements["powerlinebutton"].bordercolor = {255, 216, 0}
279+
guielements["powerlinebutton"].bordercolorhigh = {255, 255, 220}
280280
currenttooldesc = 1 --what description should be displayed for the buttons
281281

282282
guielements["livesdecrease"] = guielement:new("button", 294, 104, "{", livesdecrease, 0)
@@ -1430,7 +1430,7 @@ function editor_draw()
14301430

14311431
local transparent = false
14321432
while (t[4] == "down" and y+offy < mapheight+0.5) or (t[4] == "up" and y+offy > 0) do
1433-
love.graphics.setColor(255, 255, 255, 255)
1433+
love.graphics.setColor(255,255,255,255)
14341434
if transparent then
14351435
love.graphics.setColor(255, 255, 255, 100)
14361436
end
@@ -1515,7 +1515,7 @@ function editor_draw()
15151515
y = tonumber(s[3])
15161516
tile = tonumber(command:sub(s2+4, -1))
15171517
end
1518-
love.graphics.setColor(255, 255, 255, 150)
1518+
love.graphics.setColor(255,255,255,150)
15191519
local tx, ty = getMouseTile(mousex, mousey+8*screenzoom*scale)
15201520
properprint(tx .. "-" .. ty, mousex, mousey)
15211521
end
@@ -1647,7 +1647,7 @@ function editor_draw()
16471647
end
16481648
end
16491649
elseif customrcopen == "trackpath" then
1650-
love.graphics.setColor(255, 255, 255)
1650+
love.graphics.setColor(255,255,255)
16511651
local rcp = rightclicktrack
16521652
local lx, ly = rcp.last[1], rcp.last[2]--last pos
16531653
for i = 1, #rcp.path do
@@ -1693,15 +1693,15 @@ function editor_draw()
16931693
end
16941694
local cox, coy = getMouseTile(mousex, mousey+8*screenzoom*scale)
16951695
if (cox == tx and coy == ty and not trackrightclickmenu.active) or (trackrightclickmenu.active and trackrightclickmenustage == i) then
1696-
love.graphics.setColor(255, 216, 0, 255)
1696+
love.graphics.setColor(255,216,0,255)
16971697
end
16981698
love.graphics.draw(trackmarkerimg, trackmarkerquad[quadi], math.floor(((tx-xscroll-.5)*16)*scale), math.floor(((ty-yscroll-1)*16)*scale), r, scale, scale, 8, 8)
1699-
love.graphics.setColor(255, 255, 255)
1699+
love.graphics.setColor(255,255,255)
17001700
end
17011701
end
17021702
end
17031703
--next track
1704-
love.graphics.setColor(255, 216, 0, 150)
1704+
love.graphics.setColor(255,216,0,150)
17051705
local left, right, up, down, leftup, leftdown, rightup, rightdown = true,true,true,true,true,true,true,true
17061706
for i = #rcp.path, 1, -1 do
17071707
--check overlap
@@ -1874,7 +1874,7 @@ function editor_draw()
18741874
local sx, sy, sw, sh = x1-1, y1-1, x2-x1+1, y2-y1+1
18751875
love.graphics.setColor(0, 131, 255, 45)
18761876
love.graphics.rectangle("fill", ((sx-xscroll)*16)*scale,((sy-yscroll)*16-8)*scale, sw*16*scale, sh*16*scale)
1877-
love.graphics.setColor(255, 255, 255)
1877+
love.graphics.setColor(255,255,255)
18781878
love.graphics.stencil(function()
18791879
love.graphics.setLineWidth(scale)
18801880
love.graphics.rectangle("line", (math.floor((sx-xscroll)*16)+.5)*scale, (math.floor((sy-yscroll)*16)-8+.5)*scale, (sw*16-1)*scale, (sh*16-1)*scale) end, "increment")
@@ -2199,7 +2199,7 @@ function editor_draw()
21992199
else --just moving camera
22002200
love.graphics.setColor(255,0,0)
22012201
love.graphics.rectangle("line", (mapx+(xscroll+nmox)*s)*scale, (mapy+(yscroll+nmoy+.5)*s)*scale, width*s*scale, height*s*scale)
2202-
love.graphics.setColor(255, 255, 255)
2202+
love.graphics.setColor(255,255,255)
22032203
properprintFbackground(TEXT["toggle minimap with m"], 8*scale, (height*16-16)*scale)
22042204
end
22052205
else
@@ -2222,7 +2222,7 @@ function editor_draw()
22222222
guielements["tabcustom"]:draw()
22232223
guielements["tabanimations"]:draw()
22242224

2225-
if editorstate == "tiles" then
2225+
if editorstate == "tiles" then
22262226
--TILES
22272227
love.graphics.setColor(255, 255, 255)
22282228

@@ -2680,9 +2680,9 @@ function editor_draw()
26802680
love.graphics.setColor(0,0,0)
26812681
love.graphics.rectangle("fill", (lpd.x+1)*scale, (lpd.y+12)*scale, (lpd.width+5-2)*scale, (8*len+1-1)*scale)
26822682
if high then
2683-
love.graphics.setColor(255, 255, 255)
2683+
love.graphics.setColor(255,255,255)
26842684
else
2685-
love.graphics.setColor(127, 127, 127)
2685+
love.graphics.setColor(127,127,127)
26862686
end
26872687
drawrectangle(lpd.x, lpd.y+12, lpd.width+5, 8*len+1)
26882688
guielements["intermissioncheckbox"]:draw()
@@ -4694,7 +4694,7 @@ function createlevelbuttons(i)
46944694
local d = meta_data[i .. "~" .. j .. "~" .. k]
46954695
if d.img then
46964696
guielements[name].image = d.img
4697-
guielements[name].imagecolor = {127, 127, 127}
4697+
guielements[name].imagecolor = {128, 128, 128}
46984698
guielements[name].imageoffsetx = 2
46994699
guielements[name].imageoffsety = 2
47004700
end
@@ -5811,11 +5811,11 @@ function openrightclickmenu(x, y, tileX, tileY)
58115811
rightclickvalues2[variablenum] = dir
58125812
for i = objstart, objstart+objs-1 do
58135813
if i == obj then
5814-
rightclickobjects[i].bordercolorhigh = {255, 127, 127}
5815-
rightclickobjects[i].bordercolor = {255, 0, 0}
5814+
rightclickobjects[i].bordercolorhigh = {255,127,127}
5815+
rightclickobjects[i].bordercolor = {255,0,0}
58165816
else
5817-
rightclickobjects[i].bordercolorhigh = {255, 255, 255}
5818-
rightclickobjects[i].bordercolor = {127, 127, 127}
5817+
rightclickobjects[i].bordercolorhigh = {255,255,255}
5818+
rightclickobjects[i].bordercolor = {127,127,127}
58195819
end
58205820
end
58215821
end
@@ -5851,7 +5851,7 @@ function openrightclickmenu(x, y, tileX, tileY)
58515851
addv = 13
58525852
elseif obj == "slider" then
58535853
local d = guielement:new("scrollbar", rx, ry, 100, 33, 9, vt[t[2]], "hor")
5854-
d.backgroundcolor = {0, 0, 0}
5854+
d.backgroundcolor = {0,0,0}
58555855
d.scrollstep = 0
58565856
d.displayfunction = t[3]
58575857
d.rightclickvalue = t[2]

enemies/turret.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ function turret:draw()
500500
else
501501
love.graphics.draw(self.graphic, turretquad[1], math.floor(((self.x-xscroll)*16+self.offsetX+1)*scale), ((self.y-.5-yscroll)*16+self.offsetY)*scale, self.rotation, dirscale, scale, self.quadcenterX, self.quadcenterY)
502502
end
503-
503+
504504
local shade = 255*(1-turretdarkenfactor*self.timer)
505505
love.graphics.setColor(shade, shade, shade)
506506

errorwindow.lua

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,30 @@ function errorwindow:init(title, text)
2020
self.button["retry"] = guielement:new("button", self.x+self.width-8-padding, self.y+self.height-15-padding, "retry", function() end, 2)
2121
self.button["retry"].x = self.button["retry"].x - self.button["retry"].width
2222

23-
self.a = 1
23+
self.a = 255
2424
self.opened = false
2525
end
2626

2727
function errorwindow:update(dt)
28-
self.a = math.min(1, self.a + 3000*dt)
28+
self.a = math.min(255, self.a + 3000*dt)
2929
self.button["ignore"]:update(dt)
3030
self.button["retry"]:update(dt)
3131
end
3232

3333
function errorwindow:draw(a)
3434
a = a or self.a
3535
--window
36-
love.graphics.setColor(0, 0, 0, 230*(a/255))
36+
love.graphics.setColor(0,0,0,230*(a/255))
3737
love.graphics.rectangle("fill", self.x*scale, self.y*scale, self.width*scale, self.height*scale)
38-
love.graphics.setColor(255, 255, 255, a)
38+
love.graphics.setColor(255,255,255,a)
3939
drawrectangle(self.x, self.y, self.width, 19)
4040
drawrectangle(self.x, self.y+18, self.width, self.height-18)
4141
--text
4242
love.graphics.setScissor(self.x*scale, self.y*scale, self.width*scale, (self.height-padding-15)*scale)
43-
love.graphics.setColor(255, 255, 255, a)
43+
love.graphics.setColor(255,255,255,a)
4444
properprintfast(self.title, (self.x+padding)*scale, (self.y+padding)*scale)
4545

46-
love.graphics.setColor(255, 255, 255, a)
46+
love.graphics.setColor(255,255,255,a)
4747
properprintfastf(self.text, (self.x+padding)*scale, (self.y+padding+20)*scale, self.width-padding*2)
4848
love.graphics.setScissor()
4949

game.lua

+14-14
Original file line numberDiff line numberDiff line change
@@ -1548,9 +1548,9 @@ function game_draw()
15481548
--BACKGROUND TILES
15491549
if bmap_on then
15501550
if editormode then
1551-
love.graphics.setColor(255, 255, 255, 100)
1551+
love.graphics.setColor(255,255,255,100)
15521552
else
1553-
love.graphics.setColor(255, 255, 255, 255)
1553+
love.graphics.setColor(255,255,255,255)
15541554
end
15551555
love.graphics.draw(smbspritebatch[2], math.floor((-(xoff-math.floor(xscroll))*16)*scale), math.floor((-(yoff-math.floor(yscroll))*16)*scale))
15561556
love.graphics.draw(portalspritebatch[2], math.floor((-(xoff-math.floor(xscroll))*16)*scale), math.floor((-(yoff-math.floor(yscroll))*16)*scale))
@@ -1569,7 +1569,7 @@ function game_draw()
15691569
end
15701570
end
15711571
end
1572-
love.graphics.setColor(255, 255, 255, 255)
1572+
love.graphics.setColor(255,255,255,255)
15731573
end
15741574

15751575
--DROP SHADOW
@@ -1632,7 +1632,7 @@ function game_draw()
16321632
end
16331633
end
16341634
love.graphics.pop()
1635-
love.graphics.setColor(255, 255, 255, 255)
1635+
love.graphics.setColor(255,255,255,255)
16361636
end
16371637

16381638
--Mushroom under tiles
@@ -1774,7 +1774,7 @@ function game_draw()
17741774
end
17751775

17761776
--snakeblock
1777-
love.graphics.setColor(255, 255, 255)
1777+
love.graphics.setColor(255,255,255)
17781778
for j, w in pairs(objects["snakeblock"]) do
17791779
w:draw()
17801780
end
@@ -2113,7 +2113,7 @@ function game_draw()
21132113
for j, w in pairs(clearpipes) do
21142114
w:draw()
21152115
end
2116-
love.graphics.setColor(255, 255, 255)
2116+
love.graphics.setColor(255,255,255)
21172117

21182118
--3D Mode
21192119
if _3DMODE then
@@ -2158,7 +2158,7 @@ function game_draw()
21582158
end
21592159
love.graphics.pop()
21602160
end
2161-
love.graphics.setColor(255, 255, 255, 255)
2161+
love.graphics.setColor(255,255,255,255)
21622162
end
21632163

21642164
--lakito
@@ -2520,7 +2520,7 @@ function game_draw()
25202520
for i, v in pairs(portalprojectiles) do
25212521
v:particledraw()
25222522
end
2523-
love.graphics.setColor(255, 255, 255)
2523+
love.graphics.setColor(255,255,255)
25242524
love.graphics.draw(portalprojectilespritebatch,0,0)
25252525
for i, v in pairs(portalprojectiles) do
25262526
v:draw()
@@ -2777,17 +2777,17 @@ function game_draw()
27772777
end
27782778
love.graphics.stencil(stencil4)
27792779
love.graphics.setStencilTest("less", 1)
2780-
love.graphics.setColor(0, 0, 0, .25*255)
2780+
love.graphics.setColor(0, 0, 0, 255/4)
27812781
love.graphics.rectangle("fill", 0, 0, width*16*scale, 224*scale)
27822782
love.graphics.setStencilTest()
27832783
love.graphics.stencil(stencil3)
27842784
love.graphics.setStencilTest("less", 1)
2785-
love.graphics.setColor(0, 0, 0, .33*255)
2785+
love.graphics.setColor(0, 0, 0, 255/3)
27862786
love.graphics.rectangle("fill", 0, 0, width*16*scale, 224*scale)
27872787
love.graphics.setStencilTest()
27882788
love.graphics.stencil(stencil2)
27892789
love.graphics.setStencilTest("less", 1)
2790-
love.graphics.setColor(0, 0, 0, .5*255)
2790+
love.graphics.setColor(0, 0, 0, 255/2)
27912791
love.graphics.rectangle("fill", 0, 0, width*16*scale, 224*scale)
27922792
love.graphics.setStencilTest()
27932793
love.graphics.stencil(stencil)
@@ -2842,7 +2842,7 @@ function game_draw()
28422842
love.graphics.translate(0, yoffset*scale)
28432843

28442844
if testlevel then
2845-
love.graphics.setColor(255, 0, 0, .5*255)
2845+
love.graphics.setColor(255, 0, 0, 127)
28462846
properprintfast("TESTING LEVEL - PRESS ESC TO RETURN TO EDITOR", 16*scale, 0)
28472847
end
28482848

@@ -3678,7 +3678,7 @@ function drawplayer(i, x, y, r, pad, drop)
36783678

36793679
--ice block
36803680
if v.frozen then
3681-
love.graphics.setColor(255, 255, 255, a)
3681+
love.graphics.setColor(255,255,255, a)
36823682
local w, h = math.ceil(v.width)*2+1, math.ceil(v.height)*2+1
36833683
for x = 1, w do
36843684
for y = 1, h do
@@ -3728,7 +3728,7 @@ function drawplayer(i, x, y, r, pad, drop)
37283728
background = {0, 0, 0}
37293729
end]]
37303730

3731-
love.graphics.setColor(playerlist[v.playernumber].colors[1][1], playerlist[v.playernumber].colors[1][2], playerlist[v.playernumber].colors[1][3], .5*255)
3731+
love.graphics.setColor(playerlist[v.playernumber].colors[1][1], playerlist[v.playernumber].colors[1][2], playerlist[v.playernumber].colors[1][3], 127)
37323732
properprintbackground(nick, math.floor(((px-xscroll+v.width/2)*16-((#nick*8)/2))*scale), math.floor(((py-yscroll)*16-28)*scale), true)--, background)
37333733
end
37343734
end

0 commit comments

Comments
 (0)