OSDN Git Service

Revert "too tired to continue"
authorsparky4 <sparky4@cock.li>
Tue, 14 Feb 2017 17:41:14 +0000 (11:41 -0600)
committersparky4 <sparky4@cock.li>
Tue, 14 Feb 2017 17:41:14 +0000 (11:41 -0600)
 #Please enter the commit message for your changes. Lines starting
 #with '' will be ignored, and an empty message aborts the commit.
 #On branch master
 #Your branch is up-to-date with 'origin/master'.

Changes to be committed:
modified:   data/16.pal
modified:   data/G.PAL
modified:   src/lib/16_map.c
modified:   src/lib/16_tdef.h
modified:   src/lib/16_vl.c
modified:   src/lib/16_vlpal.c
modified:   src/lib/bitmap.c
modified:   src/lib/scroll16.c
modified:   src/maptest.c

 #Changes not staged for commit:

Untracked files:
0.exe
0.lnk
16.exe
16.lnk
bakapi.exe
bakapi.lnk
db.lnk
exmmtest.exe
exmmtest.lnk
inputest.exe
inputest.lnk
maptest.exe
maptest.lnk
palettec.exe
palettec.lnk
palettel.exe
palettel.lnk
palllist.exe
palllist.lnk
pcxtest.exe
pcxtest.lnk
scroll.exe
scroll.lnk
test.exe
test.lnk
tesuto.exe
tesuto.lnk
vgmtest.exe
vgmtest.lnk
vrstest.exe
vrstest.lnk
wcpu.lnk
zcroll.exe
zcroll.lnk

data/16.pal
data/G.PAL
src/lib/16_map.c
src/lib/16_tdef.h
src/lib/16_vl.c
src/lib/16_vlpal.c
src/lib/bitmap.c
src/lib/scroll16.c
src/maptest.c

