From: sparky4 Date: Sat, 6 Aug 2022 01:04:49 +0000 (-0500) Subject: cleaned up and made fade.exe work correctly! X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=fa1d527c0bd2ba7a784b1cb8ec07cfd65da48ab2;p=16.git cleaned up and made fade.exe work correctly! --- diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100755 index f9f45091..00000000 --- a/.vscode/c_cpp_properties.json +++ /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 index 00000000..96522632 Binary files /dev/null and b/16/16/SCRC/.palette.h.kate-swp differ diff --git a/16/16/SCRC/PALETTE.C b/16/16/SCRC/PALETTE.C index 7a7e7342..9a3c8718 100755 --- a/16/16/SCRC/PALETTE.C +++ b/16/16/SCRC/PALETTE.C @@ -23,6 +23,12 @@ fadeOff(word fade, byte *palette) { } +void +fadeOffHalf(word fade, byte *palette) { + fadePaletteHalf(fade, 0, 64/fade+1, palette); +} + + void flashOn(word fade, byte *palette) { fadePalette(fade, -64, 64/fade+1, palette); @@ -61,6 +67,31 @@ fadePalette(byte fade, byte start, word iter, byte *palette) { } } +static void +fadePaletteHalf(byte fade, byte start, word iter, byte *palette) { + word i; + byte dim = start; + + /* handle the case where we just update */ + if(iter == 0) { + palUpdate(palette); + return; + } + + while(iter > iter/2) { /* FadeLoop */ + for(i=0; i 127) { + tmppal[i] = 0; + } else if(tmppal[i] > 63) { + tmppal[i] = 63; + } + } + palUpdate(tmppal); + iter--; + dim += fade; + } +} /* save and load */ void diff --git a/16/16/SCRC/TEST.EXE b/16/16/SCRC/TEST.EXE index bc4f11dc..42938b76 100755 Binary files a/16/16/SCRC/TEST.EXE and b/16/16/SCRC/TEST.EXE differ diff --git a/16/16/SCRC/fade.c b/16/16/SCRC/fade.c index 76557c12..35fc1c82 100755 --- a/16/16/SCRC/fade.c +++ b/16/16/SCRC/fade.c @@ -13,20 +13,12 @@ void main() { palSave(palette); /* fade to black and back */ - while (1) + while (!kbhit()) { fadeOff(1, palette); palBlack(); fadeOn(1, palette); palUpdate(palette); - - if (kbhit) - { - // Terminates the loop - // when escape is pressed - if (getch() == 27) - break; - } } free(palette); diff --git a/16/16/SCRC/fade.exe b/16/16/SCRC/fade.exe index e164f2d9..1e1e2fc2 100755 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 index 00000000..1e289204 --- /dev/null +++ b/16/16/SCRC/fade2.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include +#include "palette.h" + +void main() { + byte *palette; + int i; + + /* get our starting point */ + palette = newPal(); + palSave(palette); + + /* fade to black and back */ + while (!kbhit()) + { + fadeOffHalf(1, palette); + //palBlack(); + fadeOn(1, palette); + palUpdate(palette); + } + + free(palette); + return; +} diff --git a/16/16/SCRC/palette.c b/16/16/SCRC/palette.c index 7a7e7342..9a3c8718 100755 --- a/16/16/SCRC/palette.c +++ b/16/16/SCRC/palette.c @@ -23,6 +23,12 @@ fadeOff(word fade, byte *palette) { } +void +fadeOffHalf(word fade, byte *palette) { + fadePaletteHalf(fade, 0, 64/fade+1, palette); +} + + void flashOn(word fade, byte *palette) { fadePalette(fade, -64, 64/fade+1, palette); @@ -61,6 +67,31 @@ fadePalette(byte fade, byte start, word iter, byte *palette) { } } +static void +fadePaletteHalf(byte fade, byte start, word iter, byte *palette) { + word i; + byte dim = start; + + /* handle the case where we just update */ + if(iter == 0) { + palUpdate(palette); + return; + } + + while(iter > iter/2) { /* FadeLoop */ + for(i=0; i 127) { + tmppal[i] = 0; + } else if(tmppal[i] > 63) { + tmppal[i] = 63; + } + } + palUpdate(tmppal); + iter--; + dim += fade; + } +} /* save and load */ void diff --git a/16/16/SCRC/test.exe b/16/16/SCRC/test.exe index bc4f11dc..42938b76 100755 Binary files a/16/16/SCRC/test.exe and b/16/16/SCRC/test.exe differ