OSDN Git Service

hmmm layers in map_t ....
authorsparky4 <sparky4@cock.li>
Tue, 14 Feb 2017 21:28:21 +0000 (15:28 -0600)
committersparky4 <sparky4@cock.li>
Tue, 14 Feb 2017 21:28:21 +0000 (15:28 -0600)
12 files changed:
MAPTEST.L16 [new file with mode: 0755]
data/G.PAL
data/newtest.map
data/newtest.tmx
src/lib/16_head.c
src/lib/16_head.h
src/lib/16_tail.c
src/lib/16_tail.h
src/lib/16_tdef.h
src/lib/16_vl.c
src/maptest.c
src/zcroll.c

diff --git a/MAPTEST.L16 b/MAPTEST.L16
new file mode 100755 (executable)
index 0000000..220afd3
--- /dev/null
@@ -0,0 +1,32 @@
+map.width=     40\r
+map.height=    30\r
+-./0,////////07777777777777777777777-./0\r
+1234,-,-,,777777777777777777777777771234\r
+56780-,-,,777777777777777777777777775678\r
+9:;<,---14777777777777777777777777779:;<\r
+,,0,,,,,44777/77777777777777777777777777\r
+7777,,,,44777777777777777777777777777777\r
+7777,,,,77777777777777777777777777777777\r
+7777,,,,77777777/77777777777777777777777\r
+777777777,777777/77777777777777777777777\r
+7777777777777777/77777777777777777777777\r
+7777777777777777/77777777777777777777777\r
+777777777777////-./0/////777777777777777\r
+77777777777/7777123422222///777777777777\r
+777777777//77777567822222222///777777777\r
+77777777/77777779:;</2222222222//7777777\r
+77777777/77777777777/222222222222//77777\r
+77777777/777777777777/2222222222222/7777\r
+77777777/7777777777777//222222222222/777\r
+77777777/777777777777777/////2222222/777\r
+77777777/77777777777777777777////////777\r
+77777777/7777777777777777777777777777777\r
+777777777//7777777777777777,,,,,,,777777\r
+77777777777//77777777777777,77777,777777\r
+7777777777777///77777777777,7,,,7,777777\r
+7777777777777777///77777777,7,777,777777\r
+777777777777777777777777777,7,,,,,777777\r
+-./077777777777777777777777,77777777-./0\r
+123477777777777777777777777,,,,,,,,71234\r
+5678777777777777777777777777777777775678\r
+9:;<777777777777777777777777777777779:;<\r
index 0ecbac3..d5aa70a 100755 (executable)
Binary files a/data/G.PAL and b/data/G.PAL differ
index 57f063d..14b8785 100755 (executable)
          "objects":[
                 {
                  "height":16,
-                 "name":"",
+                 "name":"trunk",
                  "properties":
                     {
 
                     },
-                 "type":"",
+                 "type":"nonc",
                  "visible":true,
                  "width":32,
                  "x":128,
                 }, 
                 {
                  "height":16,
-                 "name":"",
+                 "name":"stump",
                  "properties":
                     {
 
                     },
-                 "type":"",
+                 "type":"nonc",
                  "visible":true,
                  "width":16,
                  "x":144,
index f9f1d08..1bff6b8 100755 (executable)
 </data>
  </layer>
  <objectgroup name="ob" width="40" height="30">
-  <object x="128" y="32" width="32" height="16"/>
-  <object x="144" y="128" width="16" height="16"/>
+  <object name="trunk" type="nonc" x="128" y="32" width="32" height="16"/>
+  <object name="stump" type="nonc" x="144" y="128" width="16" height="16"/>
  </objectgroup>
 </map>
index f48a09c..7f46743 100755 (executable)
@@ -34,6 +34,73 @@ filesize(FILE *fp)
        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
index aad7a55..134def2 100755 (executable)
@@ -198,6 +198,9 @@ typedef union REGPACK       regs_t;
 \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
index 9277d4e..2ff2229 100755 (executable)
@@ -372,73 +372,6 @@ void Quit (global_game_variables_t *gvar, char *error)
 }\r
 \r
 //===========================================================================\r
-//from http://stackoverflow.com/questions/2736753/how-to-remove-extension-from-file-name\r
-\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
 #ifndef __WATCOMC__\r
 char global_temp_status_text[512];\r
index fc43be3..5dffd51 100755 (executable)
        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_PgUp)){ \\r
+       if(IN_KeyDown(sc_V)) VL_PatternDraw(&gvar.video, 0, 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); } \\r
-       if(IN_KeyDown(sc_PgDn)){ \\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); }\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
 void Startup16(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
index 38fd226..52435a9 100755 (executable)
@@ -80,9 +80,8 @@ typedef struct {
 //TODO: 16_mm and 16_ca must handle this\r
 //TODO: add variables from 16_ca\r
 //#define __NEWMAPTILEDATAVARS__\r
-\r
-#ifdef __NEWMAPTILEDATAVARS__\r
 #define MAPLAYERS 4\r
+#ifdef __NEWMAPTILEDATAVARS__\r
 #define MAPTILESPTR            layertile[0]\r
 #define MAPTILESPTK            layertile[k]\r
 #define MAPDATAPTR             layerdata[0]\r
@@ -100,8 +99,8 @@ typedef struct {
        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;  //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
+       byte * far *layerdata;\r
+       tiles_t far *layertile[MAPLAYERS];\r
 #endif\r
        int width, height;              //this has to be signed!\r
        byte name[16];\r
index 9cada15..2141dbc 100755 (executable)
@@ -1002,7 +1002,7 @@ void modexpdump(page_t *pee)
        int palq=(mult)*TILEWH;\r
        int palcol=0;\r
        int palx, paly;\r
-       for(paly=0; paly<palq; paly+=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
index f426b2c..deef4c7 100755 (executable)
@@ -32,6 +32,9 @@ main(int argc, char *argv[])
 #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
@@ -58,15 +61,24 @@ 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(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.MAPDATAPTR[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
@@ -77,7 +89,7 @@ main(int argc, char *argv[])
        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
index 3187839..e1f92fa 100755 (executable)
@@ -112,6 +112,7 @@ void main(int argc, char *argv[])
        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