index cb6f0ae..eaf5208 100755 (executable)
Binary files a/data/16.pal and b/data/16.pal differ
index 07edf76..8092380 100755 (executable)
Binary files a/data/G.PAL and b/data/G.PAL differ
index b17eb93..37179ab 100755 (executable)
@@ -296,7 +296,7 @@ void extract_map(const char *js, jsmntok_t *t, size_t count, map_t *map) {
                                if(jsoneq(js, &(t[i]), "image") == 0) {\r
                                        map->MAPTILESPTK = malloc(sizeof(tiles_t));\r
                                        s = remove_ext((char *)js+t[i+1].start, '.', '/');\r
-                                       strcpy(map->MAPTILESPTK->tileset.imgname, s);\r
+                                       strcpy(map->MAPTILESPTK->imgname, s);\r
                                        //And move to vrs, probably\r
 //                                     bp = bitmapLoadPcx("data/ed.pcx");\r
 //                                     map->MAPTILESPTK->btdata = &bp;\r
index 4700625..38fd226 100755 (executable)
@@ -48,44 +48,14 @@ typedef struct {
        word offset;\r
 } bitmap_t;\r
 \r
-//from 16_sprit.h\r
-#ifdef __WATCOMC__\r
-typedef struct sprite\r
-{\r
-       // VRS container from which we will extract animation and image data\r
-       struct vrs_container *spritesheet;\r
-       // Container for a vrl sprite\r
-       struct vrl_container *sprite_vrl_cont;\r
-       // Current sprite id\r
-       int curr_spri_id;\r
-       // Index of a current sprite in an animation sequence\r
-       int curr_anim_spri;\r
-       // Current animation sequence\r
-       struct vrs_animation_list_entry_t *curr_anim_list;\r
-       // Index of current animation in relevant VRS offsets table\r
-       int curr_anim;\r
-       // Delay in time units untill we should change sprite\r
-       int delay;\r
-       // Position of sprite on screen\r
-       int x, y;\r
-} sprite_t;\r
-#endif\r
-\r
 typedef struct {\r
-       //byte far **data;\r
-//#ifdef       __WATCOMC__\r
-       //sprite_t *spri;\r
-//#endif\r
-       bitmap_t far *data;     // actual tileset info\r
-//in the bitmap_t\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    imgname[8];             // image filename of tileset\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
 } tileset_t;\r
 \r
-//not currently using\r
 typedef struct {\r
        byte far *plane[4];     // 4 planes of image data\r
        word width;                     // width of the image (spread across 4 planes)\r
@@ -94,20 +64,25 @@ typedef struct {
        byte *palette;\r
 } planar_buf_t;\r
 \r
-//tile properties\r
+//TODO: 16_mm and 16_ca must handle this\r
 typedef struct {\r
-       //bitmap_t far *btdata;         //old\r
-       tileset_t       tileset;                        //new\r
+       bitmap_t far *data;             //old\r
+       //planar_buf_t far *data;       //old\r
        word tileHeight, tileWidth;\r
-       word rows, cols;\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
+       byte    imgname[8];             //image file of tileset\r
 } tiles_t;\r
 \r
 //TODO: 16_mm and 16_ca must handle this\r
 //TODO: add variables from 16_ca\r
-#define MAPLAYERS 4\r
 //#define __NEWMAPTILEDATAVARS__\r
 \r
 #ifdef __NEWMAPTILEDATAVARS__\r
+#define MAPLAYERS 4\r
 #define MAPTILESPTR            layertile[0]\r
 #define MAPTILESPTK            layertile[k]\r
 #define MAPDATAPTR             layerdata[0]\r
@@ -122,14 +97,14 @@ typedef struct {
        //long          planestart[3];\r
        //unsigned      planelength[3];\r
 #ifndef __NEWMAPTILEDATAVARS__\r
-       byte            *data;                  //TODO: 16_mm and 16_ca must handle this\r
-       tiles_t         *tiles;         //TODO: 16_mm and 16_ca must handle this\r
+       byte *data;                     //TODO: 16_mm and 16_ca must handle this\r
+       tiles_t *tiles;         //TODO: 16_mm and 16_ca must handle this\r
 #else\r
-       byte far        *layerdata[MAPLAYERS];  //mapindex for specific layer\r
-       tiles_t far     *layertile[MAPLAYERS];\r
+       byte * far *layerdata;  //TODO: 16_mm and 16_ca must handle this\r
+       tiles_t far *layertile[MAPLAYERS];      //TODO: 16_mm and 16_ca must handle this\r
 #endif\r
        int width, height;              //this has to be signed!\r
-       byte name[16];          //mapname/maptitle\r
+       byte name[16];\r
 } map_t;\r
 \r
 typedef struct{\r
@@ -141,12 +116,12 @@ typedef struct{
        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
-} pagetileinfo_t;\r
+} tileinfo_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
-       pagetileinfo_t  ti;\r
+       tileinfo_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
@@ -162,6 +137,29 @@ typedef struct {
        sword delta;                    // How much should we shift the page for smooth scrolling\r
 } page_t;\r
 \r
+//from 16_sprit.h\r
+#ifdef __WATCOMC__\r
+typedef struct sprite\r
+{\r
+       // VRS container from which we will extract animation and image data\r
+       struct vrs_container *spritesheet;\r
+       // Container for a vrl sprite\r
+       struct vrl_container *sprite_vrl_cont;\r
+       // Current sprite id\r
+       int curr_spri_id;\r
+       // Index of a current sprite in an animation sequence\r
+       int curr_anim_spri;\r
+       // Current animation sequence\r
+       struct vrs_animation_list_entry_t *curr_anim_list;\r
+       // Index of current animation in relevant VRS offsets table\r
+       int curr_anim;\r
+       // Delay in time units untill we should change sprite\r
+       int delay;\r
+       // Position of sprite on screen\r
+       int x, y;\r
+} sprite_t;\r
+#endif\r
+\r
 //newer structs\r
 typedef        struct\r
 {\r
index 71c5667..881239d 100755 (executable)
@@ -689,7 +689,18 @@ modexLoadPalFile(byte *filename, byte **palette) {
 \r
 void VL_LoadPalFile(const char *filename, byte *palette)\r
 {\r
-       VL_LoadPalFilewithoffset(filename, palette, 0);\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
 }\r
 \r
 void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o)\r
@@ -703,8 +714,8 @@ void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o)
                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
+               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
        }\r
 }\r
 \r
index db0f19d..2f155f0 100755 (executable)
@@ -32,7 +32,7 @@ void modexchkcolor(imgtestpal_t *bmp, word *q, word *a, word *aa, word *z, word
                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
@@ -99,7 +99,7 @@ VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset)
        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
@@ -107,7 +107,7 @@ VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset)
        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
@@ -124,9 +124,9 @@ VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset)
 #endif\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
index b42204a..22bad98 100755 (executable)
@@ -160,7 +160,6 @@ bitmapLoadPcx(char *filename, global_game_variables_t *gv) {
 }\r
 \r
 //TODO: update!!\r
-/*\r
 tileset_t\r
 bitmapLoadPcxTiles(char *filename, word twidth, word theight) {\r
        tileset_t ts;\r
@@ -168,33 +167,33 @@ bitmapLoadPcxTiles(char *filename, word twidth, word theight) {
        bitmap_t result;\r
        int i;\r
 \r
-       // open the PCX file for reading\r
+       /* open the PCX file for reading */\r
        file = fopen(filename, "rb");\r
        if(!file) {\r
                printf("Could not open %s for reading.\n", filename);\r
                exit(-2);\r
        }\r
 \r
