Hide button: inverted right and left clicks. Fixed credits. Lua: arguments of MatchColor and SetColor are now automatically clamped on 0 and 255 when they are too small or too big, instead of wrapping.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1321 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
64
scripts/dawnbringer1.lua
Normal file
64
scripts/dawnbringer1.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
-- Picture scene: Amigaball (by Richard Fhager, code adopted from Evalion)
|
||||
|
||||
w = 256
|
||||
h = 256
|
||||
|
||||
setpicturesize(w,h)
|
||||
|
||||
|
||||
-- Set Amiga Palette
|
||||
|
||||
colors = {}
|
||||
|
||||
for c = 0, 63, 1 do
|
||||
colors[c+1] = {c*4,0,0}
|
||||
end
|
||||
|
||||
for c = 0, 63, 1 do
|
||||
colors[c+65] = {255,c*4,c*4}
|
||||
end
|
||||
|
||||
for c = 0, 63, 1 do
|
||||
colors[c+129] = {255-c*4,255-c*4,255-c*4}
|
||||
end
|
||||
|
||||
for c = 1, #colors, 1 do
|
||||
setcolor(c-1,colors[c][1],colors[c][2],colors[c][3])
|
||||
end
|
||||
|
||||
|
||||
-- Make Amiga ball
|
||||
|
||||
for y = 0, h - 1, 1 do
|
||||
for x = 0, w - 1, 1 do
|
||||
|
||||
-- Fractionalize image dimensions
|
||||
ox = x / w;
|
||||
oy = y / h;
|
||||
|
||||
-- Ball
|
||||
Xr = ox-0.5; Yr = oy-0.5;
|
||||
W = (1 - 2*math.sqrt(Xr*Xr + Yr*Yr));
|
||||
|
||||
-- 'FishEye' distortion / Fake 3D
|
||||
F = (math.cos((ox-0.5)*math.pi)*math.cos((oy-0.5)*math.pi))*0.65;
|
||||
ox = ox - (ox-0.5)*F;
|
||||
oy = oy - (oy-0.5)*F;
|
||||
|
||||
-- Checkers
|
||||
V = ((math.floor(0.25+ox*10)+math.floor(1+oy*10)) % 2) * 255 * W;
|
||||
|
||||
-- Specularities
|
||||
SPEC1 = math.max(0,(1-5*math.sqrt((ox-0.45)*(ox-0.45)+(oy-0.45)*(oy-0.45)))*112);
|
||||
SPEC2 = math.max(0,(1-15*math.sqrt((ox-0.49)*(ox-0.49)+(oy-0.48)*(oy-0.48)))*255);
|
||||
|
||||
r = W * 255 + SPEC1 + SPEC2
|
||||
g = V + SPEC1 + SPEC2
|
||||
b = V + SPEC1 + SPEC2
|
||||
|
||||
c = matchcolor(r,g,b)
|
||||
|
||||
putpicturepixel(x, y, c);
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user