--- /dev/null
+01 02 03 04 00 03 03 03 03 03 03 03 03 04 11 11 11 11 11 11 11 \r
+01 02 03 04 00 03 03 03 03 03 03 03 03 04 11 11 11 11 11 11 11 \r
+04 05 06 07 08 00 01 00 01 00 00 11 11 11 11 11 11 11 11 11 11 11 \r
+04 05 06 07 08 00 01 00 01 00 00 11 11 11 11 11 11 11 11 11 11 11 \r
+08 09 10 11 12 04 01 00 01 00 00 11 11 11 11 11 11 11 11 11 11 11 \r
+08 09 10 11 12 04 01 00 01 00 00 11 11 11 11 11 11 11 11 11 11 11 \r
+12 13 14 15 16 00 01 01 01 05 08 11 11 11 11 11 11 11 11 11 11 11 \r
+12 13 14 15 16 00 01 01 01 05 08 11 11 11 11 11 11 11 11 11 11 11 \r
+16 00 00 04 00 00 00 00 00 08 08 11 11 11 03 11 11 11 11 11 11 11 \r
+16 00 00 04 00 00 00 00 00 08 08 11 11 11 03 11 11 11 11 11 11 11 \r
+11 11 11 11 11 00 00 00 00 08 08 11 11 11 11 11 11 11 11 11 11 11 \r
+11 11 11 11 11 00 00 00 00 08 08 11 11 11 11 11 11 11 11 11 11 11 \r
+11 11 11 11 11 00 00 00 00 11 11 11 11 11 11 11 11 11 11 11 11 11 \r
+11 11 11 11 11 00 00 00 00 11 11 11 11 11 11 11 11 11 11 11 11 11 \r
+11 11 11 11 11 00 00 00 00 11 11 11 11 11 11 11 11 03 11 11 11 11 \r
+11 11 11 11 11 00 00 00 00 11 11 11 11 11 11 11 11 03 11 11 11 11 \r
+11 11 11 11 11 11 11 11 11 11 00 11 11 11 11 11 11 03 11 11 11 11 \r
+11 11 11 11 11 11 11 11 11 11 00 11 11 11 11 11 11 03 11 11 11 11 \r
+11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 \r
+11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 \r
+11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 \r
+11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 \r
+11 11 11 11 11 11 11 11 11 11 11 11 11 03 03 03 03 01 02 03 04 03 \r
+11 11 11 11 11 11 11 11 11 11 11 11 11 03 03 03 03 01 02 03 04 03 \r
+11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 05 06 07 08 06 \r
+11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 05 06 07 08 06 \r
+11 11 11 11 11 11 11 11 11 11 03 03 11 11 11 11 11 09 10 11 12 06 \r
+11 11 11 11 11 11 11 11 11 11 03 03 11 11 11 11 11 09 10 11 12 06 \r
+11 11 11 11 11 11 11 11 11 03 11 11 11 11 11 11 11 13 14 15 16 03 \r
+11 11 11 11 11 11 11 11 11 03 11 11 11 11 11 11 11 13 14 15 16 03 \r
+11 11 11 11 11 11 11 11 11 03 11 11 11 11 11 11 11 11 11 11 11 03 \r
+11 11 11 11 11 11 11 11 11 03 11 11 11 11 11 11 11 11 11 11 11 03 \r
+\r
+Project 16 zcroll.exe. This is just a test file!\r
+version Feb 14 2017 16:41:55\r
+page[0]dxy: 16x16\r
+\r
+player vars:\r
+ xy: 160x128 txy: 10x8 triggxy: 10x9 value: 0\r
+ hp: 4 q: 1 info.dir: 2 d: 2 dire: 30 pdir: 0\r
+ delay=0\r
+\r
+VL_PrintmodexmemInfo:\r
+ Virtual Screen: 352x272 Tile: 22x17=((Virtual Screen)/16)\r
+ Screen: 320x240 Tile: 20x15=((Screen)/16)\r
+ Free Video Memory: 767\r
+ page [0]=(a000:0000) size=23936 w=352 h=272 sw=320 sh=240 pi=1408\r
+ [1]=(a000:5d80) size=23936 w=352 h=272 sw=320 sh=240 pi=1408\r
+ [2]=(a000:bb00) size=8448 w=352 h=96 sw=352 sh=96 pi=1408\r
+ [3]=(a000:dc00) size=8448 w=352 h=96 sw=352 sh=96 pi=1408\r
+gvar.video:\r
+ r=0 bgps=1 \r
+\r
+detected CPU type: 80386 or newer\r
+detected FPU type: 80387\r
$(COPYCOMMAND) $(DOSLIB_JOYSTICK:$(to_os_path))$(DIRSEP)$(DOSLIB_MEMMODE)$(DIRSEP)test.exe joytest.exe
16_vl.$(OBJ): $(SRCLIB)/16_vl.c $(SRCLIB)/16_vl.h
-16_vlpal.$(OBJ): $(SRCLIB)/16_vlpal.c $(SRCLIB)/16_vlpal.h
+16_vlpal.$(OBJ): $(SRCLIB)/16_vlpa_.c $(SRCLIB)/16_vlpal.c $(SRCLIB)/16_vlpal.h
bakapee.$(OBJ):$(SRCLIB)/bakapee.c $(SRCLIB)/bakapee.h
16render.$(OBJ):$(SRCLIB)/16render.c $(SRCLIB)/16render.h
16planar.$(OBJ):$(MODEXLIB16)/16planar.c $(MODEXLIB16)/16planar.h
return(size_of_file);\r
}\r
\r
+//from http://stackoverflow.com/questions/2736753/how-to-remove-extension-from-file-name\r
+// remove_ext: removes the "extension" from a file spec.\r
+// mystr is the string to process.\r
+// dot is the extension separator.\r
+// sep is the path separator (0 means to ignore).\r
+// Returns an allocated string identical to the original but\r
+// with the extension removed. It must be freed when you're\r
+// finished with it.\r
+// If you pass in NULL or the new string can't be allocated,\r
+// it returns NULL.\r
+\r
+char *remove_ext (char* mystr, char dot, char sep) {\r
+ char *retstr, *lastdot, *lastsep;\r
+\r
+ // Error checks and allocate string.\r
+\r
+ if (mystr == NULL)\r
+ return NULL;\r
+ if ((retstr = malloc (strlen (mystr) + 1)) == NULL)\r
+ return NULL;\r
+\r
+ // Make a copy and find the relevant characters.\r
+\r
+ strcpy (retstr, mystr);\r
+ lastdot = strrchr (retstr, dot);\r
+ lastsep = (sep == 0) ? NULL : strrchr (retstr, sep);\r
+\r
+ // If it has an extension separator.\r
+\r
+ if (lastdot != NULL) {\r
+ // and it's before the extenstion separator.\r
+\r
+ if (lastsep != NULL) {\r
+ if (lastsep < lastdot) {\r
+ // then remove it.\r
+\r
+ *lastdot = '\0';\r
+ }\r
+ } else {\r
+ // Has extension separator with no path separator.\r
+\r
+ *lastdot = '\0';\r
+ }\r
+ }\r
+\r
+ // Return the modified string.\r
+\r
+ 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
void printmeminfoline(byte *strc, const byte *pee, size_t h_total, size_t h_used, size_t h_free)\r
{\r
byte str[64];\r
\r
/* local function */\r
long int filesize(FILE *fp);\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 printmeminfoline(byte *strc, const byte *pee, size_t h_total, size_t h_used, size_t h_free);\r
int US_CheckParm(char *parm,char **strings);\r
byte dirchar(byte in);\r
return -1;\r
}\r
\r
-//this function is quite messy ^^; sorry! it is a quick and dirty fix~\r
+/*//this function is quite messy ^^; sorry! it is a quick and dirty fix~\r
word dump(const char *js, jsmntok_t *t, size_t count, word indent, char *js_sv, map_t *map, dword q) {\r
dword i;\r
word j;//, k;\r
if (count == 0) {\r
return 0;\r
}\r
- /* We may want to do strtol() here to get numeric value */\r
+ // We may want to do strtol() here to get numeric value\r
//0000fprintf(stderr, "t->type=%d\n", t->type);\r
if (t->type == JSMN_PRIMITIVE) {\r
if(strstr(js_sv, "data"))\r
{\r
- /*\r
- here we should recursivly call dump again here to skip over the array until we get the facking width of the map.\r
- so we can initiate the map which allocates the facking map->tiles->data->data properly and THEN we can return\r
- here to read the data.... That is my design for this... wwww\r
+ //\r
+ // here we should recursivly call dump again here to skip over the array until we get the width of the map.\r
+ // so we can initiate the map which allocates the facking map->tiles ->data->data properly and THEN we can return\r
+ // here to read the data.... That is my design for this... wwww\r
\r
- FUCK well i am stuck.... wwww\r
- */\r
+ // well i am stuck.... wwww\r
+ //\r
map->data[q] = (byte)atoi(js+t->start);\r
#ifdef DEBUG_MAPDATA\r
fprintf(stdout, "%d[%d]", q, map->data[q]);\r
#endif\r
}\r
return 1;\r
- /* We may use strndup() to fetch string value */\r
+ // We may use strndup() to fetch string value\r
} else if (t->type == JSMN_STRING) {\r
if(jsoneq(js, t, "data") == 0)\r
{\r
// bp = bitmapLoadPcx("data/koishi^^.pcx");\r
map->tiles->btdata = &bp;\r
//---- map->tiles->data = planar_buf_from_bitmap(&bp);\r
- //map->tiles->data->data = malloc((16/**2*/)*16);\r
- //map->tiles->data->width = (16/**2*/);\r
+ //map->tiles->data->data = malloc((16)*16);\r
+ //map->tiles->data->width = (16/);\r
//map->tiles->data->height= 16;\r
map->tiles->tileHeight = 16;\r
map->tiles->tileWidth = 16;\r
\r
FILE *fh = fopen(mn, "r");\r
\r
- /* Prepare parser */\r
+ // Prepare parser\r
jsmn_init(&p);\r
\r
- /* Allocate some tokens as a start */\r
+ // Allocate some tokens as a start\r
//0000fprintf(stderr, "tok malloc\n");\r
tok = malloc(sizeof(*tok) * tokcount);\r
if (tok == NULL) {\r
}\r
\r
for (;;) {\r
- /* Read another chunk */\r
+ // Read another chunk\r
//0000fprintf(stderr, "read\n");\r
r = fread(buf, 1, sizeof(buf), fh);\r
if (r < 0) {\r
again:\r
//0000fprintf(stdout, " parse~ tok=%zu jslen=%zu r=%d _memavl()=%u BUFSIZ=%d~\n", tokcount, jslen, r, _memavl(), BUFSIZ);\r
//0000fprintf(stdout, "p=[%u] [%u] [%d]\n", p.pos, p.toknext, p.toksuper);\r
-/*\r
- I think it crashes on the line below when it tries to parse the data of huge maps... wwww this is a jsmn problem wwww\r
-*/\r
+//\r
+// I think it crashes on the line below when it tries to parse the data of huge maps... wwww this is a jsmn problem wwww\r
+//\r
r = jsmn_parse(&p, js, jslen, tok, tokcount);\r
//0000fprintf(stdout, "r= [%d]\n", r);\r
if (r < 0) {\r
//fclose(fh);\r
\r
return 0;\r
-}\r
+}*/\r
\r
void extract_map(const char *js, jsmntok_t *t, size_t count, map_t *map) {\r
int i, j, k, indent=0, inner_end;\r
+ char *s;\r
//bitmap_t bp;\r
\r
i = 0;\r
while(i<count) {\r
if(jsoneq(js, &(t[i]), "layers") == 0) {\r
i++;\r
- map->layerdata = malloc(sizeof(byte*) * t[i].size);\r
+// map->layerdata = malloc(sizeof(byte*) * t[i].size);\r
inner_end = t[i].end;\r
k = 0;\r
while(t[i].start < inner_end) {\r
printf("Layer %d data: [\n", k);\r
#endif\r
map->layerdata[k] = malloc(sizeof(byte) * t[i+1].size);\r
+ //for backwards compatibility for rest of code\r
map->data = map->layerdata[k];\r
for(j = 0; j < t[i+1].size; j++) {\r
map->layerdata[k][j] = (byte)atoi(js + t[i+2+j].start);\r
- //for backwards compatibility for rest of code\r
-// map->data[j] = map->layerdata[k][j];//(byte)atoi(js + t[i+2+j].start);//(byte)atoi(js+t->start);\r
#ifdef DEBUG_MAPDATA\r
- //printf("[%d,%d]%d", k, j, map->layerdata[k][j]);\r
+ //printf("[%d,%d]%d", k, j, map->MAPDATAPTK[j]);\r
fprintf(stdout, "%c", map->data[j]+44);\r
#endif\r
}\r
}\r
if(jsoneq(js, &(t[i]), "tilesets") == 0) {\r
i++;\r
- map->tiles = malloc(sizeof(tiles_t*) * t[i].size);\r
inner_end = t[i].end;\r
k = 0;\r
while(t[i].start < inner_end) {\r
if(jsoneq(js, &(t[i]), "image") == 0) {\r
- map->layertile[k] = malloc(sizeof(tiles_t));\r
- //Fix to load tileset specified.\r
+ map->MAPTILESPTK = malloc(sizeof(tiles_t));\r
+ s = remove_ext((char *)js+t[i+1].start, '.', '/');\r
+ strcpy(map->MAPTILESPTK->imgname, s);\r
//And move to vrs, probably\r
// bp = bitmapLoadPcx("data/ed.pcx");\r
-// map->layertile[k]->btdata = &bp;\r
- map->layertile[k]->btdata = malloc(sizeof(bitmap_t));\r
- map->layertile[k]->tileHeight = 16;\r
- map->layertile[k]->tileWidth = 16;\r
- map->layertile[k]->rows = 1;\r
- map->layertile[k]->cols = 1;\r
+// map->MAPTILESPTK->btdata = &bp;\r
+ //map->MAPTILESPTK->btdata = malloc(sizeof(bitmap_t));\r
+ map->MAPTILESPTK->rows = 1;\r
+ map->MAPTILESPTK->cols = 1;\r
#ifdef __DEBUG_MAP__\r
dbg_maptext=false;\r
#endif\r
- map->tiles->btdata = map->layertile[k]->btdata;\r
- map->tiles->tileHeight = 16;\r
- map->tiles->tileWidth = 16;\r
- map->tiles->rows = 1;\r
- map->tiles->cols = 1;\r
- k++;\r
+ i++;\r
+ }else if(jsoneq(js, &(t[i]), "tileheight") == 0) {\r
+ map->MAPTILESPTK->tileHeight = atoi(js + t[i+1].start);\r
+ i++;\r
+ }else if(jsoneq(js, &(t[i]), "tilewidth") == 0) {\r
+ map->MAPTILESPTK->tileWidth = atoi(js + t[i+1].start);\r
+ i++;\r
}\r
i++;\r
+ k++;\r
}\r
}\r
\r
\r
// DOSLIB: what CPU are we using?\r
// NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.\r
- // So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
- // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
- // the CPU to carry out tasks. --J.C.\r
+ // So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
+ // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
+ // the CPU to carry out tasks. --J.C.\r
cpu_probe();\r
\r
// DOSLIB: check for VGA\r
\r
/*void ReadConfig(void)\r
{\r
- int file;\r
- SDMode sd;\r
- SMMode sm;\r
- SDSMode sds;\r
+ int file;\r
+ SDMode sd;\r
+ SMMode sm;\r
+ SDSMode sds;\r
\r
\r
if ( (file = open(configname,O_BINARY | O_RDONLY)) != -1)\r
\r
/*void WriteConfig(void)\r
{\r
- int file;\r
+ int file;\r
\r
file = open(configname,O_CREAT | O_BINARY | O_WRONLY,\r
S_IREAD | S_IWRITE | S_IFREG);\r
\r
US_CPrint ("Memory Usage");\r
US_CPrint ("------------");\r
- US_Print ("Total :");\r
+ US_Print ("Total :");\r
US_PrintUnsigned (mminfo.mainmem/1024);\r
- US_Print ("k\nFree :");\r
+ US_Print ("k\nFree :");\r
US_PrintUnsigned (MM_UnusedMemory()/1024);\r
US_Print ("k\nWith purge:");\r
US_PrintUnsigned (MM_TotalFree()/1024);\r
\r
void Quit (global_game_variables_t *gvar, char *error)\r
{\r
- //unsigned finscreen;\r
+ //unsigned finscreen;\r
memptr screen=0;\r
\r
ClearMemory (gvar);\r
}\r
\r
//===========================================================================\r
+\r
#ifndef __WATCOMC__\r
char global_temp_status_text[512];\r
char global_temp_status_text2[512];\r
out 61h, al //; Turn speaker on\r
mov cx, 2000h\r
@@delay:\r
- loop @@delay\r
+ loop @@delay\r
pop ax\r
out 61h, al //; Turn speaker off\r
pop cx\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_I)){ dbg_maptext=!dbg_maptext; IN_UserInput(1,1); }\r
+/* if(IN_KeyDown(sc_PgDn)){ \\r
+ rotateR(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \\r
+ VL_UpdatePaletteWrite(&gvar.video.palette, 0); IN_UserInput(1,1); } \\r
+ if(IN_KeyDown(sc_PgUp)){ \\r
+ rotateL(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \\r
+ VL_UpdatePaletteWrite(&gvar.video.palette, 0); IN_UserInput(1,1); }*/\r
\r
void DebugMemory_(global_game_variables_t *gvar, boolean q);\r
void Shutdown16(global_game_variables_t *gvar);\r
\r
typedef struct {\r
byte far **data;\r
- word ntiles; /* the number of tiles */\r
- word twidth; /* width of the tiles */\r
- word theight; /* height of the tiles */\r
- byte *palette; /* palette for the tile set */\r
+ word ntiles; // the number of tiles\r
+ word twidth; // width of the tiles\r
+ word theight; // height of the tiles\r
+ byte *palette; // palette for the tile set\r
} tileset_t;\r
\r
typedef struct {\r
byte *palette;\r
} planar_buf_t;\r
\r
+//===========================================================================//\r
+\r
//TODO: 16_mm and 16_ca must handle this\r
typedef struct {\r
- bitmap_t far *btdata; //old\r
- planar_buf_t far *data; //old\r
- word tileHeight, tileWidth;\r
+ bitmap_t far *pcximg; //I will probibaly use this --sparky4\r
+ //planar_buf_t far *pbdata; //old\r
+ word tileHeight, tileWidth; //defined by mapfile\r
unsigned int rows, cols;\r
-// #ifdef __DEBUG__\r
-// boolean debug_text; //show the value of the tile! wwww\r
-// byte *debug_data;\r
-// #endif\r
-} tiles_t;\r
+ byte imgname[8]; //image file of tileset (set to 8 because DOS ^^;)\r
+} tiles_t; //seems to be the tileset properties\r
\r
//TODO: 16_mm and 16_ca must handle this\r
//TODO: add variables from 16_ca\r
+//#define __NEWMAPTILEDATAVARS__\r
+#define MAPLAYERS 4\r
+#ifdef __NEWMAPTILEDATAVARS__\r
+#define MAPTILESPTR layertile[0]\r
+#define MAPTILESPTK layertile[k]\r
+#define MAPDATAPTR layerdata[0]\r
+#define MAPDATAPTK layerdata[k]\r
+#else\r
+#define MAPTILESPTR tiles//layertile[0]\r
+#define MAPTILESPTK tiles//layertile[k]\r
+#define MAPDATAPTR data//layerdata[0]\r
+#define MAPDATAPTK data//layerdata[k]\r
+#endif\r
typedef struct {\r
//long planestart[3];\r
//unsigned planelength[3];\r
byte *data; //TODO: 16_mm and 16_ca must handle this\r
- byte * far *layerdata; //TODO: 16_mm and 16_ca must handle this\r
+ byte far *layerdata[MAPLAYERS]; // mapdata for multilayer (map index values for rendering which image on the tile)\r
+#ifndef __NEWMAPTILEDATAVARS__\r
tiles_t *tiles; //TODO: 16_mm and 16_ca must handle this\r
- tiles_t * far *layertile; //TODO: 16_mm and 16_ca must handle this\r
+#else\r
+ tiles_t far *layertile[MAPLAYERS]; // tilesets for layers (currently ony 4 can be loaded wwww)\r
+#endif\r
int width, height; //this has to be signed!\r
- char name[16];\r
+ byte name[16];\r
} map_t;\r
\r
+//===================================//\r
+\r
typedef struct{\r
word tw; /* screen width in tiles */\r
word th; /* screen height in tiles */\r
sword tilemidposscreeny; /* middle tile y position */ /* needed for scroll system to work accordingly */\r
sword tileplayerposscreenx; /* player position on screen */ /* needed for scroll and map system to work accordingly */\r
sword tileplayerposscreeny; /* player position on screen */ /* needed for scroll and map system to work accordingly */\r
-} tileinfo_t;\r
+} pagetileinfo_t;\r
\r
typedef struct {\r
nibble/*word*/ id; /* the Identification number of the page~ For layering~ */\r
byte far* data; /* the data for the page */\r
- tileinfo_t ti;\r
+ pagetileinfo_t ti;\r
word dx; /* col we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the left size */\r
word dy; /* row we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the top size */\r
word sw; /* screen width */ /* resolution */\r
\r
void VL_LoadPalFile(const char *filename, byte *palette)\r
{\r
- int fd;\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(0);\r
- for (i=0;i < 256;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2);\r
- }\r
+ VL_LoadPalFilewithoffset(filename, palette, 0);\r
}\r
\r
void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o)\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(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
+ 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
}\r
}\r
\r
-void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)\r
+void modexprint(page_t *page, sword x, sword y, word t, boolean tlsw, word col, word bgcol, const byte *str)\r
{\r
word s, o, w;\r
- word x_draw = x;\r
+ word x_draw;\r
//word addr = (word) romFontsData.l;\r
- word addrq = (page->stridew) * y + (x / 4) + ((word)page->data);\r
- word addrr = addrq;\r
+ word addrq;\r
+ word addrr;\r
byte c;\r
\r
+ if(tlsw){ x-=page->tlx; y-=page->tly; }\r
+ x_draw = x/4;\r
+ addrq = (page->stridew) * y + (word)(x_draw) +\r
+ ((word)page->data);\r
+ addrr = addrq;\r
s=romFonts[t].seg;\r
o=romFonts[t].off;\r
w=romFonts[t].charSize;\r
\r
for(; *str != '\0'; str++)\r
{\r
- c = (*str);\r
- if(c=='\n')\r
- {\r
- x = x_draw;\r
- romFontsData.chw = 0;\r
- addrq += (page->stridew) * 8;\r
- addrr = addrq;\r
- y += 8;\r
- continue;\r
- }\r
+ c = (*str);\r
+ if(c=='\n')\r
+ {\r
+ x = x_draw;\r
+ romFontsData.chw = 0;\r
+ addrq += (page->stridew) * 8;\r
+ addrr = addrq;\r
+ y += 8;\r
+ continue;\r
+ }\r
\r
// load the character into romFontsData.l\r
// no need for inline assembly!\r
x_draw += 8; /* track X for edge of screen */\r
addrr += 2; /* move 8 pixels over (2 x 4 planar pixels per byte) */\r
}\r
+ //printf("print xy:%dx%d tlxy:%dx%d\n", x, y, page->tlx, page->tly);\r
}\r
\r
void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)\r
int palq=(mult)*TILEWH;\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(paly=TILEWH*8; paly<palq+TILEWH*8; paly+=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
#endif\r
\r
void modexDrawChar(page_t *page, int x/*for planar selection only*/, word t, word col, word bgcol, word addr);\r
-void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str);\r
+void modexprint(page_t *page, sword x, sword y, word t, boolean tlsw, word col, word bgcol, const byte *str);\r
void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str);\r
void modexpdump(page_t *pee);\r
void modexcls(page_t *page, byte color, byte *Where);\r
word zz=0;\r
pal = modexNewPal();\r
modexPalSave(pal);\r
-#ifdef BEVERBOSEPALCHECK\r
- printf("q: %02d\n", (*q));//\r
-\r
- printf("chkcolor start~\n");\r
- printf("1 (*z): %d\n", (*z)/3);\r
- printf("1 (*i): %d\n", (*i)/3);\r
- printf("1 offset of color in palette (*q): %d\n", (*q)/3);//\r
- printf("wwwwwwwwwwwwwwww\n");\r
-#endif\r
+ CHKCOLDBGOUT1\r
//check palette for dups\r
- for(; (*z)<PAL_SIZE/24; (*z)+=3)\r
+ for(; (*z)<PAL_SIZE; (*z)+=3)\r
{\r
-#ifdef BEVERBOSEPALCHECK\r
- printf("\n z: %d\n", (*z));//\r
- printf(" q: %d\n", (*q));//\r
- printf(" z+q: %d\n\n", ((*z)+(*q)));//\r
-#endif\r
+ CHKCOLDBGOUT2\r
//if((*z)%3==0)\r
//{\r
//---- if(pal[(*z)]==pal[(*z)+3] && pal[(*z)+1]==pal[(*z)+4] && pal[(*z)+2]==pal[(*z)+5])\r
if((*z)==(*i))\r
{\r
-#ifdef BEVERBOSEPALCHECK\r
- printf("\n%d [%02d][%02d][%02d]\n", (*z), pal[(*z)], pal[(*z)+1], pal[(*z)+2]);//\r
- printf("%d [%02d][%02d][%02d]\n\n", (*z)+3, pal[(*z)+3], pal[(*z)+4], pal[(*z)+5]);//\r
-#endif\r
+ CHKCOLDBGOUT3\r
//0000 (*z)-=3;\r
break;\r
}\r
else for(zz=0; zz<(*q); zz+=3)\r
{\r
-#ifdef BEVERBOSEPALCHECK\r
- printf("zz: %02d\n", zz/3);//\r
-#endif\r
+ CHKCOLDBGOUT4\r
if(zz%3==0)\r
{\r
if(pal[((*z)+(*q))]==pal[((*z)+(*q))+3] && pal[((*z)+(*q))+1]==pal[((*z)+(*q))+4] && pal[((*z)+(*q))+2]==pal[((*z)+(*q))+5]) //break if duplicate colors found in palette because it have reached the end of the current data of the palette\r
{\r
// (*z)-=3;\r
// (*i)-=3;\r
-#ifdef BEVERBOSEPALCHECK\r
- printf("\nzq1:%d[%02d][%02d][%02d]\n", (zz+*q), pal[(zz+*q)], pal[(zz+*q)+1], pal[(zz+*q)+2]);//\r
- printf("zq2:%d[%02d][%02d][%02d]\n\n", (zz+*q)+3, pal[(zz+*q)+3], pal[(zz+*q)+4], pal[(zz+*q)+5]);//\r
-#endif\r
+ CHKCOLDBGOUT5\r
break;\r
}\r
else if(pal[zz]==pal[((*z)+(*q))] && pal[zz+1]==pal[((*z)+(*q))+1] && pal[zz+2]==pal[((*z)+(*q))+2])\r
{\r
-#ifdef BEVERBOSEPALCHECK\r
- printf("\n\nwwwwwwwwwwwwwwww\n");//\r
- printf(" zq: %d [%02d][%02d][%02d] value that is needing to be changed~\n", ((*z)+(*q))/3, pal[((*z)+(*q))], pal[((*z)+(*q))+1], pal[((*z)+(*q))+2]);//\r
- printf(" zz: %d [%02d][%02d][%02d] value that the previous value is going to change to~\n", (zz)/3, pal[zz], pal[zz+1], pal[zz+2]);//\r
- //printf(" zv: %d [%02d][%02d][%02d] wwww\n", (zz-z+q)/3, pal[(zz-z+q)], pal[(zz-z+q)+1], pal[(zz-z+q)+2]);//\r
- printf(" z : %d [%02d][%02d][%02d] offset value~\n", (*z)/3, pal[(*z)], pal[(*z)+1], pal[(*z)+2]);//\r
-#endif\r
+ CHKCOLDBGOUT6\r
//++++ (*i)--;\r
// (*z)--;\r
//expand dong here\r
*/\r
//for(zzii=0; zzii<3; zzii++)\r
//{\r
-#ifdef BEVERBOSEPALCHECK\r
- printf("z+q: %d\n\n", ((*z)+(*q)));\r
-#endif\r
+ CHKCOLDBGOUT7\r
a[(((*z)+(*q)))]=zz;\r
//}\r
(*aa)=(((*z)+(*q)));\r
-#ifdef BEVERBOSEPALCHECK\r
- printf("!! a[%02d]: %d\n", (((*z)+(*q))/3), zz/3);\r
- printf("\n aa: %d\n\n", (*aa));//\r
- printf(" a[%02d]=(%02d) offset array i think the palette should be updated again~\n", ((*z)+(*q))/3, a[((*z)+(*q))/3]);//\r
- printf("wwwwwwwwwwwwwwww\n\n");//\r
-#endif\r
+ CHKCOLDBGOUT8\r
}\r
/*else\r
{\r
printf("z : %d [%02d][%02d][%02d]\n", (*z)/3, pal[(*z)], pal[(*z)+1], pal[(*z)+2]);\r
printf("================\n");\r
}*/\r
-#ifdef BEVERBOSEPALCHECK\r
- printf("[%d]", (zz+*q));//\r
-#endif\r
+ CHKCOLDBGOUT9\r
}\r
}\r
}\r
-#ifdef BEVERBOSEPALCHECK\r
- printf("wwwwwwwwwwwwwwww\n");\r
- printf("2 (*z): %d\n", (*z)/3);\r
- printf("2 (*i): %d\n", (*i)/3);\r
- printf("2 offset of color in palette (*q): %d\n", (*q)/3);//\r
- printf("chkcolor end~\n");\r
-#endif\r
+ CHKCOLDBGOUT10\r
//free(pal);\r
}\r
\r
}\r
if((*i)<PAL_SIZE && w==0)\r
{\r
- for(; (*i)<PAL_SIZE/24; (*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
#ifndef __16_VLPAL_H__\r
#define __16_VLPAL_H__\r
\r
+#include "src/lib/16_vlpald.h"\r
#include "src/lib/16_vl.h"\r
\r
-#define BEVERBOSEPALCHECK\r
-\r
-#ifdef BEVERBOSEPALCHECK\r
-#endif\r
\r
typedef struct\r
{\r
word offset;\r
} imgtestpal_t;\r
\r
+void VL_modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqpp);\r
void VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset);\r
+//void chkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z);\r
+\r
\r
#endif //__16_VLPAL_H__\r
+++ /dev/null
-/* Project 16 Source Code~
- * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
- *
- * This file is part of Project 16.
- *
- * Project 16 is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Project 16 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>, or
- * write to the Free Software Foundation, Inc., 51 Franklin Street,
- * Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-//#include "src/lib/16_vlpal.h"
-
-//color checker~
-//i want to make another vesion that checks the palette when the palette is being appened~
-void chkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z)
-{
- byte *pal;
- word zz=0;
- pal = modexNewPal();
- modexPalSave(pal);
- //printf("q: %02d\n", (*q));
-
- //check palette for dups
- for((*z)=0; (*z)<PAL_SIZE; (*z)+=3)
- {
-// printf("\n z: %d\n", (*z));
-// printf(" q: %d\n", (*q));
-// printf(" z+q: %d\n\n", ((*z)+(*q)));
- if((*z)%3==0)
- {
- if(pal[(*z)]==pal[(*z)+3] && pal[(*z)+1]==pal[(*z)+4] && pal[(*z)+2]==pal[(*z)+5])
- {
-// printf("\n%d [%02d][%02d][%02d]\n", (*z), pal[(*z)], pal[(*z)+1], pal[(*z)+2]);
-// printf("%d [%02d][%02d][%02d]\n\n", (*z)+3, pal[(*z)+3], pal[(*z)+4], pal[(*z)+5]);
- break;
- }
- else for(zz=0; zz<(*q); zz+=3)
- {
- //zq=(zz+(q-3));
- //printf("zz: %02d\n", zz/3);
- if(zz%3==0)
- {
- if(pal[((*z)+(*q))]==pal[((*z)+(*q))+3] && pal[((*z)+(*q))+1]==pal[((*z)+(*q))+4] && pal[((*z)+(*q))+2]==pal[((*z)+(*q))+5])
- {
-// printf("\nzq1:%d[%02d][%02d][%02d]\n", (zz+q), pal[(zz+q)], pal[(zz+q)+1], pal[(zz+q)+2]);
-// printf("zq2:%d[%02d][%02d][%02d]\n\n", (zz+q)+3, pal[(zz+q)+3], pal[(zz+q)+4], pal[(zz+q)+5]);
- break;
- }
- else if(pal[zz]==pal[((*z)+(*q))] && pal[zz+1]==pal[((*z)+(*q))+1] && pal[zz+2]==pal[((*z)+(*q))+2])
- {
-// printf("\n\nwwwwwwwwwwwwwwww\n");
-// printf(" zq: %d [%02d][%02d][%02d] value that is needing to be changed~\n", ((*z)+(*q))/3, pal[((*z)+(*q))], pal[((*z)+(*q))+1], pal[((*z)+(*q))+2]);
-// printf(" zz: %d [%02d][%02d][%02d] value that the previous value is going to change to~\n", (zz)/3, pal[zz], pal[zz+1], pal[zz+2]);
-// //printf(" zv: %d [%02d][%02d][%02d] wwww\n", (zz-z+q)/3, pal[(zz-z+q)], pal[(zz-z+q)+1], pal[(zz-z+q)+2]);
-// printf(" z : %d [%02d][%02d][%02d] offset value~\n", (*z)/3, pal[(*z)], pal[(*z)+1], pal[(*z)+2]);
- a[((*z)+(*q))/3]=zz/3;
- (*aa)=((*z)+(*q))/3;
-// printf("\n aa: %d\n\n", (*aa));
-// printf(" a[%02d]=(%02d) offset array i think the palette should be updated again~\n", ((*z)+(*q))/3, a[((*z)+(*q))/3]);
-// printf("wwwwwwwwwwwwwwww\n\n");
- }
- /*else
- {
- printf("================\n");
- printf("zq: %d [%02d][%02d][%02d]\n", ((*z)+(*q))/3, pal[((*z)+(*q))], pal[((*z)+(*q))+1], pal[((*z)+(*q))+2]);
- printf("zz: %d [%02d][%02d][%02d]\n", (zz)/3, pal[zz], pal[zz+1], pal[zz+2]);
- printf("z : %d [%02d][%02d][%02d]\n", (*z)/3, pal[(*z)], pal[(*z)+1], pal[(*z)+2]);
- printf("================\n");
- }*/
- //printf("[%d]", (zz+q));
- }
- }
- //printf("\nz: %d\n", z);
- //printf("q: %d\n", q);
- //printf("zz: %d\n", zz);
- }
- }
- free(pal);
-}
-
-void
-modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqpp)
-{
- byte *p = bmp->palette;
- word w=0;
- word q=0;
- word qq=0;
- word ii;
- static word a[256] = { 0 };
- word z=0,aq=0,aa=0;
- word pp=0,spee=0,ppee=0;
- sword aqpw;
-
-// if(qp>0) printf("(*i)=%02d\n", (*i));
- modexWaitBorder();
- if((*i)==0) outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */
- else if(qp==0)
- {
- q=(*i);
- }
- else
- {
- q=(*i);
- qq=(*i)/3;
-// printf("q: %02d\n", (q));
-// printf("qq: %02d\n", (qq));
- //printf(" (*i)-q=%02d\n", (*i)-q);
-// printf("================\n");
- outp(PAL_WRITE_REG, qq); /* start at the beginning of palette */
- }
- if((*i)<PAL_SIZE/2 && w==0)
- {
- for(; (*i)<PAL_SIZE/2; (*i)++)
- {
- //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]))
-//____ 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
- if(((((*i)-q)%3==0) || ((qp>0)&&((*i)-(bmp->offset*3))%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]))
- {
- if(qp>0)
- {
- (*i)-=(aqpp*3);
- aqpw=aqpp-1;
- outp(PAL_WRITE_REG, qq+(((*i)+(aqpw*3)-(bmp->offset*3))/3));
- for(ii=aqpp; ii>0; ii--)
- {
- outp(PAL_DATA_REG, p[((((*i)+((aqpp-ii)*3))+((aqpp+ii)*3))-(bmp->offset*3))]);
- outp(PAL_DATA_REG, p[((((*i)+((aqpp-ii)*3))+((aqpp+ii)*3)+1)-(bmp->offset*3))]);
- outp(PAL_DATA_REG, p[((((*i)+((aqpp-ii)*3))+((aqpp+ii)*3)+2)-(bmp->offset*3))]);
-// printf("position = %d\n", qq+(((*i)+(aqpw*3)-(bmp->offset*3))/3));
-/*if(qp>0){ //printf("[%d]", p[((*i)-q)]); printf("[%d]", p[((*i)-q)+1]); printf("[%d]", p[((*i)-q)+2]); printf("[%d]", p[((*i)-q)+3]); printf("[%d]", p[((*i)-q)+4]); printf("[%d]", p[((*i)-q)+5]); printf(" %d [%d]\n", (*i), p[((*i)-q)]); }
-printf("[%d]", p[((((*i)+((aqpp-ii)*3)))-(bmp->offset*3))]);
-printf("[%d]", p[((((*i)+((aqpp-ii)*3))+1)-(bmp->offset*3))]);
-printf("[%d] | ", p[((((*i)+((aqpp-ii)*3))+2)-(bmp->offset*3))]);
-printf("[%d]", p[((((*i)+((aqpp-ii)*3))+3)-(bmp->offset*3))]);
-printf("[%d]", p[((((*i)+((aqpp-ii)*3))+4)-(bmp->offset*3))]);
-printf("[%d]", p[((((*i)+((aqpp-ii)*3))+5)-(bmp->offset*3))]);
-printf(" %d [%d]\n",((((*i)+((aqpp-ii)*3))+((aqpp+ii)*3))-(bmp->offset*3))/3, p[((((*i)+((aqpp-ii)*3))+((aqpp+ii)*3))-(bmp->offset*3))]); }*/
- //printf("%d\n", ((*i)+((ii)*3))/3);
- //printf("ii=%d\n", ii);
- //printf("aqpp=%d\n", aqpp);
- //printf(" %d\n", ((*i)+((aqpp-ii)*3))/3);
- }
- //printf(" %d\n",((((*i)+((aqpp-ii)*3)))-(bmp->offset*3)));
- //printf(" %d\n",((((*i)+((aqpp-ii)*3))+1)-(bmp->offset*3)));
- //printf(" %d\n",((((*i)+((aqpp-ii)*3))+2)-(bmp->offset*3)));
- //printf("(*i)=%d\n", (*i));
- }
- //printf("[%d]", p[((*i)-q)]); printf("[%d]", p[((*i)-q)+1]); printf("[%d]", p[((*i)-q)+2]); printf("[%d]", p[((*i)-q)+3]); printf("[%d]", p[((*i)-q)+4]); printf("[%d]", p[((*i)-q)+5]); printf(" %d [%d]\n", (*i), p[((*i)-q)]);
- w++;
- break;
- }
- else
- {
- if(bmp->offset==0 && (*i)<3 && q==0) outp(PAL_DATA_REG, 0);
- else
- if(qp==0) outp(PAL_DATA_REG, p[(*i)-q]);
- else outp(PAL_DATA_REG, p[((*i)-(bmp->offset*3))]);
- }
- }
- }
- modexWaitBorder(); /* waits one retrace -- less flicker */
- if((*i)>=PAL_SIZE/2 && w==0)
- {
- for(; (*i)<PAL_SIZE; (*i)++)
- {
-//____ 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
- if(((((*i)-q)%3==0) || ((qp>0)&&((*i)-(bmp->offset*3))%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]))
- {
- if(qp>0)
- {
- (*i)-=(aqpp*3);
- aqpw=aqpp-1;
- outp(PAL_WRITE_REG, qq+(((*i)+(aqpw*3)-(bmp->offset*3))/3));
- for(ii=aqpp; ii>0; ii--)
- {
- outp(PAL_DATA_REG, p[((((*i)+((aqpp-ii)*3))+((aqpp+ii)*3))-(bmp->offset*3))]);
- outp(PAL_DATA_REG, p[((((*i)+((aqpp-ii)*3))+((aqpp+ii)*3)+1)-(bmp->offset*3))]);
- outp(PAL_DATA_REG, p[((((*i)+((aqpp-ii)*3))+((aqpp+ii)*3)+2)-(bmp->offset*3))]);
-// printf("position = %d\n", qq+(((*i)+(aqpw*3)-(bmp->offset*3))/3));
-/*if(qp>0){ //printf("[%d]", p[((*i)-q)]); printf("[%d]", p[((*i)-q)+1]); printf("[%d]", p[((*i)-q)+2]); printf("[%d]", p[((*i)-q)+3]); printf("[%d]", p[((*i)-q)+4]); printf("[%d]", p[((*i)-q)+5]); printf(" %d [%d]\n", (*i), p[((*i)-q)]); }
-printf("[%d]", p[((((*i)+((aqpp-ii)*3)))-(bmp->offset*3))]);
-printf("[%d]", p[((((*i)+((aqpp-ii)*3))+1)-(bmp->offset*3))]);
-printf("[%d] | ", p[((((*i)+((aqpp-ii)*3))+2)-(bmp->offset*3))]);
-printf("[%d]", p[((((*i)+((aqpp-ii)*3))+3)-(bmp->offset*3))]);
-printf("[%d]", p[((((*i)+((aqpp-ii)*3))+4)-(bmp->offset*3))]);
-printf("[%d]", p[((((*i)+((aqpp-ii)*3))+5)-(bmp->offset*3))]);
-printf(" %d [%d]\n",((((*i)+((aqpp-ii)*3))+((aqpp+ii)*3))-(bmp->offset*3))/3, p[((((*i)+((aqpp-ii)*3))+((aqpp+ii)*3))-(bmp->offset*3))]); }*/
- //printf("%d\n", ((*i)+((ii)*3))/3);
- //printf("ii=%d\n", ii);
- //printf("aqpp=%d\n", aqpp);
- //printf(" %d\n", ((*i)+((aqpp-ii)*3))/3);
- }
- //printf(" %d\n",((((*i)+((aqpp-ii)*3)))-(bmp->offset*3)));
- //printf(" %d\n",((((*i)+((aqpp-ii)*3))+1)-(bmp->offset*3)));
- //printf(" %d\n",((((*i)+((aqpp-ii)*3))+2)-(bmp->offset*3)));
- //printf("(*i)=%d\n", (*i));
- }
- //printf("[%d]", p[((*i)-q)]); printf("[%d]", p[((*i)-q)+1]); printf("[%d]", p[((*i)-q)+2]); printf("[%d]", p[((*i)-q)+3]); printf("[%d]", p[((*i)-q)+4]); printf("[%d]", p[((*i)-q)+5]); printf(" %d [%d]\n", (*i), p[((*i)-q)]);
- w++;
- break;
- }
- else
- {
- if(qp==0) outp(PAL_DATA_REG, p[(*i)-q]);
- else outp(PAL_DATA_REG, p[((*i)-(bmp->offset*3))]);
- }
- }
- }
-
- //palette checker~
- if(q>0 && qp==0)
- {
- long lq;
- long bufSize = (bmp->width * bmp->height);
- chkcolor(bmp, &q, &a, &aa, &z);
-
- /*printf("z=%d\n", z/3);
- printf("q+z=%d\n", (q+z)/3);
- printf("z-ppee=%d\n", (z-ppee)/3);
- printf("q=%d\n", q/3);
- printf("aa=%d\n", aa);*/
-
- aq=0; pp = q; ppee=q;
-aqpee:
- while(aq<=aa)
- {
- //printf("a[%02d]=(%d)", aq, a[aq]);
- if(a[aq]==0) aq++;
- else{ aqpp++; break; }
- }
-
-/* printf("aq=%02d\n", aq);
- printf("z=%02d\n", z/3);
- printf("(z/3)-aqpp=%02d\n", (z/3)-aqpp);
- printf("aqpp=%02d\n", aqpp);*/
-
- for(lq=0; lq<bufSize; lq++)
- {
- if(bmp->data[lq]+bmp->offset==aq)
- {
- //printf("\n%02d\n", bmp->data[lq]);
- //printf("\n%02d\n", bmp->offset);
- //printf("\naq= %02d\n", aq);
- //printf("a[aq]= %02d\n", a[aq]);
- //bmp->data[lq]=((bmp->data[lq]+bmp->offset)-a[aq]);
- bmp->data[lq]=a[aq];
- //printf("_%d \n", bmp->data[lq]);
- }
- else if(bmp->data[lq]+bmp->offset < (z/3)-aqpp)
- {
- if(bmp->data[lq]+bmp->offset >= aq) bmp->data[lq]=(bmp->data[lq]+bmp->offset)-aqpp;
- else bmp->data[lq]+=(bmp->offset);
- }
-
- //printf("%02d ", bmp->data[lq]);
- //if(lq > 0 && lq%bmp->width==0) printf("\n");
- }
-
- while(pp<=(aq*3))
- {
- if(((pp/3)==aq || spee>0))
- {
- /*printf("spee=%d\n", spee);
- printf(" pp=%02d ", pp/3);
- printf("old bmp: [%d]", bmp->palette[(pp-ppee)]);
- printf("[%d]", bmp->palette[(pp-ppee)+1]);
- printf("[%d]\n", bmp->palette[(pp-ppee)+2]);*/
- //if(spee==0) printf("\npp=%02d\n\n", pp/3);
- bmp->palette[(pp-ppee)]= bmp->palette[(pp-ppee)+3];
- bmp->palette[(pp-ppee)+1]= bmp->palette[(pp-ppee)+4];
- bmp->palette[(pp-ppee)+2]= bmp->palette[(pp-ppee)+5];
- if(spee==0) spee++;
- }
- /*printf(" pp=%02d ", pp/3);
- printf(" bmp: [%d]", bmp->palette[(pp-ppee)]);
- printf("[%d]", bmp->palette[(pp-ppee)+1]);
- printf("[%d]\n", bmp->palette[(pp-ppee)+2]);*/
- pp+=3;
- }
-
- //update the palette~
- //printf(" aqpp= %d\n", aqpp);
- modexPalUpdate(bmp, &ppee, 1, aqpp);
- (*i)=ppee;
- //printf(" aqpp= %d\n", aqpp);
- //printf(" ppee= %d\n", ppee);
-
- /*printf(".\n");
- printf("aqpp= %02d\n", aqpp/3);
- printf("aq= %02d\n", aq);
- printf("aa= %02d\n", aa);
- printf(" ppee= %02d\n", ppee);*/
-
- if(aq<aa){ /*printf("~~~~\n"); */ppee=q; aq++; goto aqpee; }
- /*printf("ppee=%d\n", ppee);
- printf("pp=%d\n", pp);
- printf("q=%d\n", q);
- printf("(*i)=%d\n", (*i));*/
-
- }
-}
-
-void
-modexPalUpdate2(byte *p)
-{
- int i;
- modexWaitBorder();
- outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */
- for(i=0; i<PAL_SIZE/2; i++)
- {
- outp(PAL_DATA_REG, p[i]);
- }
- modexWaitBorder(); /* waits one retrace -- less flicker */
- for(; i<PAL_SIZE; i++)
- {
- outp(PAL_DATA_REG, p[(i)]);
- }
-}
// pee->coor = rand()%256;\r
// modexcls(page, pee->coor, VGA);\r
colorz(page, pee);\r
- modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi");\r
+ modexprint(page, page->sw/2, page->sh/2, 1, 0, 47, 0, "bakapi");\r
break;\r
case 7:\r
if(pee->coor <= pee->hgq)\r
break;\r
case 8:\r
colorz(page, pee);\r
- modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi");\r
+ modexprint(page, page->sw/2, page->sh/2, 1, 0, 47, 0, "bakapi");\r
break;\r
case 9:\r
if(pee->coor <= pee->hgq)\r
//right movement\r
case 3:\r
if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->ti.tw < pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->ti.tilemidposscreenx &&\r
- !(pip[0].map->data[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection!\r
+ !(pip[0].map->MAPDATAPTR[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection!\r
{\r
player[pn].walktype=2;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
}\r
- else if(player[pn].enti.tx < pip[0].map->width && !(pip[0].map->data[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
+ else if(player[pn].enti.tx < pip[0].map->width && !(pip[0].map->MAPDATAPTR[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
{\r
player[pn].walktype=1;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
//left movement\r
case 1:\r
if(pip[0].tx > 0 && pip[0].tx+pip[0].page->ti.tw <= pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->ti.tilemidposscreenx &&\r
- !(pip[0].map->data[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection!\r
+ !(pip[0].map->MAPDATAPTR[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection!\r
{\r
player[pn].walktype=2;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
}\r
- else if(player[pn].enti.tx > 1 && !(pip[0].map->data[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
+ else if(player[pn].enti.tx > 1 && !(pip[0].map->MAPDATAPTR[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
{\r
player[pn].walktype=1;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
//down movement\r
case 4:\r
if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->ti.th < pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->ti.tilemidposscreeny &&\r
- !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY)) //collision detection!\r
+ !(pip[0].map->MAPDATAPTR[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY)) //collision detection!\r
{\r
player[pn].walktype=2;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
}\r
- else if(player[pn].enti.ty < pip[0].map->height && !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY))\r
+ else if(player[pn].enti.ty < pip[0].map->height && !(pip[0].map->MAPDATAPTR[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY))\r
{\r
player[pn].walktype=1;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
//up movement\r
case 0:\r
if(pip[0].ty > 0 && pip[0].ty+pip[0].page->ti.th <= pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->ti.tilemidposscreeny &&\r
- !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY)) //collision detection!\r
+ !(pip[0].map->MAPDATAPTR[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY)) //collision detection!\r
{\r
player[pn].walktype=2;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
//0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
} else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
}\r
- else if(player[pn].enti.ty > 1 && !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY))\r
+ else if(player[pn].enti.ty > 1 && !(pip[0].map->MAPDATAPTR[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY))\r
{\r
player[pn].walktype=1;\r
if(player[pn].enti.q<=player[pn].enti.spt)\r
i=0;\r
for(y=0; y<map->height; y++) {\r
for(x=0; x<map->width; x++) {\r
- map->data[i]=255;\r
-// printf("[%d]", map->data[i]);\r
+ map->MAPDATAPTR[i]=255;\r
+// printf("[%d]", map->MAPDATAPTR[i]);\r
tile = tile ? 0 : 1;\r
i++;\r
}\r
ScrollRight(mv, player, id, plid);\r
\r
/* draw the next column */\r
- x= mv[0].page->sw + mv[0].map->tiles->tileWidth;\r
+ x= mv[0].page->sw + mv[0].map->MAPTILESPTR->tileWidth;\r
#ifndef FULLRCREND\r
if(player[plid].enti.q%4)\r
#else\r
mapDrawCol(&mv[id], mv[0].tx + mv[0].page->ti.tw, mv[0].ty-1, x, player, DRAWCOLNUM);\r
// else\r
// if(mv[0].video->bgps)\r
-// modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[0].map->tiles->tileWidth, mv[0].page->height);\r
+// modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[0].map->MAPTILESPTR->tileWidth, mv[0].page->height);\r
//mv[0].video->dorender=1;//ScrollRight\r
}\r
\r
mapDrawCol(&mv[id], mv[0].tx - 1, mv[0].ty-1, x, player, DRAWCOLNUM);\r
// else\r
// if(mv[0].video->bgps)\r
-// modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[0].map->tiles->tileWidth, mv[0].page->height);\r
+// modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[0].map->MAPTILESPTR->tileWidth, mv[0].page->height);\r
//mv[0].video->dorender=1;//ScrollLeft\r
}\r
\r
mapDrawRow(&mv[id], mv[0].tx - 1, mv[0].ty-1, y, player, DRAWROWNUM);\r
// else\r
// if(mv[0].video->bgps)\r
-// modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->tiles->tileHeight);\r
+// modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->MAPTILESPTR->tileHeight);\r
//mv[0].video->dorender=1;//ScrollUp\r
}\r
\r
ScrollDown(mv, player, id, plid);\r
\r
/* draw the next row */\r
- y= mv[0].page->sh + mv[0].map->tiles->tileHeight;\r
+ y= mv[0].page->sh + mv[0].map->MAPTILESPTR->tileHeight;\r
#ifndef FULLRCREND\r
if(player[plid].enti.q%3)\r
#else\r
mapDrawRow(&mv[id], mv[0].tx - 1, mv[0].ty+mv[0].page->ti.th, y, player, DRAWROWNUM);\r
// else\r
// if(mv[0].video->bgps)\r
-// modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->tiles->tileHeight);\r
+// modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->MAPTILESPTR->tileHeight);\r
//mv[0].video->dorender=1;//ScrollDown\r
}\r
\r
//initiate a null map!\r
map->width=MAPW;///2;\r
map->height=MAPH;///2;\r
-// map->data = malloc(((map->width*map->height)+1)*sizeof(byte));\r
- map->data = &x;\r
- map->tiles = malloc(sizeof(tiles_t));\r
+// map->MAPDATAPTR = malloc(((map->width*map->height)+1)*sizeof(byte));\r
+ map->MAPDATAPTR = &x;\r
+ map->MAPTILESPTR = malloc(sizeof(tiles_t));\r
//fix this to be far~\r
// bp = bitmapLoadPcx("data/ed.pcx");\r
-// map->tiles->data = &bp;\r
- map->tiles->tileHeight = 16;\r
- map->tiles->tileWidth = 16;\r
- map->tiles->rows = 1;\r
- map->tiles->cols = 1;\r
+// map->MAPTILESPTR->data = &bp;\r
+ map->MAPTILESPTR->tileHeight = 16;\r
+ map->MAPTILESPTR->tileWidth = 16;\r
+ map->MAPTILESPTR->rows = 1;\r
+ map->MAPTILESPTR->cols = 1;\r
#ifdef __DEBUG_MAP__\r
dbg_maptext = true;\r
#endif\r
/* set up the coordinates */\r
mv[0].tx = mv[1].tx = tx;\r
mv[0].ty = mv[1].ty = ty;\r
- mv[0].page->dx = mv[1].page->dx = mv[2].page->dx = mv[3].page->dx = mv->map->tiles->tileWidth;\r
- mv[0].page->dy = mv[1].page->dy = mv[2].page->dy = mv[3].page->dy = mv->map->tiles->tileHeight;\r
+ mv[0].page->dx = mv[1].page->dx = mv[2].page->dx = mv[3].page->dx = mv->map->MAPTILESPTR->tileWidth;\r
+ mv[0].page->dy = mv[1].page->dy = mv[2].page->dy = mv[3].page->dy = mv->map->MAPTILESPTR->tileHeight;\r
\r
/* set up the thresholds */\r
- mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileWidth * 2;\r
- mv[0].dyThresh = mv[1].dyThresh = mv[2].dyThresh = mv[3].dyThresh = mv->map->tiles->tileHeight * 2;\r
+ mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->MAPTILESPTR->tileWidth * 2;\r
+ mv[0].dyThresh = mv[1].dyThresh = mv[2].dyThresh = mv[3].dyThresh = mv->map->MAPTILESPTR->tileHeight * 2;\r
}\r
\r
void ZC_mapredraw(map_view_t *mv, int tx, int ty)\r
\r
py=0;\r
i=mv[0].ty * mv[0].map->width + mv[0].tx;\r
- for(ty=mv[0].ty-1; py < mv[0].page->sh+mv->dyThresh && ty < mv[0].map->height; ty++, py+=mv[0].map->tiles->tileHeight) {\r
+ for(ty=mv[0].ty-1; py < mv[0].page->sh+mv->dyThresh && ty < mv[0].map->height; ty++, py+=mv[0].map->MAPTILESPTR->tileHeight) {\r
mapDrawWRow(&mv[0], tx-1, ty, py);\r
mapDrawWRow(&mv[1], tx-1, ty, py);\r
i+=mv->map->width - tx;\r
void near\r
mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y)\r
{\r
- word rx;\r
- word ry;\r
+ word rx, ry;\r
//word textx=0, texty=0;\r
//if(i==0) i=2;\r
- if(i==0)\r
+// printf("%02d ", i); if(x >= page->width - t->tileWidth) printf("\n");\r
+ switch(i)\r
{\r
- //wwww\r
- modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, 1); //currently the over scan color!\r
- }\r
- else\r
- {\r
- rx = (((i-1) % ((t->data->width)/t->tileWidth)) * t->tileWidth);\r
- ry = (((i-1) / ((t->data->height)/t->tileHeight)) * t->tileHeight);\r
-////0000printf("i=%d\n", i);\r
-#ifdef __DEBUG_MAP__\r
- switch(dbg_maptext)\r
- {\r
- case 0:\r
-#endif\r
+ case 0:\r
+ //wwww\r
+ modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, 1); //currently the over scan color!\r
+ break;\r
+ default:\r
+ rx = (((i-1) % ((t->pcximg->width)/t->tileWidth)) * t->tileWidth);\r
+ ry = (((i-1) / ((t->pcximg->height)/t->tileHeight)) * t->tileHeight);\r
#ifndef TILERENDER\r
- if(!pagenorendermap) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, i+1);\r
- sprintf(global_temp_status_text2, "%d", i);\r
- modexprint(page, x, y, 1, 1, 2, global_temp_status_text2);\r
+ if(!pagenorendermap) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, i+1);\r
#else\r
- modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, i);\r
- /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */\r
- //draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));\r
- //modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data));\r
+ modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, i);\r
+ //draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));\r
+ //modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data));\r
#endif\r
#ifdef __DEBUG_MAP__\r
- break;\r
- case 1:\r
- if(!pagenorendermap) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, i);\r
- sprintf(global_temp_status_text2, "%d", i);\r
- modexprint(page, x, y, 1, 1, 2, global_temp_status_text2);\r
- break;\r
- }\r
+ if(dbg_maptext){ sprintf(global_temp_status_text2, "%u", i); modexprint(page, x, y, 1, 0, 1, 2, global_temp_status_text2); }\r
#endif\r
+ break;\r
}\r
}\r
\r
if(pagedelayrendermap) if(!y) y+=TILEWH; else y-=TILEWH;\r
poopoffset%=player[0].enti.speed;\r
//printf("y: %d\n", poopoffset);\r
-if(pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dx); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 2, 1, global_temp_status_text); }\r
+if(pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dx); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 1, 2, 1, global_temp_status_text); }\r
/* the position within the map array */\r
i=ty * mv->map->width + tx;\r
- for( mv->dx=poopoffset; mv->dx<(mv->page->sw+mv->dxThresh)/(poopoffset+1) && tx < mv->map->width; mv->dx+=mv->map->tiles->tileWidth, tx++) {\r
+ for( mv->dx=poopoffset; mv->dx<(mv->page->sw+mv->dxThresh)/(poopoffset+1) && tx < mv->map->width; mv->dx+=mv->map->MAPTILESPTR->tileWidth, tx++) {\r
if(i>=0)\r
- mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, mv->dx, y);\r
+ mapDrawTile(mv->map->MAPTILESPTR, mv->map->MAPDATAPTR[i], mv->page, mv->dx, y);\r
i++; /* next! */\r
}\r
if(pagedelayrendermap) delay(200);\r
if(pagedelayrendermap) if(!x) x+=TILEWH; else x-=TILEWH;\r
poopoffset%=player[0].enti.speed;\r
//printf("x: %d\n", poopoffset);\r
-if(pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dy); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 2, 1, global_temp_status_text); }\r
+if(pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dy); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 1, 2, 1, global_temp_status_text); }\r
/* location in the map array */\r
i=ty * mv->map->width + tx;\r
/* We'll copy all of the columns in the screen,\r
i + 1 row above and one below */\r
- for( mv->dy=poopoffset; mv->dy<(mv->page->sh+mv->dyThresh)/(poopoffset+1) && ty < mv->map->height; mv->dy+=mv->map->tiles->tileHeight, ty++) {\r
+ for( mv->dy=poopoffset; mv->dy<(mv->page->sh+mv->dyThresh)/(poopoffset+1) && ty < mv->map->height; mv->dy+=mv->map->MAPTILESPTR->tileHeight, ty++) {\r
if(i>=0)\r
- mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, mv->dy);\r
+ mapDrawTile(mv->map->MAPTILESPTR, mv->map->MAPDATAPTR[i], mv->page, x, mv->dy);\r
i += mv->map->width;\r
}\r
if(pagedelayrendermap) delay(200);\r
\r
/* the position within the map array */\r
i=ty * mv->map->width + tx;\r
- for(mv->dx=0; mv->dx<mv->page->sw+mv->dxThresh && tx < mv->map->width; mv->dx+=mv->map->tiles->tileWidth, tx++) {\r
+ for(mv->dx=0; mv->dx<mv->page->sw+mv->dxThresh && tx < mv->map->width; mv->dx+=mv->map->MAPTILESPTR->tileWidth, tx++) {\r
if(i>=0) /* we are in the map, so copy! */\r
- mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, mv->dx, y);\r
+ mapDrawTile(mv->map->MAPTILESPTR, mv->map->MAPDATAPTR[i], mv->page, mv->dx, y);\r
i++; /* next! */\r
}\r
}\r
\r
/* We'll copy all of the columns in the screen,\r
i + 1 row above and one below */\r
- for(mv->dy=0; mv->dy<mv->page->sh+mv->dyThresh && ty < mv->map->height; mv->dy+=mv->map->tiles->tileHeight, ty++) {\r
+ for(mv->dy=0; mv->dy<mv->page->sh+mv->dyThresh && ty < mv->map->height; mv->dy+=mv->map->MAPTILESPTR->tileHeight, ty++) {\r
if(i>=0) /* we are in the map, so copy away! */\r
- mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, mv->dy);\r
+ mapDrawTile(mv->map->MAPTILESPTR, mv->map->MAPDATAPTR[i], mv->page, x, mv->dy);\r
i += mv->map->width;\r
}\r
}\r
\r
-/*void qclean()\r
-{\r
- //setkb(0);\r
-}*/\r
-\r
boolean pagenorendermap = 0;\r
boolean pagedelayrendermap = 0;\r
\r
/* sync */\r
void shinku(global_game_variables_t *gv)\r
{\r
- word x = gv->video.page[/*!*/(gv->video.p)].dx - (gv->video.page[(gv->video.p)].tlx); // follow the screen\r
- word y = gv->video.page[/*!*/(gv->video.p)].dy - (gv->video.page[(gv->video.p)].tly); // follow the screen\r
+ word x = gv->video.page[/*!*/(gv->video.p)].dx; //(gv->video.page[(gv->video.p)].tlx) - // follow the screen\r
+ word y = gv->video.page[/*!*/(gv->video.p)].dy; //(gv->video.page[(gv->video.p)].tly) - // follow the screen\r
word col = 2, bgcol = 1, type = 1;//w = 64, h = 8,\r
if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second))\r
{\r
//\r
// This fixes *** Null pointer assignment detected error message in ZCROLL.EXE on exit.\r
sprintf(global_temp_status_text, "%.0f fps", (double)gv->kurokku.tiku/ticktock(gv));\r
- modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, col, bgcol, global_temp_status_text);\r
+ //modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, 1, col, bgcol, global_temp_status_text);\r
+ modexCopyPageRegion(&gv->video.page[0], &gv->video.page[1],\r
+ gv->video.page[/*!*/(gv->video.p)].dx,\r
+ gv->video.page[/*!*/(gv->video.p)].dy,\r
+ gv->video.page[/*!*/(gv->video.p)].dx,\r
+ gv->video.page[/*!*/(gv->video.p)].dy,\r
+ 96, 16);\r
+ modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, 1, col, bgcol, global_temp_status_text);\r
//0000printf("dx=%u dy=%u\n", gv->video.page[/*!*/(gv->video.p)].dx, gv->video.page[/*!*/(gv->video.p)].dy);\r
gv->kurokku.tiku=0;\r
}else //copy dat sheet\r
switch(gv->kurokku.fpscap)\r
{\r
case 0: //turn this off if XT\r
- //modexprint(&(gv->video.page[0]), x, y+8, type, col, bgcol, "sanic!");\r
+ //modexprint(&(gv->video.page[0]), x, y+8, type, 1, col, bgcol, "sanic!");\r
gv->kurokku.frames_per_second=1;\r
break;\r
case 1:\r
break;\r
}\r
x-=4;\r
- y-=pip[0].map->tiles->tileHeight;\r
+ y-=pip[0].map->MAPTILESPTR->tileHeight;\r
switch (player[pn].enti.d)\r
{\r
case 0:\r
#define SCROLLEXITMESG printf("page[0]dxy: %dx%d", gvar.video.page[0].dx, gvar.video.page[0].dy);\\r
printf("\n\n");\\r
printf("player vars:\n");\\r
- printf(" xy: %dx%d", player[0].enti.x, player[0].enti.y); printf(" txy: %dx%d", player[0].enti.tx, player[0].enti.ty); printf(" triggxy: %dx%d", player[0].enti.triggerx, player[0].enti.triggery); printf(" value: %d\n", mv[1].map->layerdata[0][(player[0].enti.triggerx-1)+(map.width*(player[0].enti.triggery-1))]);\\r
+ printf(" xy: %dx%d", player[0].enti.x, player[0].enti.y); printf(" txy: %dx%d", player[0].enti.tx, player[0].enti.ty); printf(" triggxy: %dx%d", player[0].enti.triggerx, player[0].enti.triggery); printf(" value: %d\n", mv[1].map->MAPDATAPTR[(player[0].enti.triggerx-1)+(map.width*(player[0].enti.triggery-1))]);\\r
printf(" hp: %d", (player[0].enti.hp)); printf(" q: %u", player[0].enti.q); printf(" info.dir: %u", player[0].info.dir); printf(" d: %u", player[0].enti.d); printf(" dire: %u", player[0].enti.dire);\\r
printf(" pdir: %u\n", player[0].pdir); printf(" delay=%u", player[0].enti.spri->delay);\\r
printf("\n\n");\\r
/* Snap the origin forward */\r
mv[id].page->data += 4;\r
\r
- mv[id].page->dx = mv[id].map->tiles->tileWidth;\r
+ mv[id].page->dx = mv[id].map->MAPTILESPTR->tileWidth;\r
}\r
}\r
\r
/* Snap the origin backward */\r
mv[id].page->data -= 4;\r
\r
- mv[id].page->dx = mv[id].map->tiles->tileWidth;\r
+ mv[id].page->dx = mv[id].map->MAPTILESPTR->tileWidth;\r
}\r
}\r
\r
/* Snap the origin upward */\r
mv[id].page->data -= mv[id].page->pi;\r
\r
- mv[id].page->dy = mv[id].map->tiles->tileHeight;\r
+ mv[id].page->dy = mv[id].map->MAPTILESPTR->tileHeight;\r
}\r
}\r
\r
/* Snap the origin downward */\r
mv[id].page->data += mv[id].page->pi;\r
\r
- mv[id].page->dy = mv[id].map->tiles->tileHeight;\r
+ mv[id].page->dy = mv[id].map->MAPTILESPTR->tileHeight;\r
}\r
}\r
\r
#ifdef DUMP\r
#ifdef DUMP_MAP\r
short i;\r
+#ifdef __NEWMAPTILEDATAVARS__\r
+ word k;\r
+#endif\r
#endif\r
#endif\r
char *fmt = "Memory available = %u\n";\r
fprintf(stdout, "map.height= %d\n", map.height);\r
#ifdef DUMP_MAP\r
//if(map.width*map.height != 1200)\r
- for(i=0; i<(map.width*map.height); i++)\r
+#ifdef __NEWMAPTILEDATAVARS__\r
+ for(k=0;k<MAPLAYERS;k++)\r
{\r
- //fprintf(stdout, "%04d[%02d]", i, map.data[i]);\r
- fprintf(stdout, "%c", map.layerdata[0][i]+44);\r
- if(!((i+1)%map.width)){\r
- //fprintf(stdout, "[%d]", i);\r
- fprintf(stdout, "\n"); }\r
+ printf("maplayer: %u\n", k);\r
+#endif\r
+ for(i=0; i<(map.width*map.height); i++)\r
+ {\r
+ //fprintf(stdout, "%04d[%02d]", i, map.data[i]);\r
+ fprintf(stdout, "%c", map.MAPDATAPTK[i]+44);\r
+ if(!((i+1)%map.width)){\r
+ //fprintf(stdout, "[%d]", i);\r
+ fprintf(stdout, "\n"); }\r
+ }\r
+ //fprintf(stdout, "\n");\r
+#ifdef __NEWMAPTILEDATAVARS__\r
+ getch();\r
}\r
- fprintf(stdout, "\n");\r
+#endif\r
#else\r
//fprintf(stderr, "contents of the buffer\n[\n%s\n]\n", (gvar.ca.camap.mapsegs));\r
#endif\r
fprintf(stdout, "&map.height==%Fp\n", map.height);\r
fprintf(stdout, "&map.data==%Fp\n", map.data);*/\r
#endif\r
- fprintf(stdout, "okies~\n");\r
+ //fprintf(stdout, "okies~\n");\r
MM_FreePtr(&(gvar.ca.camap.mapsegs), &gvar);\r
PM_Shutdown(&gvar);\r
CA_Shutdown(&gvar);\r
\r
//the scripting stuff....\r
//if(((player[0].enti.triggerx == TRIGGX && player[0].enti.triggery == TRIGGY) && IN_KeyDown(0x1C))||(player[0].enti.tx == 5 && player[0].enti.ty == 5))\r
- if(((mv[0].map->data[(player[0].enti.triggerx-1)+(map.width*(player[0].enti.triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].enti.tx == 5 && player[0].enti.ty == 5))\r
+ if(((mv[0].map->MAPDATAPTR[(player[0].enti.triggerx-1)+(map.width*(player[0].enti.triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].enti.tx == 5 && player[0].enti.ty == 5))\r
{\r
short i;\r
for(i=800; i>=400; i--)\r
VGAmodeX(1/*bakapee*/, 1, &gvar);\r
\r
/* load color palette */\r
+ /*ptmp.offset=(paloffset/3);\r
+ modexPalUpdate(&ptmp, &paloffset, 0, 0);\r
+ //modexClearRegion(bg->page, 0, 0, 320, 240, 255);\r
+ //printf(" %d\n", sizeof(ptmp.data));\r
+ //printf("1: %d\n", paloffset);\r
+ map.tiles->data->offset=(paloffset/3);\r
+ modexPalUpdate(map.tiles->data, &paloffset, 0, 0);*/\r
VL_LoadPalFile(bakapee1p, &gvar.video.palette);\r
+ //VL_LoadPalFile("data/default.pal", &gvar.video.palette);\r
\r
#ifdef FADE\r
gpal = modexNewPal();\r
gvar.video.page[0].tlx=mv[0].tx*TILEWH;\r
gvar.video.page[0].tly=mv[0].ty*TILEWH;\r
shinku(&gvar);\r
+//modexpdump(mv[0].page);\r
#ifdef FADE\r
modexFadeOn(4, gpal);\r
#endif\r
\r
//the scripting stuff....\r
//if(((player[0].enti.triggerx == TRIGGX && player[0].enti.triggery == TRIGGY) && IN_KeyDown(0x1C))||(player[0].enti.tx == 5 && player[0].enti.ty == 5))\r
- if(((mv[0].map->data[(player[0].enti.triggerx-1)+(map.width*(player[0].enti.triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].enti.tx == 5 && player[0].enti.ty == 5))\r
+ if(((mv[0].map->MAPDATAPTR[(player[0].enti.triggerx-1)+(map.width*(player[0].enti.triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].enti.tx == 5 && player[0].enti.ty == 5))\r
{\r
short i;\r
for(i=800; i>=400; i--)\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