-       // load the first part of the pcx file\r
+       /* load the first part of the pcx file */\r
        loadPcxStage1(file, &result);\r
 \r
-       // get the number of tiles and set up the result structure\r
+       /* get the number of tiles and set up the result structure */\r
        ts.twidth = twidth;\r
        ts.theight = theight;\r
        ts.ntiles = (result.width/twidth) * (result.height/theight);\r
        ts.palette = result.palette;\r
 \r
-       // allocate the pixel storage for the tiles\r
+       /* allocate the pixel storage for the tiles */\r
        ts.data = _fmalloc(sizeof(byte*) * ts.ntiles);\r
        //ts.data[0] = malloc(sizeof(byte) * ts.ntiles * twidth * theight);\r
        for(i=1; i < ts.ntiles; i++) {\r
                ts.data[i] = ts.data[i-1] + twidth * theight;\r
        }\r
 \r
-       // finish off the file\r
+       /* finish off the file */\r
        loadPcxPalette(file, &result);\r
 \r
        fclose(file);\r
 \r
        return ts;\r
-}*/\r
+}\r
index e60a8b9..9a4708a 100755 (executable)
@@ -563,43 +563,42 @@ void ZC_mapredraw(map_view_t *mv, int tx, int ty)
 void near\r
 mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y)\r
 {\r
-       word rx, ry;\r
+       word rx;\r
+       word ry;\r
        //word textx=0, texty=0;\r
        //if(i==0) i=2;\r
-       switch(i)\r
+       if(i==0)\r
        {\r
-               case 0:\r
                //wwww\r
-                       modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, 0); //currently the over scan color!\r
-               break;\r
-               case 1:\r
-                       rx = (((i-1) % ((t->tileset.data->width)/t->tileWidth)) * t->tileWidth);\r
-                       ry = (((i-1) / ((t->tileset.data->height)/t->tileHeight)) * t->tileHeight);\r
-//                     rx = (((i-1) % ((t->spri->sprite_vrl_cont->vrl_header->width)/t->tileWidth)) * t->tileWidth);\r
-//                     ry = (((i-1) / ((t->spri->sprite_vrl_cont->vrl_header->height)/t->tileHeight)) * t->tileHeight);\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
-#ifndef TILERENDER\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
-                       //drawmap here\r
-#endif\r
 #ifdef __DEBUG_MAP__\r
                switch(dbg_maptext)\r
                {\r
                        case 0:\r
-\r
+#endif\r
+#ifndef TILERENDER\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
+#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+8, y+8, 1, 1, 2, global_temp_status_text2);\r
+                               modexprint(page, x, y, 1, 1, 2, global_temp_status_text2);\r
                        break;\r
                }\r
 #endif\r
-               break;\r
        }\r
 }\r
 \r
index 696f9b7..f426b2c 100755 (executable)
@@ -31,7 +31,7 @@ main(int argc, char *argv[])
        map_t map;\r
 #ifdef DUMP\r
 #ifdef DUMP_MAP\r
-       short i,k;\r
+       short i;\r
 #endif\r
 #endif\r
        char *fmt = "Memory available = %u\n";\r
@@ -58,19 +58,15 @@ main(int argc, char *argv[])
        fprintf(stdout, "map.height=    %d\n", map.height);\r
        #ifdef DUMP_MAP\r
        //if(map.width*map.height != 1200)\r
-       for(k=0;k<MAPLAYERS;k++)\r
+       for(i=0; i<(map.width*map.height); i++)\r
        {\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.MAPDATAPTR[i]+44);\r
-                       if(!((i+1)%map.width)){\r
-                               //fprintf(stdout, "[%d]", i);\r
-                               fprintf(stdout, "\n"); }\r
-               }\r
-               fprintf(stdout, "\n");\r
-               getch();\r
+               //fprintf(stdout, "%04d[%02d]", i, map.data[i]);\r
+               fprintf(stdout, "%c", map.MAPDATAPTR[i]+44);\r
+               if(!((i+1)%map.width)){\r
+                       //fprintf(stdout, "[%d]", i);\r
+                       fprintf(stdout, "\n"); }\r
        }\r
+       fprintf(stdout, "\n");\r
        #else\r
        //fprintf(stderr, "contents of the buffer\n[\n%s\n]\n", (gvar.ca.camap.mapsegs));\r
        #endif\r