From 899c733ec140153f6d005d9997b81ef8109b29e4 Mon Sep 17 00:00:00 2001 From: Sharoy Veduchi <61427449+doodayev@users.noreply.github.com> Date: Mon, 29 May 2023 03:01:03 -0700 Subject: [PATCH 01/17] New version of PaletteGodGenerate (#106) This version makes seeding with GodPick optional and even if you want to seed it will only require one press of "Ok". The rest is taken care of by RandI32. --- src/Home/PaletteEditor/PaletteGod.ZC | 31 +++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 1de348d1..02fe7a8e 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -12,4 +12,33 @@ public U0 PaletteGodGenerate() } } -PaletteGodGenerate; \ No newline at end of file +public U0 PaletteGodGenerate2(Bool NeedForSneed=0) +{ + //This one will involve a lot less tapping + //and be a lot more random + + I64 i; + CBGR24 palette; + I64 SNEED; + I32 FEED; + + if(!NeedForSneed) //By default if no args are passed, it assumes the user + { //doesn't want or care for a seed. + goto Generate; + } + else //If a 1 is passed of course, we seed the RNG + { + + SNEED = GodPick; + Seed(SNEED); + } +Generate: + + for (i=0; i < 16; i++) + { + FEED = RandI32; + palette = FEED & 0xFFFFFF; + gr_palette[i] = palette; + LFBFlush; + } +} From 7da26fdde99d42cf132832b1468b133c06564c4c Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Tue, 30 May 2023 01:10:27 +0900 Subject: [PATCH 02/17] palette generation cleanup --- src/Home/PaletteEditor/PaletteGod.ZC | 47 ++++++++-------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 02fe7a8e..928846f8 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,43 +1,22 @@ - -public U0 PaletteGodGenerate() +public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) { + // Instantly generate a random palette, seed-based or not I64 i; CBGR24 palette; + I32 color; - for (i = 0; i < 16; i++) - { - palette = GodPick & 0xFFFFFF; - gr_palette[i] = palette; - LFBFlush; - } -} - -public U0 PaletteGodGenerate2(Bool NeedForSneed=0) -{ - //This one will involve a lot less tapping - //and be a lot more random - - I64 i; - CBGR24 palette; - I64 SNEED; - I32 FEED; - - if(!NeedForSneed) //By default if no args are passed, it assumes the user - { //doesn't want or care for a seed. - goto Generate; - } - else //If a 1 is passed of course, we seed the RNG - { - - SNEED = GodPick; - Seed(SNEED); - } -Generate: - + if (seedUse) + Seed(GodPick); for (i=0; i < 16; i++) { - FEED = RandI32; - palette = FEED & 0xFFFFFF; + if (instant || seedUse) + { + color = RandI32; + palette = color & 0xFFFFFF; + } + else { + palette = GodPick & 0xFFFFFF; + } gr_palette[i] = palette; LFBFlush; } From 17578a1f78053e3eb581491eeacd4274eeda9eab Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Tue, 30 May 2023 01:11:28 +0900 Subject: [PATCH 03/17] Run PaletteGod on include --- src/Home/PaletteEditor/PaletteGod.ZC | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 928846f8..be6c49c7 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -21,3 +21,5 @@ public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) LFBFlush; } } + +PaletteGod; \ No newline at end of file From 782bba268c23accc4e3245488c7c16378ea20a85 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Tue, 30 May 2023 01:30:41 +0900 Subject: [PATCH 04/17] 16colors PaletteEdit --- src/Home/PaletteEditor/PaletteEdit.ZC | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 30e2e785..48e084e0 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -61,9 +61,12 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) tempColor = gr_palette[selected_color]; if (i < border || i > 12 - border || j < border || j > 12 - border) tempColor = 0x000000; - DrawPixel(c->win_task->pix_left + 78 + i, t + 7 + j, tempColor); + // draw color preview + dc->color = tempColor; + GrPlot(dc, c->win_task->pix_left + 78 + i, t + 7 + j); + // DrawPixel(c->win_task->pix_left + 78 + i, t + 7 + j, tempColor); } - GrPrint(dc, 10, 26, "Current Color: #%d", selected_color + 1); + GrPrint(dc, 10, 26, "Current Color: #%d", selected_color); if (selected_color == 15) dc->color = LTGRAY; else if (gr_palette[selected_color] > 0xCCCCCC) @@ -165,8 +168,10 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) else tempColor = 0x000000; } - // color preview - DrawPixel(c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k, tempColor); + // draw color preview + dc->color = tempColor; + GrPlot(dc, c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k); + // DrawPixel(c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k, tempColor); } } // color label and text preview @@ -198,8 +203,8 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) bias = (size / 2) - 4; if (i >= 9) bias = (size / 2) - 8; - GrPrint(dc, bias + (i * size), c->win_task->pix_height - (size * .6) + (size / 4), "%d", i + 1); - GrPrint(dc, 10, (size2 * 2) + 70 + 16 * i, "#%d: Test", i + 1); + GrPrint(dc, bias + (i * size), c->win_task->pix_height - (size * .6) + (size / 4), "%d", i); + GrPrint(dc, 10, (size2 * 2) + 70 + 16 * i, "#%d: Test", i); } From 9cf9e07805ef92cccaf150056aa9d9a9760e5e81 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 01:14:03 +0900 Subject: [PATCH 05/17] 16colors --- src/Home/PaletteEditor/PaletteEdit.ZC | 47 ++++++++------------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 48e084e0..84713f59 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -44,6 +44,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) i, k, j,// l, pos, col, bias; + I64 rectSize = size / 16; // Size of each color rectangle CBGR24 tempColor; /////////////////////// @@ -53,20 +54,8 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) // current color box preview dc->color = BLACK; GrPrint(dc, 10, 10, "Preview:"); + GrPrint(dc, 10, 26, "Current Color: #%d", selected_color); - // pixel loop for current color preview - for (i = 0; i <= 12; i++) - for (j = 0; j <= 12; j++) - { - tempColor = gr_palette[selected_color]; - if (i < border || i > 12 - border || j < border || j > 12 - border) - tempColor = 0x000000; - // draw color preview - dc->color = tempColor; - GrPlot(dc, c->win_task->pix_left + 78 + i, t + 7 + j); - // DrawPixel(c->win_task->pix_left + 78 + i, t + 7 + j, tempColor); - } - GrPrint(dc, 10, 26, "Current Color: #%d", selected_color); if (selected_color == 15) dc->color = LTGRAY; else if (gr_palette[selected_color] > 0xCCCCCC) @@ -76,6 +65,9 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) GrRect(dc, 94, 8, 58, 12); dc->color = selected_color; + // Color preview next to #hex + GrRect(dc, 78, 8, 12, 12); + // #Hex value GrPrint(dc, 95, 10, "#%x%x%x", gr_palette[selected_color].r, gr_palette[selected_color].g, gr_palette[selected_color].b); @@ -155,25 +147,6 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) for (i = 0; i < COLORS_NUM; i++) { - for (j = 0; j <= size; j++) - { - for (k = 0; k <= size; k++) - { - tempColor = gr_palette[i]; - // black borders - if (k < border || k > size - border || j < border || j > size - border - 1) - { - if (selected_color == i) - tempColor = 0xFFFFFF; - else - tempColor = 0x000000; - } - // draw color preview - dc->color = tempColor; - GrPlot(dc, c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k); - // DrawPixel(c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k, tempColor); - } - } // color label and text preview // TODO: THIS LOGIC DOESNT WORK ON LIGHT THEMES // if color too light or too dark add bg @@ -188,6 +161,11 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) dc->color = LTRED;*/ else dc->color = 15; + + // Border for preview box + GrRect(dc, (size * i)-1, c->win_task->pix_height - (size*1.5)-1, size+2, size+2); + + if (i == selected_color) dc->color = 0; GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18); @@ -195,7 +173,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18); - + if (i == selected_color) dc->color = 15; else @@ -205,6 +183,9 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) bias = (size / 2) - 8; GrPrint(dc, bias + (i * size), c->win_task->pix_height - (size * .6) + (size / 4), "%d", i); GrPrint(dc, 10, (size2 * 2) + 70 + 16 * i, "#%d: Test", i); + + // preview box + GrRect(dc, (size * i), c->win_task->pix_height - (size*1.5), size, size); } From 5700e961c8f6261235b4a608b2c86e06f5623f99 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 01:40:05 +0900 Subject: [PATCH 06/17] Random Colors hotkey in palette editor --- src/Home/PaletteEditor/Load.ZC | 1 + src/Home/PaletteEditor/PaletteEdit.ZC | 16 +++++--- src/Home/PaletteEditor/PaletteGod.ZC | 53 +++++++++++++++++---------- 3 files changed, 46 insertions(+), 24 deletions(-) diff --git a/src/Home/PaletteEditor/Load.ZC b/src/Home/PaletteEditor/Load.ZC index 812b6cab..7678cba0 100755 --- a/src/Home/PaletteEditor/Load.ZC +++ b/src/Home/PaletteEditor/Load.ZC @@ -1,4 +1,5 @@ Cd(__DIR__);; #define PALETTES_PATH "~/PaletteEditor/Palettes/" #include "PaletteSelect" +#include "PaletteGod" #include "PaletteEdit" \ No newline at end of file diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 84713f59..5fda5cc7 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -38,14 +38,12 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) CSliderState *s = c->state; I64 size = (c->win_task->pix_width / 16), - border = size / 16, +// border = size / 16, size2 = (c->win_task->pix_height / 32), // slider_amount = 3, - i, k, j,// l, + i, pos, col, bias; - I64 rectSize = size / 16; // Size of each color rectangle - CBGR24 tempColor; /////////////////////// // CURRENT SELECTION // @@ -54,7 +52,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) // current color box preview dc->color = BLACK; GrPrint(dc, 10, 10, "Preview:"); - GrPrint(dc, 10, 26, "Current Color: #%d", selected_color); + GrPrint(dc, 10, 26, "Current Color: #%d", selected_color); if (selected_color == 15) dc->color = LTGRAY; @@ -428,6 +426,14 @@ public U0 PaletteEditor() current_palette = ""; current_palette = PaletteSelect; break; + case 'r': + gr_palette[selected_color] = ColorGod(FALSE, TRUE); + LFBFlush; + break; + case 'R': + gr_palette[selected_color] = PaletteGod(FALSE, TRUE); + LFBFlush; + break; case CH_CTRLI: PopUpOk("\n\n Use the arrows to select color\n\n # to manually input hex value","\n\n\n\t\tMade by y4my4m\n\n"); break; diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index be6c49c7..35cb3091 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,25 +1,40 @@ public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) { - // Instantly generate a random palette, seed-based or not + // Instantly generate a random palette, seed-based or not I64 i; - CBGR24 palette; - I32 color; + CBGR24 color; - if (seedUse) - Seed(GodPick); - for (i=0; i < 16; i++) - { - if (instant || seedUse) - { - color = RandI32; - palette = color & 0xFFFFFF; - } - else { - palette = GodPick & 0xFFFFFF; - } - gr_palette[i] = palette; - LFBFlush; - } + if (seedUse) + Seed(GodPick); + for (i=0; i < 16; i++) + { + if (instant || seedUse) + { + color = RandI32 & 0xFFFFFF; + } + else { + color = GodPick & 0xFFFFFF; + } + gr_palette[i] = color; + LFBFlush; + } } -PaletteGod; \ No newline at end of file +CBGR24 ColorGod(Bool seedUse=TRUE, Bool instant=TRUE) +{ + // Instantly generate a random color, seed-based or not + + if (seedUse) + Seed(GodPick); + if (instant || seedUse) + { + return RandI32 & 0xFFFFFF; + } + else { + return GodPick & 0xFFFFFF; + } + +} + + +// PaletteGod; From b8fb29fa2d2857c8eb6c98af35a4abf0704fdbcb Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 01:52:47 +0900 Subject: [PATCH 07/17] Fix --- src/Home/PaletteEditor/Load.ZC | 2 +- src/Home/PaletteEditor/PaletteEdit.ZC | 4 +++- src/Home/PaletteEditor/Palettes/Tradition.ZC | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 src/Home/PaletteEditor/Palettes/Tradition.ZC diff --git a/src/Home/PaletteEditor/Load.ZC b/src/Home/PaletteEditor/Load.ZC index 7678cba0..ebe27070 100755 --- a/src/Home/PaletteEditor/Load.ZC +++ b/src/Home/PaletteEditor/Load.ZC @@ -1,5 +1,5 @@ Cd(__DIR__);; #define PALETTES_PATH "~/PaletteEditor/Palettes/" #include "PaletteSelect" -#include "PaletteGod" +#include "PaletteGod" #include "PaletteEdit" \ No newline at end of file diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 5fda5cc7..b6b5c21c 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -357,6 +357,8 @@ public U0 PaletteEditor() " PreviousColor(,,SC_CURSOR_UP);" " NextColor(,,SC_CURSOR_RIGHT);" " NextColor(,,SC_CURSOR_DOWN);" + " RandomColor(,,'r');" + " RandomPalette(,,'R');" "}" "About {" " Info(,CH_CTRLI);" @@ -431,7 +433,7 @@ public U0 PaletteEditor() LFBFlush; break; case 'R': - gr_palette[selected_color] = PaletteGod(FALSE, TRUE); + gr_palette[selected_color] = PaletteGod(FALSE, TRUE); LFBFlush; break; case CH_CTRLI: diff --git a/src/Home/PaletteEditor/Palettes/Tradition.ZC b/src/Home/PaletteEditor/Palettes/Tradition.ZC new file mode 100755 index 00000000..e0ef467b --- /dev/null +++ b/src/Home/PaletteEditor/Palettes/Tradition.ZC @@ -0,0 +1,10 @@ +public CBGR24 gr_palette_tradition[COLORS_NUM] = { +0xE8E8E9, 0x374B88, 0x4FBC2C, 0x29CACE, 0xDD0000, 0x8C33FF, 0x875721, 0x7F7A7C, 0x15171C, 0x2EA1FF, 0x4FFF00, 0xFFBB, 0x690000, 0x6E3FFC, 0xFFCC00, 0xC0F14 +}; +public U0 PaletteSetTradition(Bool persistent=TRUE) +{ + GrPaletteSet(gr_palette_tradition); + LFBFlush; + if (persistent) + fp_set_std_palette = &PaletteSetTradition; +} \ No newline at end of file From 3f64a301e7e7eadffb6122c6252866b70d05446d Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:02:00 +0900 Subject: [PATCH 08/17] Cleaner --- src/Home/PaletteEditor/PaletteGod.ZC | 35 ++++++++++------------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 35cb3091..fea5f2ec 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,28 +1,6 @@ -public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) -{ - // Instantly generate a random palette, seed-based or not - I64 i; - CBGR24 color; - - if (seedUse) - Seed(GodPick); - for (i=0; i < 16; i++) - { - if (instant || seedUse) - { - color = RandI32 & 0xFFFFFF; - } - else { - color = GodPick & 0xFFFFFF; - } - gr_palette[i] = color; - LFBFlush; - } -} - CBGR24 ColorGod(Bool seedUse=TRUE, Bool instant=TRUE) { - // Instantly generate a random color, seed-based or not + // Generate a random color, seed-based or not if (seedUse) Seed(GodPick); @@ -36,5 +14,16 @@ CBGR24 ColorGod(Bool seedUse=TRUE, Bool instant=TRUE) } +public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) +{ + // Generate a random palette, seed-based or not + I64 i; + + for (i=0; i < 16; i++) + { + gr_palette[i] = ColorGod(seedUse, instant); + LFBFlush; + } +} // PaletteGod; From 18e545dfe88e9639b107e016df706de4eb22e933 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:05:08 +0900 Subject: [PATCH 09/17] Cleanerer --- src/Home/PaletteEditor/PaletteEdit.ZC | 3 +-- src/Home/PaletteEditor/PaletteGod.ZC | 12 ++---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index b6b5c21c..f9045e9c 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -433,8 +433,7 @@ public U0 PaletteEditor() LFBFlush; break; case 'R': - gr_palette[selected_color] = PaletteGod(FALSE, TRUE); - LFBFlush; + PaletteGod(FALSE, TRUE); break; case CH_CTRLI: PopUpOk("\n\n Use the arrows to select color\n\n # to manually input hex value","\n\n\n\t\tMade by y4my4m\n\n"); diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index fea5f2ec..329250f4 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,29 +1,21 @@ CBGR24 ColorGod(Bool seedUse=TRUE, Bool instant=TRUE) { // Generate a random color, seed-based or not - if (seedUse) Seed(GodPick); if (instant || seedUse) - { return RandI32 & 0xFFFFFF; - } - else { + else return GodPick & 0xFFFFFF; - } - } public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) { // Generate a random palette, seed-based or not I64 i; - for (i=0; i < 16; i++) - { gr_palette[i] = ColorGod(seedUse, instant); - LFBFlush; - } + LFBFlush; } // PaletteGod; From 2f7381847a7f956552a42d0b319ff714b98ed269 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:21:09 +0900 Subject: [PATCH 10/17] Fix --- src/Home/PaletteEditor/PaletteEdit.ZC | 5 ++--- src/Home/PaletteEditor/PaletteGod.ZC | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index f9045e9c..2772e7b2 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -171,7 +171,6 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18); - if (i == selected_color) dc->color = 15; else @@ -421,7 +420,7 @@ public U0 PaletteEditor() if (selected_color == 15) selected_color = -1; SelectColor(selected_color + 1, c); - break; + break; } break; case CH_CTRLO: @@ -429,7 +428,7 @@ public U0 PaletteEditor() current_palette = PaletteSelect; break; case 'r': - gr_palette[selected_color] = ColorGod(FALSE, TRUE); + gr_palette[selected_color] = ColorGod(TRUE); LFBFlush; break; case 'R': diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 329250f4..d8ad16d9 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,9 +1,7 @@ -CBGR24 ColorGod(Bool seedUse=TRUE, Bool instant=TRUE) +CBGR24 ColorGod(Bool instant=TRUE) { // Generate a random color, seed-based or not - if (seedUse) - Seed(GodPick); - if (instant || seedUse) + if (instant) return RandI32 & 0xFFFFFF; else return GodPick & 0xFFFFFF; @@ -13,8 +11,10 @@ public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) { // Generate a random palette, seed-based or not I64 i; + if (seedUse) + Seed(GodPick); for (i=0; i < 16; i++) - gr_palette[i] = ColorGod(seedUse, instant); + gr_palette[i] = ColorGod(instant); LFBFlush; } From 3c2ab12e309bc39dc596fb861cd6bcfd44bd99b4 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:23:31 +0900 Subject: [PATCH 11/17] Removed cursor --- src/Home/PaletteEditor/PaletteGod.ZC | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index d8ad16d9..4a2fd688 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -14,7 +14,7 @@ public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) if (seedUse) Seed(GodPick); for (i=0; i < 16; i++) - gr_palette[i] = ColorGod(instant); + gr_palette[i] = ColorGod(instant); LFBFlush; } From 9b75e8dd0f33da6b3969d65912392e7327876106 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:24:43 +0900 Subject: [PATCH 12/17] Hide doc cursor --- src/Home/PaletteEditor/PaletteEdit.ZC | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 2772e7b2..61462e9a 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -364,6 +364,7 @@ public U0 PaletteEditor() "}" ); DocClear; + DocCursor(OFF); WinBorder(ON); CCtrl *c = SliderNew; From c947d9d451fce0e4c374f0e7a892ceb59b2c385c Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:26:02 +0900 Subject: [PATCH 13/17] Menu fix --- src/Home/PaletteEditor/PaletteEdit.ZC | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 61462e9a..11877874 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -356,8 +356,8 @@ public U0 PaletteEditor() " PreviousColor(,,SC_CURSOR_UP);" " NextColor(,,SC_CURSOR_RIGHT);" " NextColor(,,SC_CURSOR_DOWN);" - " RandomColor(,,'r');" - " RandomPalette(,,'R');" + " RandomColor(,'r');" + " RandomPalette(,'R');" "}" "About {" " Info(,CH_CTRLI);" From 2b9a3b0bbb54d87b37ba86eed63129952eac16cc Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:51:04 +0900 Subject: [PATCH 14/17] Fix --- src/Home/PaletteEditor/PaletteEdit.ZC | 20 ++++++++++++-------- src/Home/PaletteEditor/PaletteGod.ZC | 6 ++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 11877874..6465e7c6 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -148,7 +148,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) // color label and text preview // TODO: THIS LOGIC DOESNT WORK ON LIGHT THEMES // if color too light or too dark add bg - + if (i == 15) dc->color = LTGRAY; else if (gr_palette[i] < gr_palette[15]) @@ -159,10 +159,6 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) dc->color = LTRED;*/ else dc->color = 15; - - // Border for preview box - GrRect(dc, (size * i)-1, c->win_task->pix_height - (size*1.5)-1, size+2, size+2); - if (i == selected_color) dc->color = 0; @@ -170,19 +166,27 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) GrRect(dc, (size * i), c->win_task->pix_height - (size - size / 2), size, size * 1.5); GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18); + if (i == selected_color) dc->color = 15; else dc->color = i; + bias = (size / 2) - 4; if (i >= 9) bias = (size / 2) - 8; + GrPrint(dc, bias + (i * size), c->win_task->pix_height - (size * .6) + (size / 4), "%d", i); GrPrint(dc, 10, (size2 * 2) + 70 + 16 * i, "#%d: Test", i); - + // Border for preview box + GrRect(dc, (size * i)-2, c->win_task->pix_height - (size*1.5)-1, size+2, size+1); // preview box + dc->color = i; GrRect(dc, (size * i), c->win_task->pix_height - (size*1.5), size, size); + + + } @@ -429,11 +433,11 @@ public U0 PaletteEditor() current_palette = PaletteSelect; break; case 'r': - gr_palette[selected_color] = ColorGod(TRUE); + gr_palette[selected_color] = ColorGod; LFBFlush; break; case 'R': - PaletteGod(FALSE, TRUE); + PaletteGod; break; case CH_CTRLI: PopUpOk("\n\n Use the arrows to select color\n\n # to manually input hex value","\n\n\n\t\tMade by y4my4m\n\n"); diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 4a2fd688..99e92031 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -7,12 +7,14 @@ CBGR24 ColorGod(Bool instant=TRUE) return GodPick & 0xFFFFFF; } -public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) +public U0 PaletteGod(Bool seedUse=FALSE, Bool instant=TRUE) { // Generate a random palette, seed-based or not I64 i; - if (seedUse) + + if (seedUse) { Seed(GodPick); + } for (i=0; i < 16; i++) gr_palette[i] = ColorGod(instant); LFBFlush; From 0afbbd6ce236e7fb4c230a2f7a138b6f7076e791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=81=E3=83=A3=E3=83=BC=E3=83=AB=E3=82=BA?= <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:59:33 +0900 Subject: [PATCH 15/17] Update PaletteGod.ZC --- src/Home/PaletteEditor/PaletteGod.ZC | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 99e92031..c2e02d2c 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,6 +1,6 @@ CBGR24 ColorGod(Bool instant=TRUE) { - // Generate a random color, seed-based or not + // Generate a random color if (instant) return RandI32 & 0xFFFFFF; else From 8a60eb60a390e6b6bb31fe7b8e7d8403fced8e38 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 7 Jun 2023 14:14:52 +0900 Subject: [PATCH 16/17] update --- src/Home/PaletteEditor/PaletteEdit.ZC | 10 ++-------- src/Home/PaletteEditor/PaletteGod.ZC | 13 ++++--------- src/Home/PaletteEditor/Palettes/Tradition.ZC | 2 +- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 6465e7c6..bf0029d5 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -38,9 +38,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) CSliderState *s = c->state; I64 size = (c->win_task->pix_width / 16), -// border = size / 16, size2 = (c->win_task->pix_height / 32), -// slider_amount = 3, i, pos, col, bias; @@ -62,10 +60,9 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) dc->color = 15; GrRect(dc, 94, 8, 58, 12); - dc->color = selected_color; - // Color preview next to #hex - GrRect(dc, 78, 8, 12, 12); // #Hex value + dc->color = selected_color; + GrRect(dc, 78, 8, 12, 12); GrPrint(dc, 95, 10, "#%x%x%x", gr_palette[selected_color].r, gr_palette[selected_color].g, gr_palette[selected_color].b); @@ -184,9 +181,6 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) // preview box dc->color = i; GrRect(dc, (size * i), c->win_task->pix_height - (size*1.5), size, size); - - - } diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index c2e02d2c..79eb8745 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,6 +1,5 @@ CBGR24 ColorGod(Bool instant=TRUE) -{ - // Generate a random color +{ // Generate a random color, seed-based or not if (instant) return RandI32 & 0xFFFFFF; else @@ -8,16 +7,12 @@ CBGR24 ColorGod(Bool instant=TRUE) } public U0 PaletteGod(Bool seedUse=FALSE, Bool instant=TRUE) -{ - // Generate a random palette, seed-based or not +{ // Generate a random palette, seed-based or not I64 i; - if (seedUse) { - Seed(GodPick); - } + if (seedUse) Seed(GodPick); + for (i=0; i < 16; i++) gr_palette[i] = ColorGod(instant); LFBFlush; } - -// PaletteGod; diff --git a/src/Home/PaletteEditor/Palettes/Tradition.ZC b/src/Home/PaletteEditor/Palettes/Tradition.ZC index e0ef467b..2aa2f68d 100755 --- a/src/Home/PaletteEditor/Palettes/Tradition.ZC +++ b/src/Home/PaletteEditor/Palettes/Tradition.ZC @@ -7,4 +7,4 @@ public U0 PaletteSetTradition(Bool persistent=TRUE) LFBFlush; if (persistent) fp_set_std_palette = &PaletteSetTradition; -} \ No newline at end of file +} \ No newline at end of file From 7a6dda2a1c2ad34835ae1134fb7e962dee7200eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=81=E3=83=A3=E3=83=BC=E3=83=AB=E3=82=BA?= <8145020+y4my4my4m@users.noreply.github.com> Date: Tue, 13 Jun 2023 11:58:38 +0900 Subject: [PATCH 17/17] Update PaletteGod.ZC --- src/Home/PaletteEditor/PaletteGod.ZC | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 79eb8745..383ea315 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,5 +1,5 @@ CBGR24 ColorGod(Bool instant=TRUE) -{ // Generate a random color, seed-based or not +{// Generate a random color, seed-based or not if (instant) return RandI32 & 0xFFFFFF; else @@ -7,7 +7,7 @@ CBGR24 ColorGod(Bool instant=TRUE) } public U0 PaletteGod(Bool seedUse=FALSE, Bool instant=TRUE) -{ // Generate a random palette, seed-based or not +{// Generate a random palette, seed-based or not I64 i; if (seedUse) Seed(GodPick);