return retstr;\r
}\r
\r
+//from http://quiz.geeksforgeeks.org/c-program-cyclically-rotate-array-one/\r
+void rotateR(byte arr[], byte n)\r
+{\r
+ byte x = arr[n-1], i;\r
+ for (i = n-1; i > 0; i--)\r
+ arr[i] = arr[i-1];\r
+ arr[0] = x;\r
+}\r
+\r
+void rotateL(byte arr[], byte n)\r
+{\r
+ byte x = arr[n+1], i;\r
+ for (i = n+1; i > 0; i++)\r
+ arr[i] = arr[i+1];\r
+ arr[0] = x;\r
+}\r
+\r
#ifndef __WATCOMC__\r
char global_temp_status_text[512];\r
char global_temp_status_text2[512];\r
if(IN_KeyDown(sc_Z)){ DRAWCORNERBOXES } \\r
if(IN_KeyDown(sc_X)){ TESTBG12 } \\r
if(IN_KeyDown(sc_C)){ TESTBG34 } \\r
- if(IN_KeyDown(sc_V)) VL_PatternDraw(&gvar.video, 0, 1, 1);\r
+ if(IN_KeyDown(sc_V)) VL_PatternDraw(&gvar.video, 0, 1, 1); \\r
+ if(IN_KeyDown(sc_PgUp)){ \\r
+ rotateR(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \\r
+ VL_UpdatePaletteWrite(&gvar.video.palette, 0); } \\r
+ if(IN_KeyDown(sc_PgDn)){ \\r
+ rotateL(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \\r
+ VL_UpdatePaletteWrite(&gvar.video.palette, 0); }\r
\r
void DebugMemory_(global_game_variables_t *gvar, boolean q);\r
void Shutdown16(global_game_variables_t *gvar);\r
void ClearMemory (global_game_variables_t *gvar);\r
void Quit (global_game_variables_t *gvar, char *error);\r
char *remove_ext(char* mystr, char dot, char sep);\r
+void rotateR(byte arr[], byte n);\r
+void rotateL(byte arr[], byte n);\r
void turboXT(byte bakapee);\r
void nibbletest();\r
void booleantest();\r
\r
fd = open(filename,O_RDONLY|O_BINARY);\r
if (fd >= 0) {\r
- word i;\r
-\r
read(fd,palette, PAL_SIZE);\r
close(fd);\r
\r
- vga_palette_lseek(1+o);\r
- 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);\r
+ VL_UpdatePaletteWrite(palette, o);\r
}\r
}\r
\r
+void VL_UpdatePaletteWrite(byte *palette, word o)\r
+{\r
+ word i;\r
+ vga_palette_lseek(/*1+*/o);\r
+ 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);\r
+}\r
\r
void\r
modexSavePalFile(char *filename, byte *pal) {\r
int palcol=0;\r
int palx, paly;\r
for(paly=0; paly<palq; paly+=mult){\r
- for(palx=0; palx<palq; palx+=mult){\r
+ for(palx=TILEWH*12; palx<palq+TILEWH*12; palx+=mult){\r
modexClearRegion(pee, palx+TILEWH, paly+TILEWH, mult, mult, palcol);\r
palcol++;\r
}\r
void modexLoadPalFile(char *filename, byte **palette);\r
void VL_LoadPalFile(const char *filename, byte *palette);\r
void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o);\r
+void VL_UpdatePaletteWrite(byte *palette, word o);\r
void modexSavePalFile(char *filename, byte *palette);\r
\r
/* fixed palette functions */\r
modexPalSave(pal);\r
CHKCOLDBGOUT1\r
//check palette for dups\r
- for(; (*z)<PAL_SIZE-3; (*z)+=3)\r
+ for(; (*z)<PAL_SIZE; (*z)+=3)\r
{\r
CHKCOLDBGOUT2\r
//if((*z)%3==0)\r
word w=0;\r
word q=0;\r
word qq=0;\r
- static word a[PAL_SIZE-3]; //palette array of change values!\r
+ static word a[PAL_SIZE]; //palette array of change values!\r
word z=0, aq=0, aa=0, pp=0;\r
\r
//modexWaitBorder();\r
if((*i)==0)\r
{\r
memset(a, -1, sizeof(a));\r
- outp(PAL_WRITE_REG, 1); /* start at the beginning of palette */\r
+ outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */\r
}\r
else if(qp==0)\r
{\r
printf("qq: %02d\n", (qq));//\r
printf(" (*i)-q=%02d\n", (*i)-q);//\r
#endif\r
- outp(PAL_WRITE_REG, qq);\r
+ outp(PAL_WRITE_REG, qq); /* start at the beginning of palette */\r
}\r
- if((*i)<PAL_SIZE-3 && w==0)\r
+ if((*i)<PAL_SIZE && w==0)\r
{\r
- for(; (*i)<PAL_SIZE-3; (*i)++)\r
+ for(; (*i)<PAL_SIZE; (*i)++)\r
{\r
//if(i%3==0 && (p[i+5]==p[i+4] && p[i+4]==p[i+3] && p[i+3]==p[i+2] && p[i+2]==p[i+1] && p[i+1]==p[i] && p[i+5]==p[i]))\r
//____ if((qp>0)&&((*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\r
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--; }\r
//debugging binds!\r
\r
- if(IN_KeyDown(24)){ modexPalUpdate0(gpal); /*paloffset=0;*/ modexpdump(mv[0].page); IN_UserInput(1,1); } //o\r
- if(IN_KeyDown(22)){ modexPalUpdate0(gpal); } //u\r
+ if(IN_KeyDown(24)){ modexPalUpdate0(&gvar.video.palette); /*paloffset=0;*/ modexpdump(mv[0].page); IN_UserInput(1,1); } //o\r
+ if(IN_KeyDown(22)){ modexPalUpdate0(&gvar.video.palette); } //u\r
\r
FUNCTIONKEYFUNCTIONS\r
FUNCTIONKEYDRAWJUNK\r