+++ /dev/null
-{
- "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
}\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
}\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
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
--- /dev/null
+#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
}\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
}\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