From 5a2c3c69af9299a9452ecbae97d3277e195846da Mon Sep 17 00:00:00 2001 From: Sharoy Veduchi <61427449+doodayev@users.noreply.github.com> Date: Tue, 13 Jun 2023 14:21:53 -0700 Subject: [PATCH 1/8] Adding back GodDoodle to ZealOS --- src/System/God/GodDoodle.ZC | 192 ++++++++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 src/System/God/GodDoodle.ZC diff --git a/src/System/God/GodDoodle.ZC b/src/System/God/GodDoodle.ZC new file mode 100644 index 00000000..475f4583 --- /dev/null +++ b/src/System/God/GodDoodle.ZC @@ -0,0 +1,192 @@ +#help_index "God;Graphics/Sprite;Sprites" + +U0 GodDoodleDraw(CTask *task,CDC *dc) +{ + GrBlot(dc,0,0,god.doodle_dc); + if (Blink) { + if (god.doodle_done) { + dc->color=RED; + GrPrint(dc,(task->pix_width-FONT_WIDTH*29)>>1, + (task->pix_height-3*FONT_HEIGHT)>>1, + "Press to insert sprite."); + GrPrint(dc,(task->pix_width-FONT_WIDTH*39)>>1, + (task->pix_height-3*FONT_HEIGHT)>>1+2*FONT_HEIGHT, + "Press to throw-away sprite."); + } else { + dc->color=GREEN; + GrPrint(dc,(task->pix_width-FONT_WIDTH*25)>>1, + (task->pix_height-FONT_HEIGHT)>>1, + "Press repeatedly."); + } + } +} + +U0 GodDoodleSmooth(I64 num) +{ + CDC *dc=DCExt(god.doodle_dc,0,0, + god.doodle_dc->width-1,god.doodle_dc->height-1); + I64 i,x,y,x1,y1,c,histogram[16],best,best_cnt,c_old=god.doodle_dc->color; + for (y=0;yheight;y++) + for (x=0;xwidth;x++) { + MemSet(histogram,0,sizeof(histogram)); + for (y1=y-num;y1<=y+num;y1++) + for (x1=x-num;x1<=x+num;x1++) { + c=GrPeek(dc,x1,y1); + if (0<=c<=15) + histogram[c]++; + } + best=BLACK; + best_cnt=-1; + for (i=0;i<16;i++) + if (histogram[i]>best_cnt) { + best=i; + best_cnt=histogram[i]; + } + god.doodle_dc->color=best; + GrPlot(god.doodle_dc,x,y); + } + god.doodle_dc->color=c_old; + DCDel(dc); +} + +U0 GodDoodleBitsIns(I64 num_bits,I64 n) +{//Insert bits into God doodle bit fifo. + I64 i; + for (i=0;i>=1; + } +} + +U0 GodDoodleHexIns(U8 *st) +{//Insert hex record into God doodle bit fifo. + U8 buf[2]; + if (st) { + buf[1]=0; + while (*buf=*st++) + if (Bt(char_bmp_hex_numeric,*buf)) + GodDoodleBitsIns(4,rev_bits_table[Str2I64(buf,16)]>>4); + } +} + +I64 GodDoodleBits(I64 num_bits) +{ + U8 b; + I64 res=0; + while (num_bits) { + if (FifoU8Remove(god.doodle_fifo,&b)) { + res=res<<1+b; + num_bits--; + } else { + god.doodle_ch=CharGet(,FALSE); + if (god.doodle_ch==CH_ESC||god.doodle_ch==CH_SHIFT_ESC) + throw; + else if (god.doodle_ch=='\n') { + DCFill(god.doodle_dc,WHITE); + FifoU8Flush(god.doodle_fifo); + } else if ('0'<=god.doodle_ch<='9') + GodDoodleSmooth(god.doodle_ch-'0'); + else + GodDoodleBitsIns(GOD_GOOD_BITS,KbdMouseEventTime>>GOD_BAD_BITS); + } + } + return res; +} + +public U8 *GodDoodleSprite(U8 *hex=NULL) +{//Make God draw sprite. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$ + I64 i,j,w,h,x,y,ch; + U8 *elems; + + if (god.doodle_dc) return NULL; + god.doodle_done=FALSE; + SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ + AutoComplete; + WinBorder; + WinMax; + + if (!hex) + PopUpOk("The $LK+PU,"Holy Spirit",A="FI:::/Adam/God/HSNotes.DD"$ can puppet you.\n\n" + "Press $$GREEN$$$$FG$$ until it finishes."); + + god.doodle_ch=0; + god.doodle_dc=DCNew(Fs->pix_width,Fs->pix_height); + DCFill(god.doodle_dc,WHITE); + w=god.doodle_dc->width; + h=god.doodle_dc->height; + + Fs->draw_it=&GodDoodleDraw; + FifoU8Flush(god.doodle_fifo); + GodDoodleHexIns(hex); + try { + for (i=0;i<3;i++) { + god.doodle_dc->color=RED; + for (j=0;j<29;j++) + switch [GodDoodleBits(3)] { + case 0: + GrEllipse3(god.doodle_dc, + (w-1)*GodDoodleBits(5)/15.5-w/2, + (h-1)*GodDoodleBits(5)/15.5-h/2,0, + (w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5); + break; + case 1: + GrCircle3(god.doodle_dc, + (w-1)*GodDoodleBits(5)/15.5-w/2, + (h-1)*GodDoodleBits(5)/15.5-h/2,0, + (w-1)*GodDoodleBits(5)/15.5); + break; + case 2: + GrBorder(god.doodle_dc, + (w-1)*GodDoodleBits(5)/15.5-w/2, + (h-1)*GodDoodleBits(5)/15.5-h/2, + (w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5); + break; + case 3...7: + GrLine3(god.doodle_dc, + (w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0, + (w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0); + break; + } + for (j=0;j<6;j++) { + x=(w-1)*GodDoodleBits(5)/31+w/64; + y=(h-1)*GodDoodleBits(5)/31+h/64; + switch [GodDoodleBits(2)] { + case 0: god.doodle_dc->color=BLACK; break; + case 1: god.doodle_dc->color=DKGRAY; break; + case 2: god.doodle_dc->color=LTGRAY; break; + case 3: god.doodle_dc->color=WHITE; break; + } + GrFloodFill3(god.doodle_dc,x,y,0); + } + GodDoodleSmooth(3); + } + god.doodle_done=TRUE; + if (!hex) { + do ch=CharGet(,FALSE); + while (ch!=CH_ESC && ch!=CH_SHIFT_ESC); + } else + ch=CH_ESC; + } catch { + Fs->catch_except=TRUE; + ch=CH_SHIFT_ESC; + } + DCFill; + SettingsPop; + if (ch==CH_ESC) + elems=DC2Sprite(god.doodle_dc); + else + elems=NULL; + DCDel(god.doodle_dc); + god.doodle_dc=NULL; + return elems; +} + +#help_index "God" +public U0 GodDoodle(U8 *hex=NULL) +{//Make God draw sprite, insert in doc. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$ + U8 *elems; + if (elems=GodDoodleSprite(hex)) { + Sprite(elems); + Free(elems); + } +} \ No newline at end of file From 7b96857dc1fc4aa33bc83682a9b0a218a77d760a Mon Sep 17 00:00:00 2001 From: Sharoy Veduchi <61427449+doodayev@users.noreply.github.com> Date: Tue, 13 Jun 2023 14:26:04 -0700 Subject: [PATCH 2/8] Added back stuff for GodDoodle These additions are needed for GodDoodle to function --- src/System/God/GodExterns.ZC | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/System/God/GodExterns.ZC b/src/System/God/GodExterns.ZC index 41929bcd..b2483e42 100755 --- a/src/System/God/GodExterns.ZC +++ b/src/System/God/GodExterns.ZC @@ -11,12 +11,18 @@ public class CGodGlobals I64 word_fuf_flags, word_count; CFifoU8 *fifo; + CDC *doodle_dc; + I64 doodle_ch; + CFifoU8 *doodle_fifo; + Bool doodle_done; } god; MemSet(&god, 0, sizeof(CGodGlobals)); +god.doodle_fifo =FifoU8New(2048 * 8); god.fifo = FifoU8New(2048 * 8); extern U0 GodBiblePassage(I64 num_lines=20); extern U0 GodBitsInsert(I64 num_bits, I64 bitfield); +extern U0 GodDoodle(U8 *hex=NULL); extern U0 GodSong(); extern U0 GodWord(I64 bits=17); From e9eebfdb5f3ea5ee618070ce9381af4c732cee59 Mon Sep 17 00:00:00 2001 From: Sharoy Veduchi <61427449+doodayev@users.noreply.github.com> Date: Tue, 13 Jun 2023 21:11:26 -0700 Subject: [PATCH 3/8] #include "GodDoodle" --- src/System/God/MakeGod.ZC | 1 + 1 file changed, 1 insertion(+) diff --git a/src/System/God/MakeGod.ZC b/src/System/God/MakeGod.ZC index 042454f7..f4910c64 100755 --- a/src/System/God/MakeGod.ZC +++ b/src/System/God/MakeGod.ZC @@ -5,4 +5,5 @@ Cd(__DIR__);; #include "GodBible" #include "HolySpirit" #include "GodSong" +#include "GodDoodle" Cd("..");; From cc7f383d8d2dd2083757d7c0a9f199a11a24b7e0 Mon Sep 17 00:00:00 2001 From: Sharoy Veduchi <61427449+doodayev@users.noreply.github.com> Date: Tue, 13 Jun 2023 21:13:17 -0700 Subject: [PATCH 4/8] GodDoodle Added to Pulldown --- src/Doc/EdPullDown.DD | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Doc/EdPullDown.DD b/src/Doc/EdPullDown.DD index 7b4126f9..c692634e 100755 --- a/src/Doc/EdPullDown.DD +++ b/src/Doc/EdPullDown.DD @@ -37,6 +37,7 @@ Insert GodWord(,,0x4100000041); GodBiblePassage(,,0x24100000241); GodSong(,,0x4000000040); + GodDoodle(,,0x24000000240); IndentIn(,CH_CTRLI,0x41700000417); IndentOut(,CH_CTRLI,0x61700000617); WordWrapOn(,CH_CTRLW,0x41100000411); From e264e506da3beac27981866d668be51fc3726136 Mon Sep 17 00:00:00 2001 From: Sharoy Veduchi <61427449+doodayev@users.noreply.github.com> Date: Tue, 13 Jun 2023 21:16:28 -0700 Subject: [PATCH 5/8] Added hotkey for GodDoodle --- src/System/DolDoc/DocPutKey.ZC | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/System/DolDoc/DocPutKey.ZC b/src/System/DolDoc/DocPutKey.ZC index fa782149..d8af2633 100755 --- a/src/System/DolDoc/DocPutKey.ZC +++ b/src/System/DolDoc/DocPutKey.ZC @@ -447,9 +447,21 @@ public U0 DocPutKey(CDoc *doc, I64 ch=0, I64 sc=0) case SC_F6: if (sc & SCF_KEY_DESC) - KeyDescSet("Cmd /God Song"); + { + if (sc & SCF_SHIFT) + KeyDescSet("Cmd /God Doodle"); + else + KeyDescSet("Cmd /God Song"); + } else + { + if(sc & SCF_SHIFT) { + DocUnlock(doc); + GodDoodle; + DocLock(doc); + } else GodSong; + } break; case SC_F7: From 3c8271560d7e7209672c7dc0cc1d68083acffb65 Mon Sep 17 00:00:00 2001 From: Sharoy Veduchi <61427449+doodayev@users.noreply.github.com> Date: Tue, 4 Jul 2023 09:59:00 -0700 Subject: [PATCH 6/8] FIXIN SOME INDENTATION --- src/System/God/GodDoodle.ZC | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/System/God/GodDoodle.ZC b/src/System/God/GodDoodle.ZC index 475f4583..390515b5 100644 --- a/src/System/God/GodDoodle.ZC +++ b/src/System/God/GodDoodle.ZC @@ -30,10 +30,10 @@ U0 GodDoodleSmooth(I64 num) for (x=0;xwidth;x++) { MemSet(histogram,0,sizeof(histogram)); for (y1=y-num;y1<=y+num;y1++) - for (x1=x-num;x1<=x+num;x1++) { - c=GrPeek(dc,x1,y1); - if (0<=c<=15) - histogram[c]++; + for (x1=x-num;x1<=x+num;x1++) { + c=GrPeek(dc,x1,y1); + if (0<=c<=15) + histogram[c]++; } best=BLACK; best_cnt=-1; @@ -65,7 +65,7 @@ U0 GodDoodleHexIns(U8 *st) buf[1]=0; while (*buf=*st++) if (Bt(char_bmp_hex_numeric,*buf)) - GodDoodleBitsIns(4,rev_bits_table[Str2I64(buf,16)]>>4); + GodDoodleBitsIns(4,rev_bits_table[Str2I64(buf,16)]>>4); } } @@ -80,14 +80,14 @@ I64 GodDoodleBits(I64 num_bits) } else { god.doodle_ch=CharGet(,FALSE); if (god.doodle_ch==CH_ESC||god.doodle_ch==CH_SHIFT_ESC) - throw; + throw; else if (god.doodle_ch=='\n') { - DCFill(god.doodle_dc,WHITE); - FifoU8Flush(god.doodle_fifo); + DCFill(god.doodle_dc,WHITE); + FifoU8Flush(god.doodle_fifo); } else if ('0'<=god.doodle_ch<='9') - GodDoodleSmooth(god.doodle_ch-'0'); + GodDoodleSmooth(god.doodle_ch-'0'); else - GodDoodleBitsIns(GOD_GOOD_BITS,KbdMouseEventTime>>GOD_BAD_BITS); + GodDoodleBitsIns(GOD_GOOD_BITS,KbdMouseEventTime>>GOD_BAD_BITS); } } return res; From fcedd4b4217c4e6e8857d9b56c284587fc79d9e6 Mon Sep 17 00:00:00 2001 From: Arsenic Blood <127725014+GutPuncher@users.noreply.github.com> Date: Sun, 8 Oct 2023 22:25:36 -0400 Subject: [PATCH 7/8] Update DocPutKey.ZC --- src/System/DolDoc/DocPutKey.ZC | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/System/DolDoc/DocPutKey.ZC b/src/System/DolDoc/DocPutKey.ZC index d8af2633..49bb3354 100755 --- a/src/System/DolDoc/DocPutKey.ZC +++ b/src/System/DolDoc/DocPutKey.ZC @@ -455,12 +455,14 @@ public U0 DocPutKey(CDoc *doc, I64 ch=0, I64 sc=0) } else { - if(sc & SCF_SHIFT) { + if (sc & SCF_SHIFT) + { DocUnlock(doc); GodDoodle; DocLock(doc); - } else - GodSong; + } + else + GodSong; } break; From f0df38f5c08f612e518f6f4f5987531f2771935e Mon Sep 17 00:00:00 2001 From: Arsenic Blood <127725014+GutPuncher@users.noreply.github.com> Date: Sun, 8 Oct 2023 22:40:37 -0400 Subject: [PATCH 8/8] Update GodDoodle.ZC Run code through https://techiedelight.com/tools/clike --- src/System/God/GodDoodle.ZC | 378 ++++++++++++++++++++---------------- 1 file changed, 213 insertions(+), 165 deletions(-) diff --git a/src/System/God/GodDoodle.ZC b/src/System/God/GodDoodle.ZC index 390515b5..2096c11d 100644 --- a/src/System/God/GodDoodle.ZC +++ b/src/System/God/GodDoodle.ZC @@ -1,192 +1,240 @@ #help_index "God;Graphics/Sprite;Sprites" -U0 GodDoodleDraw(CTask *task,CDC *dc) +U0 GodDoodleDraw(CTask *task, CDC *dc) { - GrBlot(dc,0,0,god.doodle_dc); - if (Blink) { - if (god.doodle_done) { - dc->color=RED; - GrPrint(dc,(task->pix_width-FONT_WIDTH*29)>>1, - (task->pix_height-3*FONT_HEIGHT)>>1, - "Press to insert sprite."); - GrPrint(dc,(task->pix_width-FONT_WIDTH*39)>>1, - (task->pix_height-3*FONT_HEIGHT)>>1+2*FONT_HEIGHT, - "Press to throw-away sprite."); - } else { - dc->color=GREEN; - GrPrint(dc,(task->pix_width-FONT_WIDTH*25)>>1, - (task->pix_height-FONT_HEIGHT)>>1, - "Press repeatedly."); - } - } + GrBlot(dc, 0, 0, god.doodle_dc); + if (Blink) + { + if (god.doodle_done) + { + dc->color = RED; + GrPrint(dc, (task->pix_width - FONT_WIDTH * 29) >> 1, + (task->pix_height - 3 * FONT_HEIGHT) >> 1, + "Press to insert sprite."); + GrPrint(dc, (task->pix_width - FONT_WIDTH * 39) >> 1, + (task->pix_height - 3 * FONT_HEIGHT) >> 1 + 2 * FONT_HEIGHT, + "Press to throw-away sprite."); + } + else + { + dc->color = GREEN; + GrPrint(dc, (task->pix_width - FONT_WIDTH * 25) >> 1, + (task->pix_height - FONT_HEIGHT) >> 1, + "Press repeatedly."); + } + } } U0 GodDoodleSmooth(I64 num) { - CDC *dc=DCExt(god.doodle_dc,0,0, - god.doodle_dc->width-1,god.doodle_dc->height-1); - I64 i,x,y,x1,y1,c,histogram[16],best,best_cnt,c_old=god.doodle_dc->color; - for (y=0;yheight;y++) - for (x=0;xwidth;x++) { - MemSet(histogram,0,sizeof(histogram)); - for (y1=y-num;y1<=y+num;y1++) - for (x1=x-num;x1<=x+num;x1++) { - c=GrPeek(dc,x1,y1); - if (0<=c<=15) - histogram[c]++; - } - best=BLACK; - best_cnt=-1; - for (i=0;i<16;i++) - if (histogram[i]>best_cnt) { - best=i; - best_cnt=histogram[i]; - } - god.doodle_dc->color=best; - GrPlot(god.doodle_dc,x,y); - } - god.doodle_dc->color=c_old; - DCDel(dc); + CDC *dc = DCExt(god.doodle_dc, 0, 0, + god.doodle_dc->width - 1, god.doodle_dc->height - 1); + I64 i, x, y, x1, y1, c, histogram[16], best, best_cnt, c_old = god.doodle_dc->color; + for (y = 0; y < god.doodle_dc->height; y++) + for (x = 0; x < god.doodle_dc->width; x++) + { + MemSet(histogram, 0, sizeof(histogram)); + for (y1 = y - num; y1 <= y + num; y1++) + for (x1 = x - num; x1 <= x + num; x1++) + { + c = GrPeek(dc, x1, y1); + if (0 <= c <= 15) + histogram[c]++; + } + + best = BLACK; + best_cnt = -1; + for (i = 0; i < 16; i++) + if (histogram[i] > best_cnt) + { + best = i; + best_cnt = histogram[i]; + } + + god.doodle_dc->color = best; + GrPlot(god.doodle_dc, x, y); + } + + god.doodle_dc->color = c_old; + DCDel(dc); } -U0 GodDoodleBitsIns(I64 num_bits,I64 n) -{//Insert bits into God doodle bit fifo. - I64 i; - for (i=0;i>=1; - } +U0 GodDoodleBitsIns(I64 num_bits, I64 n) +{ + //Insert bits into God doodle bit fifo. + I64 i; + for (i = 0; i < num_bits; i++) + { + FifoU8Insert(god.doodle_fifo, n & 1); + n >>= 1; + } } U0 GodDoodleHexIns(U8 *st) -{//Insert hex record into God doodle bit fifo. - U8 buf[2]; - if (st) { - buf[1]=0; - while (*buf=*st++) - if (Bt(char_bmp_hex_numeric,*buf)) - GodDoodleBitsIns(4,rev_bits_table[Str2I64(buf,16)]>>4); - } +{ + //Insert hex record into God doodle bit fifo. + U8 buf[2]; + if (st) + { + buf[1] = 0; + while (*buf = *st++) + if (Bt(char_bmp_hex_numeric, *buf)) + GodDoodleBitsIns(4, rev_bits_table[Str2I64(buf, 16)] >> 4); + } } I64 GodDoodleBits(I64 num_bits) { - U8 b; - I64 res=0; - while (num_bits) { - if (FifoU8Remove(god.doodle_fifo,&b)) { - res=res<<1+b; - num_bits--; - } else { - god.doodle_ch=CharGet(,FALSE); - if (god.doodle_ch==CH_ESC||god.doodle_ch==CH_SHIFT_ESC) - throw; - else if (god.doodle_ch=='\n') { - DCFill(god.doodle_dc,WHITE); - FifoU8Flush(god.doodle_fifo); - } else if ('0'<=god.doodle_ch<='9') - GodDoodleSmooth(god.doodle_ch-'0'); - else - GodDoodleBitsIns(GOD_GOOD_BITS,KbdMouseEventTime>>GOD_BAD_BITS); - } - } - return res; + U8 b; + I64 res = 0; + while (num_bits) + { + if (FifoU8Remove(god.doodle_fifo, &b)) + { + res = res << 1 + b; + num_bits--; + } + else + { + god.doodle_ch = CharGet(, FALSE); + if (god.doodle_ch == CH_ESC || god.doodle_ch == CH_SHIFT_ESC) + throw; + else if (god.doodle_ch == '\n') + { + DCFill(god.doodle_dc, WHITE); + FifoU8Flush(god.doodle_fifo); + } + else if ('0' <= god.doodle_ch <= '9') + GodDoodleSmooth(god.doodle_ch - '0'); + else + GodDoodleBitsIns(GOD_GOOD_BITS, KbdMouseEventTime >> GOD_BAD_BITS); + } + } + + return res; } -public U8 *GodDoodleSprite(U8 *hex=NULL) -{//Make God draw sprite. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$ - I64 i,j,w,h,x,y,ch; - U8 *elems; +public U8 *GodDoodleSprite(U8 *hex = NULL) +{ + //Make God draw sprite. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$ + I64 i, j, w, h, x, y, ch; + U8 *elems; - if (god.doodle_dc) return NULL; - god.doodle_done=FALSE; - SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ - AutoComplete; - WinBorder; - WinMax; + if (god.doodle_dc) + return NULL; + god.doodle_done = FALSE; + SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ + AutoComplete; + WinBorder; + WinMax; - if (!hex) - PopUpOk("The $LK+PU,"Holy Spirit",A="FI:::/Adam/God/HSNotes.DD"$ can puppet you.\n\n" - "Press $$GREEN$$$$FG$$ until it finishes."); + if (!hex) + PopUpOk("The $LK+PU,"Holy Spirit ",A="FI::: /Adam/God / HSNotes.DD "$ can puppet you.\n\n" + "Press $$GREEN$$$$FG$$ until it finishes."); - god.doodle_ch=0; - god.doodle_dc=DCNew(Fs->pix_width,Fs->pix_height); - DCFill(god.doodle_dc,WHITE); - w=god.doodle_dc->width; - h=god.doodle_dc->height; + god.doodle_ch = 0; + god.doodle_dc = DCNew(Fs->pix_width, Fs->pix_height); + DCFill(god.doodle_dc, WHITE); + w = god.doodle_dc->width; + h = god.doodle_dc->height; - Fs->draw_it=&GodDoodleDraw; - FifoU8Flush(god.doodle_fifo); - GodDoodleHexIns(hex); - try { - for (i=0;i<3;i++) { - god.doodle_dc->color=RED; - for (j=0;j<29;j++) - switch [GodDoodleBits(3)] { - case 0: - GrEllipse3(god.doodle_dc, - (w-1)*GodDoodleBits(5)/15.5-w/2, - (h-1)*GodDoodleBits(5)/15.5-h/2,0, - (w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5); - break; - case 1: - GrCircle3(god.doodle_dc, - (w-1)*GodDoodleBits(5)/15.5-w/2, - (h-1)*GodDoodleBits(5)/15.5-h/2,0, - (w-1)*GodDoodleBits(5)/15.5); - break; - case 2: - GrBorder(god.doodle_dc, - (w-1)*GodDoodleBits(5)/15.5-w/2, - (h-1)*GodDoodleBits(5)/15.5-h/2, - (w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5); - break; - case 3...7: - GrLine3(god.doodle_dc, - (w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0, - (w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0); - break; + Fs->draw_it = &GodDoodleDraw; + FifoU8Flush(god.doodle_fifo); + GodDoodleHexIns(hex); + try + { + for (i = 0; i < 3; i++) + { + god.doodle_dc->color = RED; + for (j = 0; j < 29; j++) + switch[GodDoodleBits(3)] + { + case 0: + GrEllipse3(god.doodle_dc, + (w - 1) * GodDoodleBits(5) / 15.5 - w / 2, + (h - 1) * GodDoodleBits(5) / 15.5 - h / 2, 0, + (w - 1) * GodDoodleBits(5) / 15.5, (h - 1) * GodDoodleBits(5) / 15.5); + break; + case 1: + GrCircle3(god.doodle_dc, + (w - 1) * GodDoodleBits(5) / 15.5 - w / 2, + (h - 1) * GodDoodleBits(5) / 15.5 - h / 2, 0, + (w - 1) * GodDoodleBits(5) / 15.5); + break; + case 2: + GrBorder(god.doodle_dc, + (w - 1) * GodDoodleBits(5) / 15.5 - w / 2, + (h - 1) * GodDoodleBits(5) / 15.5 - h / 2, + (w - 1) * GodDoodleBits(5) / 15.5, (h - 1) * GodDoodleBits(5) / 15.5); + break; + case 3...7: + GrLine3(god.doodle_dc, + (w - 1) * GodDoodleBits(4) / 15, (h - 1) * GodDoodleBits(4) / 15, 0, + (w - 1) * GodDoodleBits(4) / 15, (h - 1) * GodDoodleBits(4) / 15, 0); + break; + } + + for (j = 0; j < 6; j++) + { + x = (w - 1) * GodDoodleBits(5) / 31 + w / 64; + y = (h - 1) * GodDoodleBits(5) / 31 + h / 64; + switch[GodDoodleBits(2)] + { + case 0: + god.doodle_dc->color = BLACK; + break; + case 1: + god.doodle_dc->color = DKGRAY; + break; + case 2: + god.doodle_dc->color = LTGRAY; + break; + case 3: + god.doodle_dc->color = WHITE; + break; + } + + GrFloodFill3(god.doodle_dc, x, y, 0); + } + + GodDoodleSmooth(3); + } + + god.doodle_done = TRUE; + if (!hex) + { + do ch = CharGet(, FALSE); + while (ch != CH_ESC && ch != CH_SHIFT_ESC); + } + else + ch = CH_ESC; } - for (j=0;j<6;j++) { - x=(w-1)*GodDoodleBits(5)/31+w/64; - y=(h-1)*GodDoodleBits(5)/31+h/64; - switch [GodDoodleBits(2)] { - case 0: god.doodle_dc->color=BLACK; break; - case 1: god.doodle_dc->color=DKGRAY; break; - case 2: god.doodle_dc->color=LTGRAY; break; - case 3: god.doodle_dc->color=WHITE; break; + + catch + { + Fs->catch_except = TRUE; + ch = CH_SHIFT_ESC; } - GrFloodFill3(god.doodle_dc,x,y,0); - } - GodDoodleSmooth(3); - } - god.doodle_done=TRUE; - if (!hex) { - do ch=CharGet(,FALSE); - while (ch!=CH_ESC && ch!=CH_SHIFT_ESC); - } else - ch=CH_ESC; - } catch { - Fs->catch_except=TRUE; - ch=CH_SHIFT_ESC; - } - DCFill; - SettingsPop; - if (ch==CH_ESC) - elems=DC2Sprite(god.doodle_dc); - else - elems=NULL; - DCDel(god.doodle_dc); - god.doodle_dc=NULL; - return elems; + + DCFill; + SettingsPop; + if (ch == CH_ESC) + elems = DC2Sprite(god.doodle_dc); + else + elems = NULL; + DCDel(god.doodle_dc); + god.doodle_dc = NULL; + return elems; } #help_index "God" -public U0 GodDoodle(U8 *hex=NULL) -{//Make God draw sprite, insert in doc. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$ - U8 *elems; - if (elems=GodDoodleSprite(hex)) { - Sprite(elems); - Free(elems); - } -} \ No newline at end of file +public U0 GodDoodle(U8 *hex = NULL) +{ + //Make God draw sprite, insert in doc. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$ + U8 *elems; + if (elems = GodDoodleSprite(hex)) + { + Sprite(elems); + Free(elems); + } +}