Commit MetaInfo

Revisionfa1d527c0bd2ba7a784b1cb8ec07cfd65da48ab2 (tree)
Time2022-08-06 10:04:49
Authorsparky4 <sparky4@cock...>
Commitersparky4

Log Message

cleaned up and made fade.exe work correctly!

Change Summary

Incremental Difference

--- a/.vscode/c_cpp_properties.json
+++ /dev/null
@@ -1,31 +0,0 @@
1-{
2- "configurations": [
3- {
4- "name": "Linux",
5- "includePath": [
6- "${workspaceFolder}/**"
7- ],
8- "defines": [],
9- "compilerPath": "/usr/bin/gcc",
10- "cStandard": "gnu17",
11- "cppStandard": "gnu++14",
12- "intelliSenseMode": "linux-gcc-x64"
13- },
14- {
15- "name": "open watcom 2.0",
16- "includePath": [
17- "${workspaceFolder}/**",
18- "/dos/fdos/watcom2/h/**"
19- ],
20- "defines": [],
21- "compilerPath": "/dos/fdos/watcom2/binl/wcl",
22- "cStandard": "c89",
23- "cppStandard": "c++98",
24- "intelliSenseMode": "${default}",
25- "compilerArgs": [
26- "-0"
27- ]
28- }
29- ],
30- "version": 4
31-}
\ No newline at end of file
Binary files /dev/null and b/16/16/SCRC/.palette.h.kate-swp differ
--- a/16/16/SCRC/PALETTE.C
+++ b/16/16/SCRC/PALETTE.C
@@ -24,6 +24,12 @@ fadeOff(word fade, byte *palette) {
2424
2525
2626 void
27+fadeOffHalf(word fade, byte *palette) {
28+ fadePaletteHalf(fade, 0, 64/fade+1, palette);
29+}
30+
31+
32+void
2733 flashOn(word fade, byte *palette) {
2834 fadePalette(fade, -64, 64/fade+1, palette);
2935 }
@@ -61,6 +67,31 @@ fadePalette(byte fade, byte start, word iter, byte *palette) {
6167 }
6268 }
6369
70+static void
71+fadePaletteHalf(byte fade, byte start, word iter, byte *palette) {
72+ word i;
73+ byte dim = start;
74+
75+ /* handle the case where we just update */
76+ if(iter == 0) {
77+ palUpdate(palette);
78+ return;
79+ }
80+
81+ while(iter > iter/2) { /* FadeLoop */
82+ for(i=0; i<PAL_SIZE; i++) { /* loadpal_loop */
83+ tmppal[i] = palette[i] - dim;
84+ if(tmppal[i] > 127) {
85+ tmppal[i] = 0;
86+ } else if(tmppal[i] > 63) {
87+ tmppal[i] = 63;
88+ }
89+ }
90+ palUpdate(tmppal);
91+ iter--;
92+ dim += fade;
93+ }
94+}
6495
6596 /* save and load */
6697 void
Binary files a/16/16/SCRC/TEST.EXE and b/16/16/SCRC/TEST.EXE differ
--- a/16/16/SCRC/fade.c
+++ b/16/16/SCRC/fade.c
@@ -13,20 +13,12 @@ void main() {
1313 palSave(palette);
1414
1515 /* fade to black and back */
16- while (1)
16+ while (!kbhit())
1717 {
1818 fadeOff(1, palette);
1919 palBlack();
2020 fadeOn(1, palette);
2121 palUpdate(palette);
22-
23- if (kbhit)
24- {
25- // Terminates the loop
26- // when escape is pressed
27- if (getch() == 27)
28- break;
29- }
3022 }
3123
3224 free(palette);
Binary files a/16/16/SCRC/fade.exe and b/16/16/SCRC/fade.exe differ
--- /dev/null
+++ b/16/16/SCRC/fade2.c
@@ -0,0 +1,26 @@
1+#include <stdio.h>
2+#include <conio.h>
3+#include <string.h>
4+#include <stdlib.h>
5+#include "palette.h"
6+
7+void main() {
8+ byte *palette;
9+ int i;
10+
11+ /* get our starting point */
12+ palette = newPal();
13+ palSave(palette);
14+
15+ /* fade to black and back */
16+ while (!kbhit())
17+ {
18+ fadeOffHalf(1, palette);
19+ //palBlack();
20+ fadeOn(1, palette);
21+ palUpdate(palette);
22+ }
23+
24+ free(palette);
25+ return;
26+}
--- a/16/16/SCRC/palette.c
+++ b/16/16/SCRC/palette.c
@@ -24,6 +24,12 @@ fadeOff(word fade, byte *palette) {
2424
2525
2626 void
27+fadeOffHalf(word fade, byte *palette) {
28+ fadePaletteHalf(fade, 0, 64/fade+1, palette);
29+}
30+
31+
32+void
2733 flashOn(word fade, byte *palette) {
2834 fadePalette(fade, -64, 64/fade+1, palette);
2935 }
@@ -61,6 +67,31 @@ fadePalette(byte fade, byte start, word iter, byte *palette) {
6167 }
6268 }
6369
70+static void
71+fadePaletteHalf(byte fade, byte start, word iter, byte *palette) {
72+ word i;
73+ byte dim = start;
74+
75+ /* handle the case where we just update */
76+ if(iter == 0) {
77+ palUpdate(palette);
78+ return;
79+ }
80+
81+ while(iter > iter/2) { /* FadeLoop */
82+ for(i=0; i<PAL_SIZE; i++) { /* loadpal_loop */
83+ tmppal[i] = palette[i] - dim;
84+ if(tmppal[i] > 127) {
85+ tmppal[i] = 0;
86+ } else if(tmppal[i] > 63) {
87+ tmppal[i] = 63;
88+ }
89+ }
90+ palUpdate(tmppal);
91+ iter--;
92+ dim += fade;
93+ }
94+}
6495
6596 /* save and load */
6697 void
Binary files a/16/16/SCRC/test.exe and b/16/16/SCRC/test.exe differ
Show on old repository browser