From da91d7bf4f1cb7511a382d30023afdb8b8e620ab Mon Sep 17 00:00:00 2001 From: sparky4 Date: Tue, 14 Feb 2017 12:23:27 -0600 Subject: [PATCH] i am way too tired for this --- data/G.PAL | Bin 768 -> 768 bytes src/lib/16_tail.c | 17 +++++++++++++++++ src/lib/16_tail.h | 10 +++++++++- src/lib/16_vl.c | 13 ++++++++----- src/lib/16_vl.h | 1 + src/lib/16_vlpal.c | 12 ++++++------ src/zcroll.c | 4 ++-- 7 files changed, 43 insertions(+), 14 deletions(-) diff --git a/data/G.PAL b/data/G.PAL index 8092380af954e11b165eae773d83f03429619756..0ecbac33f44529d9701eae8c9b262c7da0f50416 100755 GIT binary patch literal 768 QcmZQz7zLvtFmgix00RI30RR91 literal 768 zcmZQz00UMTMh;abZao=UHCcIkH8p*6HCZ5GuP>`_Zf 0; i--) + arr[i] = arr[i-1]; + arr[0] = x; +} + +void rotateL(byte arr[], byte n) +{ + byte x = arr[n+1], i; + for (i = n+1; i > 0; i++) + arr[i] = arr[i+1]; + arr[0] = x; +} + #ifndef __WATCOMC__ char global_temp_status_text[512]; char global_temp_status_text2[512]; diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index e91c7877..fc43be38 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -71,7 +71,13 @@ if(IN_KeyDown(sc_Z)){ DRAWCORNERBOXES } \ if(IN_KeyDown(sc_X)){ TESTBG12 } \ if(IN_KeyDown(sc_C)){ TESTBG34 } \ - if(IN_KeyDown(sc_V)) VL_PatternDraw(&gvar.video, 0, 1, 1); + if(IN_KeyDown(sc_V)) VL_PatternDraw(&gvar.video, 0, 1, 1); \ + if(IN_KeyDown(sc_PgUp)){ \ + rotateR(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \ + VL_UpdatePaletteWrite(&gvar.video.palette, 0); } \ + if(IN_KeyDown(sc_PgDn)){ \ + rotateL(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \ + VL_UpdatePaletteWrite(&gvar.video.palette, 0); } void DebugMemory_(global_game_variables_t *gvar, boolean q); void Shutdown16(global_game_variables_t *gvar); @@ -79,6 +85,8 @@ void Startup16(global_game_variables_t *gvar); void ClearMemory (global_game_variables_t *gvar); void Quit (global_game_variables_t *gvar, char *error); char *remove_ext(char* mystr, char dot, char sep); +void rotateR(byte arr[], byte n); +void rotateL(byte arr[], byte n); void turboXT(byte bakapee); void nibbletest(); void booleantest(); diff --git a/src/lib/16_vl.c b/src/lib/16_vl.c index 71c5667d..9cada151 100755 --- a/src/lib/16_vl.c +++ b/src/lib/16_vl.c @@ -698,16 +698,19 @@ void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o) fd = open(filename,O_RDONLY|O_BINARY); if (fd >= 0) { - word i; - read(fd,palette, PAL_SIZE); close(fd); - vga_palette_lseek(1+o); - for (i=o;i < 255-o;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2); + VL_UpdatePaletteWrite(palette, o); } } +void VL_UpdatePaletteWrite(byte *palette, word o) +{ + word i; + vga_palette_lseek(/*1+*/o); + for (i=o;i < 256-o;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2); +} void modexSavePalFile(char *filename, byte *pal) { @@ -1000,7 +1003,7 @@ void modexpdump(page_t *pee) int palcol=0; int palx, paly; for(paly=0; paly0)&&((*i)-q)%3==0 && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) outp(PAL_DATA_REG, p[(*i)-q]); else diff --git a/src/zcroll.c b/src/zcroll.c index 16213d6b..3187839c 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -182,8 +182,8 @@ void main(int argc, char *argv[]) if(player[0].enti.q == (TILEWH/(player[0].enti.speed))+1 && player[0].info.dir != 2 && (player[0].enti.triggerx == 5 && player[0].enti.triggery == 5)){ player[0].enti.hp--; } //debugging binds! - if(IN_KeyDown(24)){ modexPalUpdate0(gpal); /*paloffset=0;*/ modexpdump(mv[0].page); IN_UserInput(1,1); } //o - if(IN_KeyDown(22)){ modexPalUpdate0(gpal); } //u + if(IN_KeyDown(24)){ modexPalUpdate0(&gvar.video.palette); /*paloffset=0;*/ modexpdump(mv[0].page); IN_UserInput(1,1); } //o + if(IN_KeyDown(22)){ modexPalUpdate0(&gvar.video.palette); } //u FUNCTIONKEYFUNCTIONS FUNCTIONKEYDRAWJUNK -- 2.39.5