]> 4ch.mooo.com Git - 16.git/commitdiff
cleaned up and made fade.exe work correctly!
authorsparky4 <sparky4@cock.li>
Sat, 6 Aug 2022 01:04:49 +0000 (20:04 -0500)
committersparky4 <sparky4@cock.li>
Sat, 6 Aug 2022 01:04:49 +0000 (20:04 -0500)
.vscode/c_cpp_properties.json [deleted file]
16/16/SCRC/.palette.h.kate-swp [new file with mode: 0755]
16/16/SCRC/PALETTE.C
16/16/SCRC/TEST.EXE
16/16/SCRC/fade.c
16/16/SCRC/fade.exe
16/16/SCRC/fade2.c [new file with mode: 0755]
16/16/SCRC/palette.c
16/16/SCRC/test.exe

diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
deleted file mode 100755 (executable)
index f9f4509..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-{
-    "configurations": [
-        {
-            "name": "Linux",
-            "includePath": [
-                "${workspaceFolder}/**"
-            ],
-            "defines": [],
-            "compilerPath": "/usr/bin/gcc",
-            "cStandard": "gnu17",
-            "cppStandard": "gnu++14",
-            "intelliSenseMode": "linux-gcc-x64"
-        },
-        {
-            "name": "open watcom 2.0",
-            "includePath": [
-                "${workspaceFolder}/**",
-                "/dos/fdos/watcom2/h/**"
-            ],
-            "defines": [],
-            "compilerPath": "/dos/fdos/watcom2/binl/wcl",
-            "cStandard": "c89",
-            "cppStandard": "c++98",
-            "intelliSenseMode": "${default}",
-            "compilerArgs": [
-                "-0"
-            ]
-        }
-    ],
-    "version": 4
-}
\ No newline at end of file
diff --git a/16/16/SCRC/.palette.h.kate-swp b/16/16/SCRC/.palette.h.kate-swp
new file mode 100755 (executable)
index 0000000..9652263
Binary files /dev/null and b/16/16/SCRC/.palette.h.kate-swp differ
index 7a7e73421f5777f20cbac719549748b7086574d8..9a3c87189d6f7f65d607d6a27cafea0354440247 100755 (executable)
@@ -23,6 +23,12 @@ fadeOff(word fade, byte *palette) {
 }\r
 \r
 \r
+void\r
+fadeOffHalf(word fade, byte *palette) {\r
+       fadePaletteHalf(fade, 0, 64/fade+1, palette);\r
+}\r
+\r
+\r
 void\r
 flashOn(word fade, byte *palette) {\r
     fadePalette(fade, -64, 64/fade+1, palette);\r
@@ -61,6 +67,31 @@ fadePalette(byte fade, byte start, word iter, byte *palette) {
     }\r
 }\r
 \r
+static void\r
+fadePaletteHalf(byte fade, byte start, word iter, byte *palette) {\r
+    word i;\r
+    byte dim = start;\r
+\r
+    /* handle the case where we just update */\r
+    if(iter == 0) {\r
+       palUpdate(palette);\r
+       return;\r
+    }\r
+\r
+    while(iter > iter/2) {  /* FadeLoop */\r
+       for(i=0; i<PAL_SIZE; i++) { /* loadpal_loop */\r
+           tmppal[i] = palette[i] - dim;\r
+           if(tmppal[i] > 127) {\r
+               tmppal[i] = 0;\r
+           } else if(tmppal[i] > 63) {\r
+               tmppal[i] = 63;\r
+           }\r
+       }\r
+        palUpdate(tmppal);\r
+       iter--;\r
+       dim += fade;\r
+    }\r
+}\r
 \r
 /* save and load */\r
 void\r
index bc4f11dce15556f77ad05faea099e148ce969087..42938b760ce1051d2123a0e0faa7a9424c1ab5f7 100755 (executable)
Binary files a/16/16/SCRC/TEST.EXE and b/16/16/SCRC/TEST.EXE differ
index 76557c1232a621fac57c578219093afaed61a280..35fc1c829ec0654059b39b1aa208e903f60c59b2 100755 (executable)
@@ -13,20 +13,12 @@ void main() {
     palSave(palette);\r
 \r
     /* fade to black and back */\r
-       while (1)\r
+       while (!kbhit())\r
        {\r
                fadeOff(1, palette);\r
                palBlack();\r
                fadeOn(1, palette);\r
                palUpdate(palette);\r
-\r
-               if (kbhit)\r
-               {\r
-                       // Terminates the loop\r
-                       // when escape is pressed\r
-                       if (getch() == 27)\r
-                               break;\r
-               }\r
        }\r
 \r
     free(palette);\r
index e164f2d9bd356817a2c2483218e2a756e9164c54..1e1e2fc22bbf7a60766bb01a3493219ffa753094 100755 (executable)
Binary files a/16/16/SCRC/fade.exe and b/16/16/SCRC/fade.exe differ
diff --git a/16/16/SCRC/fade2.c b/16/16/SCRC/fade2.c
new file mode 100755 (executable)
index 0000000..1e28920
--- /dev/null
@@ -0,0 +1,26 @@
+#include <stdio.h>\r
+#include <conio.h>\r
+#include <string.h>\r
+#include <stdlib.h>\r
+#include "palette.h"\r
+\r
+void main() {\r
+    byte *palette;\r
+    int i;\r
+\r
+    /* get our starting point */\r
+    palette = newPal();\r
+    palSave(palette);\r
+\r
+    /* fade to black and back */\r
+       while (!kbhit())\r
+       {\r
+               fadeOffHalf(1, palette);\r
+               //palBlack();\r
+               fadeOn(1, palette);\r
+               palUpdate(palette);\r
+       }\r
+\r
+    free(palette);\r
+    return;\r
+}\r
index 7a7e73421f5777f20cbac719549748b7086574d8..9a3c87189d6f7f65d607d6a27cafea0354440247 100755 (executable)
@@ -23,6 +23,12 @@ fadeOff(word fade, byte *palette) {
 }\r
 \r
 \r
+void\r
+fadeOffHalf(word fade, byte *palette) {\r
+       fadePaletteHalf(fade, 0, 64/fade+1, palette);\r
+}\r
+\r
+\r
 void\r
 flashOn(word fade, byte *palette) {\r
     fadePalette(fade, -64, 64/fade+1, palette);\r
@@ -61,6 +67,31 @@ fadePalette(byte fade, byte start, word iter, byte *palette) {
     }\r
 }\r
 \r
+static void\r
+fadePaletteHalf(byte fade, byte start, word iter, byte *palette) {\r
+    word i;\r
+    byte dim = start;\r
+\r
+    /* handle the case where we just update */\r
+    if(iter == 0) {\r
+       palUpdate(palette);\r
+       return;\r
+    }\r
+\r
+    while(iter > iter/2) {  /* FadeLoop */\r
+       for(i=0; i<PAL_SIZE; i++) { /* loadpal_loop */\r
+           tmppal[i] = palette[i] - dim;\r
+           if(tmppal[i] > 127) {\r
+               tmppal[i] = 0;\r
+           } else if(tmppal[i] > 63) {\r
+               tmppal[i] = 63;\r
+           }\r
+       }\r
+        palUpdate(tmppal);\r
+       iter--;\r
+       dim += fade;\r
+    }\r
+}\r
 \r
 /* save and load */\r
 void\r
index bc4f11dce15556f77ad05faea099e148ce969087..42938b760ce1051d2123a0e0faa7a9424c1ab5f7 100755 (executable)
Binary files a/16/16/SCRC/test.exe and b/16/16/SCRC/test.exe differ