From ac5b41ce7c622859a30a7a779b0d07bbc3f7cddf Mon Sep 17 00:00:00 2001 From: sparky4 Date: Tue, 14 Feb 2017 17:21:26 -0600 Subject: [PATCH] ==== FIXED MAP INDEX NUMBER PRITING IN DRAWTILE wwww ==== --- ZCROLL.L16 | 55 +++++++ data/foresttiles_0.gif | Bin 2739 -> 0 bytes makefile | 2 +- src/lib/16_head.c | 67 +++++++++ src/lib/16_head.h | 3 + src/lib/16_map.c | 74 ++++----- src/lib/16_tail.c | 25 ++-- src/lib/16_tail.h | 9 +- src/lib/16_tdef.h | 51 ++++--- src/lib/16_vl.c | 62 ++++---- src/lib/16_vl.h | 3 +- src/lib/16_vlpal.c | 65 ++------ src/lib/16_vlpal.h | 8 +- src/lib/16_vlpal_.c | 330 ----------------------------------------- src/lib/bakapee.c | 4 +- src/lib/scroll16.c | 146 +++++++++--------- src/lib/scroll16.h | 10 +- src/maptest.c | 28 +++- src/scroll.c | 2 +- src/zcroll.c | 15 +- 20 files changed, 373 insertions(+), 586 deletions(-) create mode 100755 ZCROLL.L16 delete mode 100755 data/foresttiles_0.gif delete mode 100755 src/lib/16_vlpal_.c diff --git a/ZCROLL.L16 b/ZCROLL.L16 new file mode 100755 index 00000000..ec5b8627 --- /dev/null +++ b/ZCROLL.L16 @@ -0,0 +1,55 @@ +01 02 03 04 00 03 03 03 03 03 03 03 03 04 11 11 11 11 11 11 11 +01 02 03 04 00 03 03 03 03 03 03 03 03 04 11 11 11 11 11 11 11 +04 05 06 07 08 00 01 00 01 00 00 11 11 11 11 11 11 11 11 11 11 11 +04 05 06 07 08 00 01 00 01 00 00 11 11 11 11 11 11 11 11 11 11 11 +08 09 10 11 12 04 01 00 01 00 00 11 11 11 11 11 11 11 11 11 11 11 +08 09 10 11 12 04 01 00 01 00 00 11 11 11 11 11 11 11 11 11 11 11 +12 13 14 15 16 00 01 01 01 05 08 11 11 11 11 11 11 11 11 11 11 11 +12 13 14 15 16 00 01 01 01 05 08 11 11 11 11 11 11 11 11 11 11 11 +16 00 00 04 00 00 00 00 00 08 08 11 11 11 03 11 11 11 11 11 11 11 +16 00 00 04 00 00 00 00 00 08 08 11 11 11 03 11 11 11 11 11 11 11 +11 11 11 11 11 00 00 00 00 08 08 11 11 11 11 11 11 11 11 11 11 11 +11 11 11 11 11 00 00 00 00 08 08 11 11 11 11 11 11 11 11 11 11 11 +11 11 11 11 11 00 00 00 00 11 11 11 11 11 11 11 11 11 11 11 11 11 +11 11 11 11 11 00 00 00 00 11 11 11 11 11 11 11 11 11 11 11 11 11 +11 11 11 11 11 00 00 00 00 11 11 11 11 11 11 11 11 03 11 11 11 11 +11 11 11 11 11 00 00 00 00 11 11 11 11 11 11 11 11 03 11 11 11 11 +11 11 11 11 11 11 11 11 11 11 00 11 11 11 11 11 11 03 11 11 11 11 +11 11 11 11 11 11 11 11 11 11 00 11 11 11 11 11 11 03 11 11 11 11 +11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 +11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 +11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 +11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 +11 11 11 11 11 11 11 11 11 11 11 11 11 03 03 03 03 01 02 03 04 03 +11 11 11 11 11 11 11 11 11 11 11 11 11 03 03 03 03 01 02 03 04 03 +11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 05 06 07 08 06 +11 11 11 11 11 11 11 11 11 11 11 11 03 11 11 11 11 05 06 07 08 06 +11 11 11 11 11 11 11 11 11 11 03 03 11 11 11 11 11 09 10 11 12 06 +11 11 11 11 11 11 11 11 11 11 03 03 11 11 11 11 11 09 10 11 12 06 +11 11 11 11 11 11 11 11 11 03 11 11 11 11 11 11 11 13 14 15 16 03 +11 11 11 11 11 11 11 11 11 03 11 11 11 11 11 11 11 13 14 15 16 03 +11 11 11 11 11 11 11 11 11 03 11 11 11 11 11 11 11 11 11 11 11 03 +11 11 11 11 11 11 11 11 11 03 11 11 11 11 11 11 11 11 11 11 11 03 + +Project 16 zcroll.exe. This is just a test file! +version Feb 14 2017 16:41:55 +page[0]dxy: 16x16 + +player vars: + xy: 160x128 txy: 10x8 triggxy: 10x9 value: 0 + hp: 4 q: 1 info.dir: 2 d: 2 dire: 30 pdir: 0 + delay=0 + +VL_PrintmodexmemInfo: + Virtual Screen: 352x272 Tile: 22x17=((Virtual Screen)/16) + Screen: 320x240 Tile: 20x15=((Screen)/16) + Free Video Memory: 767 + page [0]=(a000:0000) size=23936 w=352 h=272 sw=320 sh=240 pi=1408 + [1]=(a000:5d80) size=23936 w=352 h=272 sw=320 sh=240 pi=1408 + [2]=(a000:bb00) size=8448 w=352 h=96 sw=352 sh=96 pi=1408 + [3]=(a000:dc00) size=8448 w=352 h=96 sw=352 sh=96 pi=1408 +gvar.video: + r=0 bgps=1 + +detected CPU type: 80386 or newer +detected FPU type: 80387 diff --git a/data/foresttiles_0.gif b/data/foresttiles_0.gif deleted file mode 100755 index 934befa84bd63248faef41eb27a6b418ae1f8dbc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2739 zcmV;k3QYA!Nk%w1VNd{Y0K@1X25nefKxq%I5+?R00000000000000000000 z000000000000000EC2ui08jvM000I5U?7fUX`ZB|u59aCOdP+oi{5xyxAH7Ijm8Yt z+pTiQn~}%}I(pDv!vSP0lUQ9XCY*MILKzquw$`#EMsgb@m($#D_qjuhVn`a}QEtlu ze}I5eVna4|gMlV5F;7ipYIi4*VqrorIgyAik8yZ+nsAbUPF!X!IG-k=Cp=S4u$ro? ze{l@}u!ppvysTO(TvU*XHIlm?WaZ;GZ_QuYi89-$G}A} z`m}+D$l#YIxFiZ9RLEZ+Un*YzwXwGE8mVI-%^-~VkzKxUDJ;y1tIOV_$10;vzcA7dC=#McI$T`Uz%arvv$A53L=@!3=ZRtQo{OjA9=3~MKoPC@_# zMFtB%sYY-^pMKkE?4)c;8Hj#_%cEg)$fi69`gF2x-YPj0D`;=??W(Y+00%02N?qr0 zpFVfT&Y3gfoy>M-j!TNwW1|-i8#LzW_=Xe3#e__=%UOD|yVm{Go!Wd}_V7w^PZ<7X z^K8LVL40#9R0}QzhJ{D}JfGO~-&!hJftgs_EtgQieHbk^?>l zrCmyF9fu4Pzirl6N>Gj_jE~Nk>0C8$$fH7cFseq~O1hzQ8mBE5!RJWB z9EqbOU%_Bn99_<6P?OQ@>iY}3RDz{zITk;KSK7!l-!-10y$%^>U2QNuFVD{;*%M9d=4nCwil#sm`` zbkaHNY;-FnGg0zYQCDsC)hY21g0)jrf4#zm7p@?{*;rSBHMULHP(ce9P9UTO z17yuY-7IMB!dg~C1cWjr126##ag+VF3j-wHbwFNgybwT+20pk7D#|U|+!pA)0^U0W z2*lI{LRl>Tbu{d`vfPymx$>SnXuh{w0XfifwVD3aIN_F`uA=HfuFJLAXS=?_oe{DT zSt*v)^}^-6)4Xli2t=Rv184{R5ovlvXc~1t=C;fVmj|$|^I@y-yVk+$&3O!3$+m@g zt1x}!RDoC8-S`a-5zNJwTR^q7bzQ z!nmRx*TPqhP^3W<4Gm%-q?-uM_BvrjC`L(w(n=~Jx?7Bv=nU{!d_-amboacPxJ@S>;+@ZR_*@DaEt_6Zz zzyZ#QPHIMS8st*OJ6{<*tvimOlgJO9nM%F$Y?tM zv;YPeq$)FH33CKaG5V`$+yvLVQ*@M{1&}5I{t1J>Dd$io)z~-t=Ch&E&C^|#> z&rY4Am4BMr=}=ZRp{4Ye5s0QV6L85$nn#$D!J-~+*3z{#O{7t!>LppgLu^`x4+8~Q z<(_Iw7fkY>|Af^=vMRER*qsaUcD*9p5{~y>O6%7 z53qpjhW7#pK(n6&m?>XV$ypj$byctUl_Mnk1w3*p2#|%+@FI&(hAP0JnT6qxXAXJ{3gh(o|mJh6Lfn|j{O#{qSl5bTfU;l`YzirP6(4FNl^7vbwP(cO%WWp{X zBd~zi^3%A3G^KdQ`&OeSqm^`tCw1;XsmaPtbQS>abtikv1H`nSME&Cey1QRpc6Yp% zy$n`^BBdL_p&Hu#2cm$$2NeXDyD$amC8tW^U0T?}1^5B{@^}lKz$Fb}$myb___t(8 z7OLHKXh>IZ-+uCw!U@3cZWPQu)_B+=_E^$nTZkLqelC^!C2j#UtAdXj8J$!bB54|s z$=TRrV0&PJ6x%6Z1_W}yDn4$Jk8EV8fF&0&h+}Qw(IVNg)~3EaF_Q&(fD{k)xPNpp zm#4Wr(MW4JaQKyEWhaDoqL#@kfN+b4tYr&O*v04MXPpnnf+H4VWmZW4GihJs;5Bo1 zmzX881uSgN2)psHq~Gyw*vW;tCAXMh*n-w=?%zav2KKyMe5%6{u%&%MhCL%f%+UBE|)s)B(F z9OD!SxW8k5Y`BJep#ZMr!nvJdm}0t;vPS23QAu-*o6_Jg=P1tq0c>mjc2@zXl(!`9 z`{HSuQ2t&0C?aE)hN=3cKPtW9a_1VEG69*yQMC63RA&e_xG)bzy-PIrF~oZHVV zdD_$d@M%^P)|cio-&bDfffwB696ve*Bx%`(!hO!_gtd_8ymep3oZxkzIl=wyOnp9{ z^8R#dSV7H8y7`&Y-Q_w5q%H?7_#?X;xl)~`r(r5q zOmaT#G^cya>pS@tUsm`ZUG^<+Db*L7-Rvcg{0cDNb)@4n=2FgJiWNEdU9M@f#CWnkrY+4g(w tH*WzrZ!b`Qsz(7FXK*TjZVLEM^_Fh@W(06`H3Fw`FK2O@2LT}f06R|f{l@?R diff --git a/makefile b/makefile index bde26ed1..9440b2da 100755 --- a/makefile +++ b/makefile @@ -321,7 +321,7 @@ joytest.exe: $(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 diff --git a/src/lib/16_head.c b/src/lib/16_head.c index f48a09c8..7f46743e 100755 --- a/src/lib/16_head.c +++ b/src/lib/16_head.c @@ -34,6 +34,73 @@ filesize(FILE *fp) return(size_of_file); } +//from http://stackoverflow.com/questions/2736753/how-to-remove-extension-from-file-name +// remove_ext: removes the "extension" from a file spec. +// mystr is the string to process. +// dot is the extension separator. +// sep is the path separator (0 means to ignore). +// Returns an allocated string identical to the original but +// with the extension removed. It must be freed when you're +// finished with it. +// If you pass in NULL or the new string can't be allocated, +// it returns NULL. + +char *remove_ext (char* mystr, char dot, char sep) { + char *retstr, *lastdot, *lastsep; + + // Error checks and allocate string. + + if (mystr == NULL) + return NULL; + if ((retstr = malloc (strlen (mystr) + 1)) == NULL) + return NULL; + + // Make a copy and find the relevant characters. + + strcpy (retstr, mystr); + lastdot = strrchr (retstr, dot); + lastsep = (sep == 0) ? NULL : strrchr (retstr, sep); + + // If it has an extension separator. + + if (lastdot != NULL) { + // and it's before the extenstion separator. + + if (lastsep != NULL) { + if (lastsep < lastdot) { + // then remove it. + + *lastdot = '\0'; + } + } else { + // Has extension separator with no path separator. + + *lastdot = '\0'; + } + } + + // Return the modified string. + + return retstr; +} + +//from http://quiz.geeksforgeeks.org/c-program-cyclically-rotate-array-one/ +void rotateR(byte *arr, byte n) +{ + byte x = arr[n-1], i; + for (i = n-1; i > 0; i--) + arr[i] = arr[i-1]; + arr[0] = x; +} + +void rotateL(byte *arr, byte n) +{ + byte x = arr[n+1], i; + for (i = n+1; i > 0; i++) + arr[i] = arr[i+1]; + arr[0] = x; +} + void printmeminfoline(byte *strc, const byte *pee, size_t h_total, size_t h_used, size_t h_free) { byte str[64]; diff --git a/src/lib/16_head.h b/src/lib/16_head.h index aad7a554..134def28 100755 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -198,6 +198,9 @@ typedef union REGPACK regs_t; /* local function */ long int filesize(FILE *fp); +char *remove_ext(char* mystr, char dot, char sep); +void rotateR(byte arr[], byte n); +void rotateL(byte arr[], byte n); void printmeminfoline(byte *strc, const byte *pee, size_t h_total, size_t h_used, size_t h_free); int US_CheckParm(char *parm,char **strings); byte dirchar(byte in); diff --git a/src/lib/16_map.c b/src/lib/16_map.c index 3d97e863..a304ca2d 100755 --- a/src/lib/16_map.c +++ b/src/lib/16_map.c @@ -32,7 +32,7 @@ int jsoneq(const char *json, jsmntok_t *tok, const char *s) { return -1; } -//this function is quite messy ^^; sorry! it is a quick and dirty fix~ +/*//this function is quite messy ^^; sorry! it is a quick and dirty fix~ word dump(const char *js, jsmntok_t *t, size_t count, word indent, char *js_sv, map_t *map, dword q) { dword i; word j;//, k; @@ -53,18 +53,18 @@ word dump(const char *js, jsmntok_t *t, size_t count, word indent, char *js_sv, if (count == 0) { return 0; } - /* We may want to do strtol() here to get numeric value */ + // We may want to do strtol() here to get numeric value //0000fprintf(stderr, "t->type=%d\n", t->type); if (t->type == JSMN_PRIMITIVE) { if(strstr(js_sv, "data")) { - /* - here we should recursivly call dump again here to skip over the array until we get the facking width of the map. - so we can initiate the map which allocates the facking map->tiles->data->data properly and THEN we can return - here to read the data.... That is my design for this... wwww + // + // here we should recursivly call dump again here to skip over the array until we get the width of the map. + // so we can initiate the map which allocates the facking map->tiles ->data->data properly and THEN we can return + // here to read the data.... That is my design for this... wwww - FUCK well i am stuck.... wwww - */ + // well i am stuck.... wwww + // map->data[q] = (byte)atoi(js+t->start); #ifdef DEBUG_MAPDATA fprintf(stdout, "%d[%d]", q, map->data[q]); @@ -87,7 +87,7 @@ word dump(const char *js, jsmntok_t *t, size_t count, word indent, char *js_sv, #endif } return 1; - /* We may use strndup() to fetch string value */ + // We may use strndup() to fetch string value } else if (t->type == JSMN_STRING) { if(jsoneq(js, t, "data") == 0) { @@ -101,8 +101,8 @@ word dump(const char *js, jsmntok_t *t, size_t count, word indent, char *js_sv, // bp = bitmapLoadPcx("data/koishi^^.pcx"); map->tiles->btdata = &bp; //---- map->tiles->data = planar_buf_from_bitmap(&bp); - //map->tiles->data->data = malloc((16/**2*/)*16); - //map->tiles->data->width = (16/**2*/); + //map->tiles->data->data = malloc((16)*16); + //map->tiles->data->width = (16/); //map->tiles->data->height= 16; map->tiles->tileHeight = 16; map->tiles->tileWidth = 16; @@ -164,10 +164,10 @@ int loadmap(char *mn, map_t *map, global_game_variables_t *gvar) FILE *fh = fopen(mn, "r"); - /* Prepare parser */ + // Prepare parser jsmn_init(&p); - /* Allocate some tokens as a start */ + // Allocate some tokens as a start //0000fprintf(stderr, "tok malloc\n"); tok = malloc(sizeof(*tok) * tokcount); if (tok == NULL) { @@ -176,7 +176,7 @@ int loadmap(char *mn, map_t *map, global_game_variables_t *gvar) } for (;;) { - /* Read another chunk */ + // Read another chunk //0000fprintf(stderr, "read\n"); r = fread(buf, 1, sizeof(buf), fh); if (r < 0) { @@ -205,9 +205,9 @@ int loadmap(char *mn, map_t *map, global_game_variables_t *gvar) again: //0000fprintf(stdout, " parse~ tok=%zu jslen=%zu r=%d _memavl()=%u BUFSIZ=%d~\n", tokcount, jslen, r, _memavl(), BUFSIZ); //0000fprintf(stdout, "p=[%u] [%u] [%d]\n", p.pos, p.toknext, p.toksuper); -/* - 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 -*/ +// +// 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 = jsmn_parse(&p, js, jslen, tok, tokcount); //0000fprintf(stdout, "r= [%d]\n", r); if (r < 0) { @@ -246,17 +246,18 @@ again: //fclose(fh); return 0; -} +}*/ void extract_map(const char *js, jsmntok_t *t, size_t count, map_t *map) { int i, j, k, indent=0, inner_end; + char *s; //bitmap_t bp; i = 0; while(ilayerdata = malloc(sizeof(byte*) * t[i].size); +// map->layerdata = malloc(sizeof(byte*) * t[i].size); inner_end = t[i].end; k = 0; while(t[i].start < inner_end) { @@ -268,13 +269,12 @@ void extract_map(const char *js, jsmntok_t *t, size_t count, map_t *map) { printf("Layer %d data: [\n", k); #endif map->layerdata[k] = malloc(sizeof(byte) * t[i+1].size); + //for backwards compatibility for rest of code map->data = map->layerdata[k]; for(j = 0; j < t[i+1].size; j++) { map->layerdata[k][j] = (byte)atoi(js + t[i+2+j].start); - //for backwards compatibility for rest of code -// map->data[j] = map->layerdata[k][j];//(byte)atoi(js + t[i+2+j].start);//(byte)atoi(js+t->start); #ifdef DEBUG_MAPDATA - //printf("[%d,%d]%d", k, j, map->layerdata[k][j]); + //printf("[%d,%d]%d", k, j, map->MAPDATAPTK[j]); fprintf(stdout, "%c", map->data[j]+44); #endif } @@ -290,32 +290,32 @@ void extract_map(const char *js, jsmntok_t *t, size_t count, map_t *map) { } if(jsoneq(js, &(t[i]), "tilesets") == 0) { i++; - map->tiles = malloc(sizeof(tiles_t*) * t[i].size); inner_end = t[i].end; k = 0; while(t[i].start < inner_end) { if(jsoneq(js, &(t[i]), "image") == 0) { - map->layertile[k] = malloc(sizeof(tiles_t)); - //Fix to load tileset specified. + map->MAPTILESPTK = malloc(sizeof(tiles_t)); + s = remove_ext((char *)js+t[i+1].start, '.', '/'); + strcpy(map->MAPTILESPTK->imgname, s); //And move to vrs, probably // bp = bitmapLoadPcx("data/ed.pcx"); -// map->layertile[k]->btdata = &bp; - map->layertile[k]->btdata = malloc(sizeof(bitmap_t)); - map->layertile[k]->tileHeight = 16; - map->layertile[k]->tileWidth = 16; - map->layertile[k]->rows = 1; - map->layertile[k]->cols = 1; +// map->MAPTILESPTK->btdata = &bp; + //map->MAPTILESPTK->btdata = malloc(sizeof(bitmap_t)); + map->MAPTILESPTK->rows = 1; + map->MAPTILESPTK->cols = 1; #ifdef __DEBUG_MAP__ dbg_maptext=false; #endif - map->tiles->btdata = map->layertile[k]->btdata; - map->tiles->tileHeight = 16; - map->tiles->tileWidth = 16; - map->tiles->rows = 1; - map->tiles->cols = 1; - k++; + i++; + }else if(jsoneq(js, &(t[i]), "tileheight") == 0) { + map->MAPTILESPTK->tileHeight = atoi(js + t[i+1].start); + i++; + }else if(jsoneq(js, &(t[i]), "tilewidth") == 0) { + map->MAPTILESPTK->tileWidth = atoi(js + t[i+1].start); + i++; } i++; + k++; } } diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index 1a8a2972..2ff2229d 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -46,9 +46,9 @@ void Startup16(global_game_variables_t *gvar) // DOSLIB: what CPU are we using? // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. - // So this code by itself shouldn't care too much what CPU it's running on. Except that other - // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for - // the CPU to carry out tasks. --J.C. + // So this code by itself shouldn't care too much what CPU it's running on. Except that other + // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for + // the CPU to carry out tasks. --J.C. cpu_probe(); // DOSLIB: check for VGA @@ -125,10 +125,10 @@ void Shutdown16(global_game_variables_t *gvar) /*void ReadConfig(void) { - int file; - SDMode sd; - SMMode sm; - SDSMode sds; + int file; + SDMode sd; + SMMode sm; + SDSMode sds; if ( (file = open(configname,O_BINARY | O_RDONLY)) != -1) @@ -227,7 +227,7 @@ void Shutdown16(global_game_variables_t *gvar) /*void WriteConfig(void) { - int file; + int file; file = open(configname,O_CREAT | O_BINARY | O_WRONLY, S_IREAD | S_IWRITE | S_IFREG); @@ -275,9 +275,9 @@ void DebugMemory_(global_game_variables_t *gvar, boolean q) US_CPrint ("Memory Usage"); US_CPrint ("------------"); - US_Print ("Total :"); + US_Print ("Total :"); US_PrintUnsigned (mminfo.mainmem/1024); - US_Print ("k\nFree :"); + US_Print ("k\nFree :"); US_PrintUnsigned (MM_UnusedMemory()/1024); US_Print ("k\nWith purge:"); US_PrintUnsigned (MM_TotalFree()/1024); @@ -326,7 +326,7 @@ void ClearMemory (global_game_variables_t *gvar) void Quit (global_game_variables_t *gvar, char *error) { - //unsigned finscreen; + //unsigned finscreen; memptr screen=0; ClearMemory (gvar); @@ -372,6 +372,7 @@ void Quit (global_game_variables_t *gvar, char *error) } //=========================================================================== + #ifndef __WATCOMC__ char global_temp_status_text[512]; char global_temp_status_text2[512]; @@ -409,7 +410,7 @@ void turboXT(byte bakapee) out 61h, al //; Turn speaker on mov cx, 2000h @@delay: - loop @@delay + loop @@delay pop ax out 61h, al //; Turn speaker off pop cx diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index f200f059..a07d5ec3 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -71,7 +71,14 @@ if(IN_KeyDown(sc_Z)){ DRAWCORNERBOXES } \ if(IN_KeyDown(sc_X)){ TESTBG12 } \ if(IN_KeyDown(sc_C)){ TESTBG34 } \ - if(IN_KeyDown(sc_V)) VL_PatternDraw(&gvar.video, 0, 1, 1); + if(IN_KeyDown(sc_V)) VL_PatternDraw(&gvar.video, 0, 1, 1); \ + if(IN_KeyDown(sc_I)){ dbg_maptext=!dbg_maptext; IN_UserInput(1,1); } +/* if(IN_KeyDown(sc_PgDn)){ \ + rotateR(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \ + VL_UpdatePaletteWrite(&gvar.video.palette, 0); IN_UserInput(1,1); } \ + if(IN_KeyDown(sc_PgUp)){ \ + rotateL(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \ + VL_UpdatePaletteWrite(&gvar.video.palette, 0); IN_UserInput(1,1); }*/ void DebugMemory_(global_game_variables_t *gvar, boolean q); void Shutdown16(global_game_variables_t *gvar); diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 3f839204..4c338111 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -50,10 +50,10 @@ typedef struct { typedef struct { byte far **data; - word ntiles; /* the number of tiles */ - word twidth; /* width of the tiles */ - word theight; /* height of the tiles */ - byte *palette; /* palette for the tile set */ + word ntiles; // the number of tiles + word twidth; // width of the tiles + word theight; // height of the tiles + byte *palette; // palette for the tile set } tileset_t; typedef struct { @@ -64,31 +64,48 @@ typedef struct { byte *palette; } planar_buf_t; +//===========================================================================// + //TODO: 16_mm and 16_ca must handle this typedef struct { - bitmap_t far *btdata; //old - planar_buf_t far *data; //old - word tileHeight, tileWidth; + bitmap_t far *pcximg; //I will probibaly use this --sparky4 + //planar_buf_t far *pbdata; //old + word tileHeight, tileWidth; //defined by mapfile unsigned int rows, cols; -// #ifdef __DEBUG__ -// boolean debug_text; //show the value of the tile! wwww -// byte *debug_data; -// #endif -} tiles_t; + byte imgname[8]; //image file of tileset (set to 8 because DOS ^^;) +} tiles_t; //seems to be the tileset properties //TODO: 16_mm and 16_ca must handle this //TODO: add variables from 16_ca +//#define __NEWMAPTILEDATAVARS__ +#define MAPLAYERS 4 +#ifdef __NEWMAPTILEDATAVARS__ +#define MAPTILESPTR layertile[0] +#define MAPTILESPTK layertile[k] +#define MAPDATAPTR layerdata[0] +#define MAPDATAPTK layerdata[k] +#else +#define MAPTILESPTR tiles//layertile[0] +#define MAPTILESPTK tiles//layertile[k] +#define MAPDATAPTR data//layerdata[0] +#define MAPDATAPTK data//layerdata[k] +#endif typedef struct { //long planestart[3]; //unsigned planelength[3]; byte *data; //TODO: 16_mm and 16_ca must handle this - byte * far *layerdata; //TODO: 16_mm and 16_ca must handle this + byte far *layerdata[MAPLAYERS]; // mapdata for multilayer (map index values for rendering which image on the tile) +#ifndef __NEWMAPTILEDATAVARS__ tiles_t *tiles; //TODO: 16_mm and 16_ca must handle this - tiles_t * far *layertile; //TODO: 16_mm and 16_ca must handle this +#else + tiles_t far *layertile[MAPLAYERS]; // tilesets for layers (currently ony 4 can be loaded wwww) +#endif int width, height; //this has to be signed! - char name[16]; + byte name[16]; } map_t; +//===================================// + typedef struct{ word tw; /* screen width in tiles */ word th; /* screen height in tiles */ @@ -98,12 +115,12 @@ typedef struct{ sword tilemidposscreeny; /* middle tile y position */ /* needed for scroll system to work accordingly */ sword tileplayerposscreenx; /* player position on screen */ /* needed for scroll and map system to work accordingly */ sword tileplayerposscreeny; /* player position on screen */ /* needed for scroll and map system to work accordingly */ -} tileinfo_t; +} pagetileinfo_t; typedef struct { nibble/*word*/ id; /* the Identification number of the page~ For layering~ */ byte far* data; /* the data for the page */ - tileinfo_t ti; + pagetileinfo_t ti; word dx; /* col we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the left size */ word dy; /* row we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the top size */ word sw; /* screen width */ /* resolution */ diff --git a/src/lib/16_vl.c b/src/lib/16_vl.c index ec5c9f0a..f241fb6e 100755 --- a/src/lib/16_vl.c +++ b/src/lib/16_vl.c @@ -689,18 +689,7 @@ modexLoadPalFile(byte *filename, byte **palette) { void VL_LoadPalFile(const char *filename, byte *palette) { - int fd; - - fd = open(filename,O_RDONLY|O_BINARY); - if (fd >= 0) { - word i; - - read(fd,palette, PAL_SIZE); - close(fd); - - vga_palette_lseek(0); - for (i=0;i < 256;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2); - } + VL_LoadPalFilewithoffset(filename, palette, 0); } void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o) @@ -709,16 +698,19 @@ void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o) fd = open(filename,O_RDONLY|O_BINARY); if (fd >= 0) { - word i; - read(fd,palette, PAL_SIZE); close(fd); - vga_palette_lseek(o); - for (i=o;i < 256-o;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2); + VL_UpdatePaletteWrite(palette, o); } } +void VL_UpdatePaletteWrite(byte *palette, word o) +{ + word i; + vga_palette_lseek(/*1+*/o); + for (i=o;i < 256-o;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2); +} void modexSavePalFile(char *filename, byte *pal) { @@ -867,15 +859,20 @@ void modexDrawChar(page_t *page, int x/*for planar selection only*/, word t, wor } } -void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str) +void modexprint(page_t *page, sword x, sword y, word t, boolean tlsw, word col, word bgcol, const byte *str) { word s, o, w; - word x_draw = x; + word x_draw; //word addr = (word) romFontsData.l; - word addrq = (page->stridew) * y + (x / 4) + ((word)page->data); - word addrr = addrq; + word addrq; + word addrr; byte c; + if(tlsw){ x-=page->tlx; y-=page->tly; } + x_draw = x/4; + addrq = (page->stridew) * y + (word)(x_draw) + + ((word)page->data); + addrr = addrq; s=romFonts[t].seg; o=romFonts[t].off; w=romFonts[t].charSize; @@ -883,16 +880,16 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons for(; *str != '\0'; str++) { - c = (*str); - if(c=='\n') - { - x = x_draw; - romFontsData.chw = 0; - addrq += (page->stridew) * 8; - addrr = addrq; - y += 8; - continue; - } + c = (*str); + if(c=='\n') + { + x = x_draw; + romFontsData.chw = 0; + addrq += (page->stridew) * 8; + addrr = addrq; + y += 8; + continue; + } // load the character into romFontsData.l // no need for inline assembly! @@ -902,6 +899,7 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons x_draw += 8; /* track X for edge of screen */ addrr += 2; /* move 8 pixels over (2 x 4 planar pixels per byte) */ } + //printf("print xy:%dx%d tlxy:%dx%d\n", x, y, page->tlx, page->tly); } void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str) @@ -1004,8 +1002,8 @@ void modexpdump(page_t *pee) int palq=(mult)*TILEWH; int palcol=0; int palx, paly; - for(paly=0; paly0)&&((*i)-q)%3==0 && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) outp(PAL_DATA_REG, p[(*i)-q]); else diff --git a/src/lib/16_vlpal.h b/src/lib/16_vlpal.h index 755cbe22..f97c4fd4 100755 --- a/src/lib/16_vlpal.h +++ b/src/lib/16_vlpal.h @@ -1,12 +1,9 @@ #ifndef __16_VLPAL_H__ #define __16_VLPAL_H__ +#include "src/lib/16_vlpald.h" #include "src/lib/16_vl.h" -#define BEVERBOSEPALCHECK - -#ifdef BEVERBOSEPALCHECK -#endif typedef struct { @@ -15,6 +12,9 @@ typedef struct word offset; } imgtestpal_t; +void VL_modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqpp); void VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset); +//void chkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z); + #endif //__16_VLPAL_H__ diff --git a/src/lib/16_vlpal_.c b/src/lib/16_vlpal_.c deleted file mode 100755 index f38e3edb..00000000 --- a/src/lib/16_vlpal_.c +++ /dev/null @@ -1,330 +0,0 @@ -/* 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 , 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)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)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)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; lqdata[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(aqcoor = rand()%256; // modexcls(page, pee->coor, VGA); colorz(page, pee); - modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi"); + modexprint(page, page->sw/2, page->sh/2, 1, 0, 47, 0, "bakapi"); break; case 7: if(pee->coor <= pee->hgq) @@ -294,7 +294,7 @@ void ding(page_t *page, bakapee_t *pee, word q) break; case 8: colorz(page, pee); - modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi"); + modexprint(page, page->sw/2, page->sh/2, 1, 0, 47, 0, "bakapi"); break; case 9: if(pee->coor <= pee->hgq) diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index d44fadea..5c732737 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -37,7 +37,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) //right movement case 3: 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 && - !(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! + !(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! { player[pn].walktype=2; if(player[pn].enti.q<=player[pn].enti.spt) @@ -48,7 +48,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; } } - 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)) + 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)) { player[pn].walktype=1; if(player[pn].enti.q<=player[pn].enti.spt) @@ -70,7 +70,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) //left movement case 1: 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 && - !(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! + !(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! { player[pn].walktype=2; if(player[pn].enti.q<=player[pn].enti.spt) @@ -81,7 +81,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; } } - 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)) + 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)) { player[pn].walktype=1; if(player[pn].enti.q<=player[pn].enti.spt) @@ -103,7 +103,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) //down movement case 4: 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 && - !(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! + !(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! { player[pn].walktype=2; if(player[pn].enti.q<=player[pn].enti.spt) @@ -114,7 +114,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; } } - 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)) + 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)) { player[pn].walktype=1; if(player[pn].enti.q<=player[pn].enti.spt) @@ -136,7 +136,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) //up movement case 0: 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 && - !(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! + !(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! { player[pn].walktype=2; if(player[pn].enti.q<=player[pn].enti.spt) @@ -147,7 +147,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; } } - 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)) + 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)) { player[pn].walktype=1; if(player[pn].enti.q<=player[pn].enti.spt) @@ -318,8 +318,8 @@ initMap(map_t *map) { i=0; for(y=0; yheight; y++) { for(x=0; xwidth; x++) { - map->data[i]=255; -// printf("[%d]", map->data[i]); + map->MAPDATAPTR[i]=255; +// printf("[%d]", map->MAPDATAPTR[i]); tile = tile ? 0 : 1; i++; } @@ -337,7 +337,7 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) ScrollRight(mv, player, id, plid); /* draw the next column */ - x= mv[0].page->sw + mv[0].map->tiles->tileWidth; + x= mv[0].page->sw + mv[0].map->MAPTILESPTR->tileWidth; #ifndef FULLRCREND if(player[plid].enti.q%4) #else @@ -347,7 +347,7 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) mapDrawCol(&mv[id], mv[0].tx + mv[0].page->ti.tw, mv[0].ty-1, x, player, DRAWCOLNUM); // else // if(mv[0].video->bgps) -// modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[0].map->tiles->tileWidth, mv[0].page->height); +// modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[0].map->MAPTILESPTR->tileWidth, mv[0].page->height); //mv[0].video->dorender=1;//ScrollRight } @@ -369,7 +369,7 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) mapDrawCol(&mv[id], mv[0].tx - 1, mv[0].ty-1, x, player, DRAWCOLNUM); // else // if(mv[0].video->bgps) -// modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[0].map->tiles->tileWidth, mv[0].page->height); +// modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[0].map->MAPTILESPTR->tileWidth, mv[0].page->height); //mv[0].video->dorender=1;//ScrollLeft } @@ -391,7 +391,7 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) mapDrawRow(&mv[id], mv[0].tx - 1, mv[0].ty-1, y, player, DRAWROWNUM); // else // if(mv[0].video->bgps) -// modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->tiles->tileHeight); +// modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->MAPTILESPTR->tileHeight); //mv[0].video->dorender=1;//ScrollUp } @@ -403,7 +403,7 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) ScrollDown(mv, player, id, plid); /* draw the next row */ - y= mv[0].page->sh + mv[0].map->tiles->tileHeight; + y= mv[0].page->sh + mv[0].map->MAPTILESPTR->tileHeight; #ifndef FULLRCREND if(player[plid].enti.q%3) #else @@ -413,7 +413,7 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) mapDrawRow(&mv[id], mv[0].tx - 1, mv[0].ty+mv[0].page->ti.th, y, player, DRAWROWNUM); // else // if(mv[0].video->bgps) -// modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->tiles->tileHeight); +// modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[0].page->width, mv[0].map->MAPTILESPTR->tileHeight); //mv[0].video->dorender=1;//ScrollDown } @@ -498,16 +498,16 @@ sword chkmap(map_t *map, word q) //initiate a null map! map->width=MAPW;///2; map->height=MAPH;///2; -// map->data = malloc(((map->width*map->height)+1)*sizeof(byte)); - map->data = &x; - map->tiles = malloc(sizeof(tiles_t)); +// map->MAPDATAPTR = malloc(((map->width*map->height)+1)*sizeof(byte)); + map->MAPDATAPTR = &x; + map->MAPTILESPTR = malloc(sizeof(tiles_t)); //fix this to be far~ // bp = bitmapLoadPcx("data/ed.pcx"); -// map->tiles->data = &bp; - map->tiles->tileHeight = 16; - map->tiles->tileWidth = 16; - map->tiles->rows = 1; - map->tiles->cols = 1; +// map->MAPTILESPTR->data = &bp; + map->MAPTILESPTR->tileHeight = 16; + map->MAPTILESPTR->tileWidth = 16; + map->MAPTILESPTR->rows = 1; + map->MAPTILESPTR->cols = 1; #ifdef __DEBUG_MAP__ dbg_maptext = true; #endif @@ -538,12 +538,12 @@ void ZC_mapinitMV(map_view_t *mv, int tx, int ty) /* set up the coordinates */ mv[0].tx = mv[1].tx = tx; mv[0].ty = mv[1].ty = ty; - mv[0].page->dx = mv[1].page->dx = mv[2].page->dx = mv[3].page->dx = mv->map->tiles->tileWidth; - mv[0].page->dy = mv[1].page->dy = mv[2].page->dy = mv[3].page->dy = mv->map->tiles->tileHeight; + mv[0].page->dx = mv[1].page->dx = mv[2].page->dx = mv[3].page->dx = mv->map->MAPTILESPTR->tileWidth; + mv[0].page->dy = mv[1].page->dy = mv[2].page->dy = mv[3].page->dy = mv->map->MAPTILESPTR->tileHeight; /* set up the thresholds */ - mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileWidth * 2; - mv[0].dyThresh = mv[1].dyThresh = mv[2].dyThresh = mv[3].dyThresh = mv->map->tiles->tileHeight * 2; + mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->MAPTILESPTR->tileWidth * 2; + mv[0].dyThresh = mv[1].dyThresh = mv[2].dyThresh = mv[3].dyThresh = mv->map->MAPTILESPTR->tileHeight * 2; } void ZC_mapredraw(map_view_t *mv, int tx, int ty) @@ -553,7 +553,7 @@ void ZC_mapredraw(map_view_t *mv, int tx, int ty) py=0; i=mv[0].ty * mv[0].map->width + mv[0].tx; - 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) { + 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) { mapDrawWRow(&mv[0], tx-1, ty, py); mapDrawWRow(&mv[1], tx-1, ty, py); i+=mv->map->width - tx; @@ -563,44 +563,30 @@ void ZC_mapredraw(map_view_t *mv, int tx, int ty) void near mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) { - word rx; - word ry; + word rx, ry; //word textx=0, texty=0; //if(i==0) i=2; - if(i==0) +// printf("%02d ", i); if(x >= page->width - t->tileWidth) printf("\n"); + switch(i) { - //wwww - modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, 1); //currently the over scan color! - } - else - { - rx = (((i-1) % ((t->data->width)/t->tileWidth)) * t->tileWidth); - ry = (((i-1) / ((t->data->height)/t->tileHeight)) * t->tileHeight); -////0000printf("i=%d\n", i); -#ifdef __DEBUG_MAP__ - switch(dbg_maptext) - { - case 0: -#endif + case 0: + //wwww + modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, 1); //currently the over scan color! + break; + default: + rx = (((i-1) % ((t->pcximg->width)/t->tileWidth)) * t->tileWidth); + ry = (((i-1) / ((t->pcximg->height)/t->tileHeight)) * t->tileHeight); #ifndef TILERENDER - if(!pagenorendermap) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, i+1); - sprintf(global_temp_status_text2, "%d", i); - modexprint(page, x, y, 1, 1, 2, global_temp_status_text2); + if(!pagenorendermap) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, i+1); #else - modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, i); - /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */ - //draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); - //modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); + modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, i); + //draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); + //modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); #endif #ifdef __DEBUG_MAP__ - break; - case 1: - if(!pagenorendermap) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, i); - sprintf(global_temp_status_text2, "%d", i); - modexprint(page, x, y, 1, 1, 2, global_temp_status_text2); - break; - } + if(dbg_maptext){ sprintf(global_temp_status_text2, "%u", i); modexprint(page, x, y, 1, 0, 1, 2, global_temp_status_text2); } #endif + break; } } @@ -610,12 +596,12 @@ void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *player, w if(pagedelayrendermap) if(!y) y+=TILEWH; else y-=TILEWH; poopoffset%=player[0].enti.speed; //printf("y: %d\n", poopoffset); -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); } +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); } /* the position within the map array */ i=ty * mv->map->width + tx; - for( mv->dx=poopoffset; mv->dx<(mv->page->sw+mv->dxThresh)/(poopoffset+1) && tx < mv->map->width; mv->dx+=mv->map->tiles->tileWidth, tx++) { + for( mv->dx=poopoffset; mv->dx<(mv->page->sw+mv->dxThresh)/(poopoffset+1) && tx < mv->map->width; mv->dx+=mv->map->MAPTILESPTR->tileWidth, tx++) { if(i>=0) - mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, mv->dx, y); + mapDrawTile(mv->map->MAPTILESPTR, mv->map->MAPDATAPTR[i], mv->page, mv->dx, y); i++; /* next! */ } if(pagedelayrendermap) delay(200); @@ -627,14 +613,14 @@ void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *player, w if(pagedelayrendermap) if(!x) x+=TILEWH; else x-=TILEWH; poopoffset%=player[0].enti.speed; //printf("x: %d\n", poopoffset); -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); } +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); } /* location in the map array */ i=ty * mv->map->width + tx; /* We'll copy all of the columns in the screen, i + 1 row above and one below */ - for( mv->dy=poopoffset; mv->dy<(mv->page->sh+mv->dyThresh)/(poopoffset+1) && ty < mv->map->height; mv->dy+=mv->map->tiles->tileHeight, ty++) { + for( mv->dy=poopoffset; mv->dy<(mv->page->sh+mv->dyThresh)/(poopoffset+1) && ty < mv->map->height; mv->dy+=mv->map->MAPTILESPTR->tileHeight, ty++) { if(i>=0) - mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, mv->dy); + mapDrawTile(mv->map->MAPTILESPTR, mv->map->MAPDATAPTR[i], mv->page, x, mv->dy); i += mv->map->width; } if(pagedelayrendermap) delay(200); @@ -646,9 +632,9 @@ void mapDrawWRow(map_view_t *mv, int tx, int ty, word y) /* the position within the map array */ i=ty * mv->map->width + tx; - for(mv->dx=0; mv->dxpage->sw+mv->dxThresh && tx < mv->map->width; mv->dx+=mv->map->tiles->tileWidth, tx++) { + for(mv->dx=0; mv->dxpage->sw+mv->dxThresh && tx < mv->map->width; mv->dx+=mv->map->MAPTILESPTR->tileWidth, tx++) { if(i>=0) /* we are in the map, so copy! */ - mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, mv->dx, y); + mapDrawTile(mv->map->MAPTILESPTR, mv->map->MAPDATAPTR[i], mv->page, mv->dx, y); i++; /* next! */ } } @@ -662,26 +648,21 @@ void mapDrawWCol(map_view_t *mv, int tx, int ty, word x) /* We'll copy all of the columns in the screen, i + 1 row above and one below */ - for(mv->dy=0; mv->dypage->sh+mv->dyThresh && ty < mv->map->height; mv->dy+=mv->map->tiles->tileHeight, ty++) { + for(mv->dy=0; mv->dypage->sh+mv->dyThresh && ty < mv->map->height; mv->dy+=mv->map->MAPTILESPTR->tileHeight, ty++) { if(i>=0) /* we are in the map, so copy away! */ - mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, mv->dy); + mapDrawTile(mv->map->MAPTILESPTR, mv->map->MAPDATAPTR[i], mv->page, x, mv->dy); i += mv->map->width; } } -/*void qclean() -{ - //setkb(0); -}*/ - boolean pagenorendermap = 0; boolean pagedelayrendermap = 0; /* sync */ void shinku(global_game_variables_t *gv) { - word x = gv->video.page[/*!*/(gv->video.p)].dx - (gv->video.page[(gv->video.p)].tlx); // follow the screen - word y = gv->video.page[/*!*/(gv->video.p)].dy - (gv->video.page[(gv->video.p)].tly); // follow the screen + word x = gv->video.page[/*!*/(gv->video.p)].dx; //(gv->video.page[(gv->video.p)].tlx) - // follow the screen + word y = gv->video.page[/*!*/(gv->video.p)].dy; //(gv->video.page[(gv->video.p)].tly) - // follow the screen word col = 2, bgcol = 1, type = 1;//w = 64, h = 8, if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second)) { @@ -693,7 +674,14 @@ void shinku(global_game_variables_t *gv) // // This fixes *** Null pointer assignment detected error message in ZCROLL.EXE on exit. sprintf(global_temp_status_text, "%.0f fps", (double)gv->kurokku.tiku/ticktock(gv)); - modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, col, bgcol, global_temp_status_text); + //modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, 1, col, bgcol, global_temp_status_text); + modexCopyPageRegion(&gv->video.page[0], &gv->video.page[1], + gv->video.page[/*!*/(gv->video.p)].dx, + gv->video.page[/*!*/(gv->video.p)].dy, + gv->video.page[/*!*/(gv->video.p)].dx, + gv->video.page[/*!*/(gv->video.p)].dy, + 96, 16); + modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, 1, col, bgcol, global_temp_status_text); //0000printf("dx=%u dy=%u\n", gv->video.page[/*!*/(gv->video.p)].dx, gv->video.page[/*!*/(gv->video.p)].dy); gv->kurokku.tiku=0; }else //copy dat sheet @@ -702,7 +690,7 @@ void shinku(global_game_variables_t *gv) switch(gv->kurokku.fpscap) { case 0: //turn this off if XT - //modexprint(&(gv->video.page[0]), x, y+8, type, col, bgcol, "sanic!"); + //modexprint(&(gv->video.page[0]), x, y+8, type, 1, col, bgcol, "sanic!"); gv->kurokku.frames_per_second=1; break; case 1: @@ -751,7 +739,7 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn) break; } x-=4; - y-=pip[0].map->tiles->tileHeight; + y-=pip[0].map->MAPTILESPTR->tileHeight; switch (player[pn].enti.d) { case 0: diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index efe02d9b..fc187954 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -81,7 +81,7 @@ #define SCROLLEXITMESG printf("page[0]dxy: %dx%d", gvar.video.page[0].dx, gvar.video.page[0].dy);\ printf("\n\n");\ printf("player vars:\n");\ - 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))]);\ + 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))]);\ 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);\ printf(" pdir: %u\n", player[0].pdir); printf(" delay=%u", player[0].enti.spri->delay);\ printf("\n\n");\ @@ -132,7 +132,7 @@ inline void near ScrollRight(map_view_t *mv, player_t *player, word id, word pli /* Snap the origin forward */ mv[id].page->data += 4; - mv[id].page->dx = mv[id].map->tiles->tileWidth; + mv[id].page->dx = mv[id].map->MAPTILESPTR->tileWidth; } } @@ -149,7 +149,7 @@ inline void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid /* Snap the origin backward */ mv[id].page->data -= 4; - mv[id].page->dx = mv[id].map->tiles->tileWidth; + mv[id].page->dx = mv[id].map->MAPTILESPTR->tileWidth; } } @@ -166,7 +166,7 @@ inline void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid) /* Snap the origin upward */ mv[id].page->data -= mv[id].page->pi; - mv[id].page->dy = mv[id].map->tiles->tileHeight; + mv[id].page->dy = mv[id].map->MAPTILESPTR->tileHeight; } } @@ -183,7 +183,7 @@ inline void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid /* Snap the origin downward */ mv[id].page->data += mv[id].page->pi; - mv[id].page->dy = mv[id].map->tiles->tileHeight; + mv[id].page->dy = mv[id].map->MAPTILESPTR->tileHeight; } } diff --git a/src/maptest.c b/src/maptest.c index c73ea3dd..deef4c7c 100755 --- a/src/maptest.c +++ b/src/maptest.c @@ -32,6 +32,9 @@ main(int argc, char *argv[]) #ifdef DUMP #ifdef DUMP_MAP short i; +#ifdef __NEWMAPTILEDATAVARS__ + word k; +#endif #endif #endif char *fmt = "Memory available = %u\n"; @@ -58,15 +61,24 @@ main(int argc, char *argv[]) fprintf(stdout, "map.height= %d\n", map.height); #ifdef DUMP_MAP //if(map.width*map.height != 1200) - for(i=0; i<(map.width*map.height); i++) +#ifdef __NEWMAPTILEDATAVARS__ + for(k=0;kdata[(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)) + 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)) { short i; for(i=800; i>=400; i--) diff --git a/src/zcroll.c b/src/zcroll.c index f2e803f3..342f3ba5 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -104,7 +104,15 @@ void main(int argc, char *argv[]) VGAmodeX(1/*bakapee*/, 1, &gvar); /* load color palette */ + /*ptmp.offset=(paloffset/3); + modexPalUpdate(&ptmp, &paloffset, 0, 0); + //modexClearRegion(bg->page, 0, 0, 320, 240, 255); + //printf(" %d\n", sizeof(ptmp.data)); + //printf("1: %d\n", paloffset); + map.tiles->data->offset=(paloffset/3); + modexPalUpdate(map.tiles->data, &paloffset, 0, 0);*/ VL_LoadPalFile(bakapee1p, &gvar.video.palette); + //VL_LoadPalFile("data/default.pal", &gvar.video.palette); #ifdef FADE gpal = modexNewPal(); @@ -139,6 +147,7 @@ void main(int argc, char *argv[]) gvar.video.page[0].tlx=mv[0].tx*TILEWH; gvar.video.page[0].tly=mv[0].ty*TILEWH; shinku(&gvar); +//modexpdump(mv[0].page); #ifdef FADE modexFadeOn(4, gpal); #endif @@ -163,7 +172,7 @@ void main(int argc, char *argv[]) //the scripting stuff.... //if(((player[0].enti.triggerx == TRIGGX && player[0].enti.triggery == TRIGGY) && IN_KeyDown(0x1C))||(player[0].enti.tx == 5 && player[0].enti.ty == 5)) - 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)) + 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)) { short i; for(i=800; i>=400; i--) @@ -175,8 +184,8 @@ void main(int argc, char *argv[]) if(player[0].enti.q == (TILEWH/(player[0].enti.speed))+1 && player[0].info.dir != 2 && (player[0].enti.triggerx == 5 && player[0].enti.triggery == 5)){ player[0].enti.hp--; } //debugging binds! - if(IN_KeyDown(24)){ modexPalUpdate0(gpal); /*paloffset=0;*/ modexpdump(mv[0].page); IN_UserInput(1,1); } //o - if(IN_KeyDown(22)){ modexPalUpdate0(gpal); } //u + if(IN_KeyDown(24)){ modexPalUpdate0(&gvar.video.palette); /*paloffset=0;*/ modexpdump(mv[0].page); IN_UserInput(1,1); } //o + if(IN_KeyDown(22)){ modexPalUpdate0(&gvar.video.palette); } //u FUNCTIONKEYFUNCTIONS FUNCTIONKEYDRAWJUNK -- 2.39.2