Better code readability. Add screenshots.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Wed, 25 Jun 2025 22:05:00 +0000 (01:05 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Wed, 25 Jun 2025 22:05:00 +0000 (01:05 +0300)
13 files changed:
2D GFX/Textures/circular waves.bas [new file with mode: 0755]
2D GFX/Textures/circular waves.png [new file with mode: 0644]
2D GFX/Textures/diamond square clouds.bas [new file with mode: 0755]
2D GFX/Textures/diamond square clouds.png [new file with mode: 0644]
2D GFX/Textures/map1.bas [deleted file]
2D GFX/Textures/map2.bas [deleted file]
2D GFX/Textures/map3.bas [deleted file]
2D GFX/Textures/old paper.bas [new file with mode: 0755]
2D GFX/Textures/old paper.png [new file with mode: 0644]
2D GFX/Textures/oldpaper.bas [deleted file]
2D GFX/Textures/test3.bas [deleted file]
2D GFX/Textures/yellow flame.bas [new file with mode: 0755]
2D GFX/Textures/yellow flame.png [new file with mode: 0644]

diff --git a/2D GFX/Textures/circular waves.bas b/2D GFX/Textures/circular waves.bas
new file mode 100755 (executable)
index 0000000..d2242d0
--- /dev/null
@@ -0,0 +1,29 @@
+' Draw circular wave pattern.\r
+' Made by Svjatoslav Agejenko in 2003.12\r
+' H-Page: svjatoslav.eu\r
+' E-Mail: svjatoslav@svjatoslav.eu\r
+\r
+SCREEN 13\r
+\r
+' Initialize the screen mode to 320x200 with 16 colors\r
+\r
+' Outer loop for the vertical axis (y-coordinate)\r
+FOR ycoordinate = 1 TO 199\r
+    ' Inner loop for the horizontal axis (x-coordinate)\r
+    FOR xcoordinate = 1 TO 319\r
+        ' Calculate the sine value based on the squared distances from the origin\r
+        colorvalue = SIN((xcoordinate ^ 2 + ycoordinate ^ 2) / 10) * 10\r
+\r
+        ' Clamp the color value to the range [0, 15]\r
+        IF colorvalue < 0 THEN colorvalue = 0\r
+        IF colorvalue > 15 THEN colorvalue = 15\r
+\r
+        ' Set the pixel color at (xcoordinate, ycoordinate) with an offset to use the full 16-color palette\r
+        PSET (xcoordinate, ycoordinate), colorvalue + 16\r
+    NEXT xcoordinate\r
+NEXT ycoordinate\r
+\r
+' Wait for user key press\r
+WHILE INKEY$ = "": WEND\r
+CLS\r
+END\r
diff --git a/2D GFX/Textures/circular waves.png b/2D GFX/Textures/circular waves.png
new file mode 100644 (file)
index 0000000..fbb5233
Binary files /dev/null and b/2D GFX/Textures/circular waves.png differ
diff --git a/2D GFX/Textures/diamond square clouds.bas b/2D GFX/Textures/diamond square clouds.bas
new file mode 100755 (executable)
index 0000000..927409b
--- /dev/null
@@ -0,0 +1,94 @@
+DECLARE SUB DrawPixels (x1 AS INTEGER, y1 AS INTEGER, s AS INTEGER)\r
+' Program to render cloud surface using diamond square algorithm.\r
+' By Svjatoslav Agejenko.\r
+' Email: svjatoslav@svjatoslav.eu\r
+' Homepage: http://www.svjatoslav.eu\r
+'\r
+' Changelog:\r
+' 2003.12, Initial version\r
+' 2024.08, Improved program readability using AI\r
+\r
+DECLARE SUB DrawBox (x1 AS INTEGER, y1 AS INTEGER, s AS INTEGER)\r
+DECLARE SUB SetPalette ()\r
+DECLARE SUB InitializeProgram ()\r
+DEFINT A-Z\r
+InitializeProgram\r
+\r
+DIM SHARED maxLightness AS INTEGER\r
+maxLightness = 127\r
+\r
+DIM scale AS INTEGER\r
+scale = 2 ^ 8\r
+\r
+1 :\r
+scale = scale \ 2\r
+x1 = (319 \ scale) - 1\r
+y1 = (199 \ scale) - 1\r
+\r
+FOR y = 0 TO y1\r
+    FOR x = 0 TO x1\r
+        DrawPixels x * scale, y * scale, scale\r
+    NEXT x\r
+NEXT y\r
+\r
+IF scale > 2 THEN GOTO 1\r
+WAITa$ = INPUT$(1)\r
+\r
+SUB DrawPixels (x1 AS INTEGER, y1 AS INTEGER, s AS INTEGER)\r
+    ' Get the lightness values for the corners of the box\r
+    c1 = POINT(x1, y1)\r
+    c2 = POINT(x1 + s, y1)\r
+    c3 = POINT(x1, y1 + s)\r
+    c4 = POINT(x1 + s, y1 + s)\r
+\r
+    ' Calculate the midpoint lightness values\r
+    sp = s \ 2\r
+    k = s * 2\r
+    kp = k / 2\r
+\r
+    cc2 = ((c1 + c2) / 2) + (RND * k) - kp\r
+    IF cc2 > maxLightness THEN cc2 = maxLightness\r
+    IF cc2 < 0 THEN cc2 = 0\r
+\r
+    cc3 = ((c1 + c3) / 2) + (RND * k) - kp\r
+    IF cc3 > maxLightness THEN cc3 = maxLightness\r
+    IF cc3 < 0 THEN cc3 = 0\r
+\r
+    cc4 = ((c2 + c4) / 2) + (RND * k) - kp\r
+    IF cc4 > maxLightness THEN cc4 = maxLightness\r
+    IF cc4 < 0 THEN cc4 = 0\r
+\r
+    cc5 = ((c3 + c4) / 2) + (RND * k) - kp\r
+    IF cc5 > maxLightness THEN cc5 = maxLightness\r
+    IF cc5 < 0 THEN cc5 = 0\r
+\r
+    ' Calculate the central lightness value\r
+    cc1 = ((cc2 + cc3 + cc4 + cc5) / 4) + (RND * k) - kp\r
+    IF cc1 > maxLightness THEN cc1 = maxLightness\r
+    IF cc1 < 0 THEN cc1 = 0\r
+\r
+    ' Set the calculated lightness values for the box\r
+    PSET (x1 + sp, y1 + sp), cc1\r
+    PSET (x1 + sp, y1), cc2\r
+    PSET (x1, y1 + sp), cc3\r
+    PSET (x1 + s, y1 + sp), cc4\r
+    PSET (x1 + sp, y1 + s), cc5\r
+END SUB\r
+\r
+SUB InitializeProgram\r
+    ' Set the screen mode and initialize the color palette\r
+    SCREEN 13\r
+    SetPalette\r
+    RANDOMIZE TIMER\r
+END SUB\r
+\r
+SUB SetPalette\r
+    ' Set the color palette for lightness levels\r
+    FOR a = 0 TO 255\r
+        OUT &H3C8, a\r
+        OUT &H3C9, a / 4\r
+        OUT &H3C9, a / 3\r
+        OUT &H3C9, a / 2.3\r
+    NEXT a\r
+END SUB\r
+\r
diff --git a/2D GFX/Textures/diamond square clouds.png b/2D GFX/Textures/diamond square clouds.png
new file mode 100644 (file)
index 0000000..b596db6
Binary files /dev/null and b/2D GFX/Textures/diamond square clouds.png differ
diff --git a/2D GFX/Textures/map1.bas b/2D GFX/Textures/map1.bas
deleted file mode 100755 (executable)
index 56ffcce..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-' Yellow flame\r
-' By Svjatoslav Agejenko.\r
-' Email: svjatoslav@svjatoslav.eu\r
-' Homepage: http://www.svjatoslav.eu\r
-'\r
-' Changelog:\r
-' 2003.12, Initial version\r
-' 2024.08, Improved program readability using AI\r
-\r
-\r
-DEFINT A-Z ' Define all variables as integers\r
-SCREEN 13 ' Set graphics mode to 320x200 with 256 colors\r
-RANDOMIZE TIMER ' Seed the random number generator\r
-\r
-' Initialize palette registers with sine wave colors\r
-FOR paletteIndex = 0 TO 255\r
-    OUT &H3C8, paletteIndex\r
-    OUT &H3C9, INT(SIN(paletteIndex / 21) * 30 + 30)\r
-    OUT &H3C9, INT(SIN(paletteIndex / 34) * 30 + 30)\r
-    OUT &H3C9, INT(SIN(paletteIndex / 10) * 30 + 30)\r
-NEXT paletteIndex\r
-\r
-' Generate the surface pattern\r
-FOR y = 1 TO 199\r
-    FOR x = 1 TO 319\r
-        prevPixel = POINT(x, y - 1)\r
-        leftPixel = POINT(x - 1, y)\r
-        diagPixel = POINT(x - 1, y - 1)\r
-        left2Pixel = POINT(x - 2, y)\r
-\r
-        ' Calculate the average of surrounding pixels and add some randomness\r
-        newColor = (prevPixel + leftPixel + diagPixel + left2Pixel) \ 4 + (RND * 5 - 2)\r
-\r
-        ' Clamp the color value within the valid range\r
-        IF newColor < 0 THEN newColor = 0\r
-        IF newColor > 63 THEN newColor = 63\r
-\r
-        ' Set the pixel with the calculated color\r
-        PSET (x, y), newColor\r
-    NEXT x\r
-NEXT y\r
-\r
-' Wait for user input to exit\r
-userInput$ = INPUT$(1)\r
-\r
diff --git a/2D GFX/Textures/map2.bas b/2D GFX/Textures/map2.bas
deleted file mode 100755 (executable)
index 7fde5c0..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-' Old paper surface\r
-' made by Svjatoslav Agejenko\r
-' in 2003.12\r
-' H-Page: svjatoslav.eu\r
-' E-Mail: svjatoslav@svjatoslav.eu\r
\r
-DEFINT A-Z\r
-SCREEN 13\r
-RANDOMIZE TIMER\r
-FOR a = 0 TO 63\r
-OUT &H3C8, a\r
-OUT &H3C9, a  'R\r
-OUT &H3C9, a  'G\r
-OUT &H3C9, a  'B\r
-NEXT a\r
-\r
-z = 0\r
-\r
-FOR y = 1 TO 190\r
-FOR x = 1 TO 310\r
-p = p + 1\r
-IF p > 10 THEN z = RND * c / 20: p = p - (RND * 20 + 10)\r
-c1 = POINT(x, y - 1)\r
-c = (c1 + c) \ 2 + ((RND * 2) - z)\r
-IF c < 0 THEN c = 0\r
-IF c > 63 THEN c = 63\r
-PSET (x - 1, y), c\r
-\r
-NEXT x\r
-PSET (0, y + 1), c\r
-NEXT y\r
-a$ = INPUT$(1)\r
-\r
-SYSTEM\r
-\r
diff --git a/2D GFX/Textures/map3.bas b/2D GFX/Textures/map3.bas
deleted file mode 100755 (executable)
index 927409b..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-DECLARE SUB DrawPixels (x1 AS INTEGER, y1 AS INTEGER, s AS INTEGER)\r
-' Program to render cloud surface using diamond square algorithm.\r
-' By Svjatoslav Agejenko.\r
-' Email: svjatoslav@svjatoslav.eu\r
-' Homepage: http://www.svjatoslav.eu\r
-'\r
-' Changelog:\r
-' 2003.12, Initial version\r
-' 2024.08, Improved program readability using AI\r
-\r
-DECLARE SUB DrawBox (x1 AS INTEGER, y1 AS INTEGER, s AS INTEGER)\r
-DECLARE SUB SetPalette ()\r
-DECLARE SUB InitializeProgram ()\r
-DEFINT A-Z\r
-InitializeProgram\r
-\r
-DIM SHARED maxLightness AS INTEGER\r
-maxLightness = 127\r
-\r
-DIM scale AS INTEGER\r
-scale = 2 ^ 8\r
-\r
-1 :\r
-scale = scale \ 2\r
-x1 = (319 \ scale) - 1\r
-y1 = (199 \ scale) - 1\r
-\r
-FOR y = 0 TO y1\r
-    FOR x = 0 TO x1\r
-        DrawPixels x * scale, y * scale, scale\r
-    NEXT x\r
-NEXT y\r
-\r
-IF scale > 2 THEN GOTO 1\r
-WAITa$ = INPUT$(1)\r
-\r
-SUB DrawPixels (x1 AS INTEGER, y1 AS INTEGER, s AS INTEGER)\r
-    ' Get the lightness values for the corners of the box\r
-    c1 = POINT(x1, y1)\r
-    c2 = POINT(x1 + s, y1)\r
-    c3 = POINT(x1, y1 + s)\r
-    c4 = POINT(x1 + s, y1 + s)\r
-\r
-    ' Calculate the midpoint lightness values\r
-    sp = s \ 2\r
-    k = s * 2\r
-    kp = k / 2\r
-\r
-    cc2 = ((c1 + c2) / 2) + (RND * k) - kp\r
-    IF cc2 > maxLightness THEN cc2 = maxLightness\r
-    IF cc2 < 0 THEN cc2 = 0\r
-\r
-    cc3 = ((c1 + c3) / 2) + (RND * k) - kp\r
-    IF cc3 > maxLightness THEN cc3 = maxLightness\r
-    IF cc3 < 0 THEN cc3 = 0\r
-\r
-    cc4 = ((c2 + c4) / 2) + (RND * k) - kp\r
-    IF cc4 > maxLightness THEN cc4 = maxLightness\r
-    IF cc4 < 0 THEN cc4 = 0\r
-\r
-    cc5 = ((c3 + c4) / 2) + (RND * k) - kp\r
-    IF cc5 > maxLightness THEN cc5 = maxLightness\r
-    IF cc5 < 0 THEN cc5 = 0\r
-\r
-    ' Calculate the central lightness value\r
-    cc1 = ((cc2 + cc3 + cc4 + cc5) / 4) + (RND * k) - kp\r
-    IF cc1 > maxLightness THEN cc1 = maxLightness\r
-    IF cc1 < 0 THEN cc1 = 0\r
-\r
-    ' Set the calculated lightness values for the box\r
-    PSET (x1 + sp, y1 + sp), cc1\r
-    PSET (x1 + sp, y1), cc2\r
-    PSET (x1, y1 + sp), cc3\r
-    PSET (x1 + s, y1 + sp), cc4\r
-    PSET (x1 + sp, y1 + s), cc5\r
-END SUB\r
-\r
-SUB InitializeProgram\r
-    ' Set the screen mode and initialize the color palette\r
-    SCREEN 13\r
-    SetPalette\r
-    RANDOMIZE TIMER\r
-END SUB\r
-\r
-SUB SetPalette\r
-    ' Set the color palette for lightness levels\r
-    FOR a = 0 TO 255\r
-        OUT &H3C8, a\r
-        OUT &H3C9, a / 4\r
-        OUT &H3C9, a / 3\r
-        OUT &H3C9, a / 2.3\r
-    NEXT a\r
-END SUB\r
-\r
diff --git a/2D GFX/Textures/old paper.bas b/2D GFX/Textures/old paper.bas
new file mode 100755 (executable)
index 0000000..7fde5c0
--- /dev/null
@@ -0,0 +1,35 @@
+' Old paper surface\r
+' made by Svjatoslav Agejenko\r
+' in 2003.12\r
+' H-Page: svjatoslav.eu\r
+' E-Mail: svjatoslav@svjatoslav.eu\r
\r
+DEFINT A-Z\r
+SCREEN 13\r
+RANDOMIZE TIMER\r
+FOR a = 0 TO 63\r
+OUT &H3C8, a\r
+OUT &H3C9, a  'R\r
+OUT &H3C9, a  'G\r
+OUT &H3C9, a  'B\r
+NEXT a\r
+\r
+z = 0\r
+\r
+FOR y = 1 TO 190\r
+FOR x = 1 TO 310\r
+p = p + 1\r
+IF p > 10 THEN z = RND * c / 20: p = p - (RND * 20 + 10)\r
+c1 = POINT(x, y - 1)\r
+c = (c1 + c) \ 2 + ((RND * 2) - z)\r
+IF c < 0 THEN c = 0\r
+IF c > 63 THEN c = 63\r
+PSET (x - 1, y), c\r
+\r
+NEXT x\r
+PSET (0, y + 1), c\r
+NEXT y\r
+a$ = INPUT$(1)\r
+\r
+SYSTEM\r
+\r
diff --git a/2D GFX/Textures/old paper.png b/2D GFX/Textures/old paper.png
new file mode 100644 (file)
index 0000000..d9c900b
Binary files /dev/null and b/2D GFX/Textures/old paper.png differ
diff --git a/2D GFX/Textures/oldpaper.bas b/2D GFX/Textures/oldpaper.bas
deleted file mode 100755 (executable)
index 8bdca0d..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-' Program to render surface resembling old paper.\r
-' By Svjatoslav Agejenko.\r
-' Email: svjatoslav@svjatoslav.eu\r
-' Homepage: http://www.svjatoslav.eu\r
-'\r
-' Changelog:\r
-' 2003.12, Initial version\r
-' 2024.08, Improved program readability using AI\r
-\r
-DECLARE SUB DrawPaper (x1 AS INTEGER, y1 AS INTEGER, x2 AS INTEGER, y2 AS INTEGER)\r
-\r
-DEFINT A-Z\r
-SCREEN 12\r
-RANDOMIZE TIMER\r
-\r
-' Set color palette\r
-FOR colorIndex = 0 TO 15\r
-    OUT &H3C8, colorIndex\r
-    OUT &H3C9, colorIndex * 3\r
-    OUT &H3C9, colorIndex * 3\r
-    OUT &H3C9, colorIndex * 2\r
-NEXT colorIndex\r
-\r
-' Generate and draw paper surfaces continuously until a key is pressed\r
-1\r
-    x1 = RND * 600 + 20\r
-    x2 = RND * 600 + 20\r
-    y1 = RND * 400 + 40\r
-    y2 = RND * 400 + 40\r
-\r
-    ' Ensure x1 is less than x2 and y1 is less than y2\r
-    IF x1 > x2 THEN SWAP x1, x2\r
-    IF y1 > y2 THEN SWAP y1, y2\r
-\r
-    ' Draw the paper with the calculated coordinates\r
-    CALL DrawPaper(x1, y1, x2, y2)\r
-\r
-    ' Continue drawing until any key is pressed\r
-    IF INKEY$ <> "" THEN SYSTEM\r
-GOTO 1\r
-\r
-SUB DrawPaper (x1 AS INTEGER, y1 AS INTEGER, x2 AS INTEGER, y2 AS INTEGER)\r
-    DIM c AS INTEGER\r
-    DIM z AS SINGLE\r
-    DIM p AS INTEGER\r
-    DIM c1 AS INTEGER\r
-    DIM yl AS INTEGER\r
-\r
-    ' Initialize variables\r
-    yl = y2 + 1\r
-    z = 0\r
-\r
-    ' Draw the bottom and right borders of the paper\r
-    LINE (x1, y1)-(x2, y1), 0\r
-    LINE (x2, y1)-(x2, y2), 0\r
-\r
-    ' Generate the texture of the paper\r
-    FOR y = y1 + 1 TO y2\r
-        c = 0\r
-        FOR x = x1 TO x2\r
-            p = p + 1\r
-\r
-            ' Randomly reset the pattern counter\r
-            IF p > 23 THEN\r
-                z = RND * 1\r
-                p = 0\r
-            END IF\r
-\r
-            ' Get the color of the previous row\r
-            c1 = POINT(x, y - 1)\r
-\r
-            ' Calculate the average color with random variation\r
-            c = (c1 + c) / 2 + (RND * (2 + (5 / y))) - (3 / (yl - y)) - z\r
-\r
-            ' Clamp the color value within the range [0, 15]\r
-            IF c < 0 THEN c = 0\r
-            IF c > 15 THEN c = 15\r
-\r
-            ' Set the pixel color for the current position\r
-            PSET (x - 1, y), c\r
-        NEXT x\r
-    NEXT y\r
-END SUB\r
-\r
diff --git a/2D GFX/Textures/test3.bas b/2D GFX/Textures/test3.bas
deleted file mode 100755 (executable)
index c23659c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-' Strange surface\r
-' Made by Svjatoslav Agejenko in 2003.12\r
-' H-Page: svjatoslav.eu\r
-' E-Mail: svjatoslav@svjatoslav.eu\r
-\r
-SCREEN 13\r
-\r
-' Initialize the screen mode to 320x200 with 16 colors\r
-\r
-' Outer loop for the vertical axis (y-coordinate)\r
-FOR ycoordinate = 1 TO 199\r
-    ' Inner loop for the horizontal axis (x-coordinate)\r
-    FOR xcoordinate = 1 TO 319\r
-        ' Calculate the sine value based on the squared distances from the origin\r
-        colorvalue = SIN((xcoordinate ^ 2 + ycoordinate ^ 2) / 10) * 10\r
-\r
-        ' Clamp the color value to the range [0, 15]\r
-        IF colorvalue < 0 THEN colorvalue = 0\r
-        IF colorvalue > 15 THEN colorvalue = 15\r
-\r
-        ' Set the pixel color at (xcoordinate, ycoordinate) with an offset to use the full 16-color palette\r
-        PSET (xcoordinate, ycoordinate), colorvalue + 16\r
-    NEXT xcoordinate\r
-NEXT ycoordinate\r
-\r
-' Wait for a key press before exiting\r
-WAIT 30, 1
\ No newline at end of file
diff --git a/2D GFX/Textures/yellow flame.bas b/2D GFX/Textures/yellow flame.bas
new file mode 100755 (executable)
index 0000000..56ffcce
--- /dev/null
@@ -0,0 +1,45 @@
+' Yellow flame\r
+' By Svjatoslav Agejenko.\r
+' Email: svjatoslav@svjatoslav.eu\r
+' Homepage: http://www.svjatoslav.eu\r
+'\r
+' Changelog:\r
+' 2003.12, Initial version\r
+' 2024.08, Improved program readability using AI\r
+\r
+\r
+DEFINT A-Z ' Define all variables as integers\r
+SCREEN 13 ' Set graphics mode to 320x200 with 256 colors\r
+RANDOMIZE TIMER ' Seed the random number generator\r
+\r
+' Initialize palette registers with sine wave colors\r
+FOR paletteIndex = 0 TO 255\r
+    OUT &H3C8, paletteIndex\r
+    OUT &H3C9, INT(SIN(paletteIndex / 21) * 30 + 30)\r
+    OUT &H3C9, INT(SIN(paletteIndex / 34) * 30 + 30)\r
+    OUT &H3C9, INT(SIN(paletteIndex / 10) * 30 + 30)\r
+NEXT paletteIndex\r
+\r
+' Generate the surface pattern\r
+FOR y = 1 TO 199\r
+    FOR x = 1 TO 319\r
+        prevPixel = POINT(x, y - 1)\r
+        leftPixel = POINT(x - 1, y)\r
+        diagPixel = POINT(x - 1, y - 1)\r
+        left2Pixel = POINT(x - 2, y)\r
+\r
+        ' Calculate the average of surrounding pixels and add some randomness\r
+        newColor = (prevPixel + leftPixel + diagPixel + left2Pixel) \ 4 + (RND * 5 - 2)\r
+\r
+        ' Clamp the color value within the valid range\r
+        IF newColor < 0 THEN newColor = 0\r
+        IF newColor > 63 THEN newColor = 63\r
+\r
+        ' Set the pixel with the calculated color\r
+        PSET (x, y), newColor\r
+    NEXT x\r
+NEXT y\r
+\r
+' Wait for user input to exit\r
+userInput$ = INPUT$(1)\r
+\r
diff --git a/2D GFX/Textures/yellow flame.png b/2D GFX/Textures/yellow flame.png
new file mode 100644 (file)
index 0000000..762a97b
Binary files /dev/null and b/2D GFX/Textures/yellow flame.png differ