From d0b4d523e0a90d036da0512a224389bf40895c09 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Mon, 20 Jun 2016 10:49:50 -0500 Subject: [PATCH] readded OLD sprite drawing now for fixing the background stuff ww --- data/chikyuu.pcx | Bin 5522 -> 5522 bytes src/lib/16_in.h | 2 +- src/lib/bitmap.c | 2 +- src/lib/scroll16.h | 10 ++++++---- src/lib/typdefst.h | 2 +- src/pcxtest.c | 25 +++++++++++++++++++++++-- src/pcxtest2.c | 25 +++++++++++++++++++++++-- src/scroll.c | 24 +++++++++++++++++------- 8 files changed, 72 insertions(+), 18 deletions(-) diff --git a/data/chikyuu.pcx b/data/chikyuu.pcx index 5442787172b3f610fc6053b3611655599b443d54..83de56ba39c632ee07d470d9f92d59b0dd76852e 100755 GIT binary patch literal 5522 zcmeI0!EW0|5Qe!+Qer6S+AmT(FHyk#zM*W# zwkRRjB927QzcaI(o!$9&oW4z6#m`sOkJZccGAV!3Px`w0bfx~g*B zTBa6`NgjnHxXzC%K5K=I831WZoLy*LVTYPG z7WG}}mA9-4G*x?MXTqM>;1d2wXc^yEH$1QTnj?STFf!&pj^9!pDmH?=$TLp_A{)#p z!%TEajNFm*eRF@ZpNMX4vnov$ST>_;-WB#xi7G(LN@W;fX& zhoNP>Zc`5hVmhe5PkBK>ofCS)ULgRfy%bYY_VYfH?x<}IQ*Cum5CR*+iw7q#!|b+Y zPrzgzx-g8fqG;z>p&MC;h+W0V_|%Rrhp4fbLOr6Bkeqfzl8}7#C2WcDdWuWNW zccUS9sP~e{(7|9`f=4;Gu})#Ii_C;6PB0Sbz<~7;`Alj(6mzd93D^aRIqb=kfWo*C zRY~s&<4?*;q**m zsHx)iWbs z`}e7&J}%C#Y^XNR9>)=2RX;|Wrp>ssVyK~zDVg~KZ8yVi!iByW&;8oUJ&MkRTo}c1 ztw~vrttPVqNuW1YRyj-|f=<$&`seC)l06Pw=zw&ED3xs4L#8qaN)zWjq6%ED5UE7V zaOA!1=rB{l0!+pzGZ|34T!=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3@Ig;+^Z52~xcTWHU2ZPq&24?_-eI(TdpBkNN$8V+8gF@<G0#GPB!j$wL zH~zG3a5ATN_Ya`cyqIfI>0<)ly^|e(^z~zcU8z}*UgVf><0a1IJMo}~(KCvrx{6Oc z7=SMEH5z{0lG@|_m-z6Ln~6nFUZXTBBu`gA{VWN!ru@T-|Q6$AAl6@VJ5$O17LKTj>O?iSZs%0VY?FbfRr2 zUNoc2YzYdm8LRB1L-BH1WOyh@MC%72zz9466zGaZrU4&?3)6r*Qi#k%YRCe6O55Y; z6@%kseHT1Vde6;F>|mM!CqPErawr<~7@NDHXn#bJhoPt~+ZlI^Jg6*?jcg zj&`#+?pVH;oM6SkfHm5kGe=nt##rE7<|hh*)CEpBSTre=)eJcSGU=ioDRGb%dw{AQ zMH4B4t?y1?i%oo;=OhniT zI-|}q9^($c!u~`(PeYC&F|6aLqjq~QzmD+;t$9WgV#OkY5qYdQe-S2o#TfS|QN9mo z+VZ!d`ipPYU;fm+{Po*cKY#bbzpsCJ^Y`mluYdpR@b;hEH{bvE;lu5Rx3{;q4}V4a MOnuJ4|0M(e0madbJpcdz diff --git a/src/lib/16_in.h b/src/lib/16_in.h index beb6a3d3..186158ea 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -230,7 +230,7 @@ typedef struct //0000 planar_buf_t huge *data; //supposively the sprite sheet data // planar_buf_t data; //supposively the sprite sheet data ////0000---- - bitmap_t huge *data; //supposively the sprite sheet data + bitmap_t *data; //supposively the sprite sheet data sword hp; //hitpoints of the player int persist_aniframe; /* gonna be increased to 1 before being used, so 0 is ok for default */ CursorInfo info; diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c index 43321733..d2480baf 100755 --- a/src/lib/bitmap.c +++ b/src/lib/bitmap.c @@ -126,7 +126,7 @@ bitmapLoadPcx(char *filename) { result.data[index] = val; } } while(index < bufSize); - printf("index=%d\n", index); + //printf("index=%d\n", index); loadPcxPalette(file, &result); diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index f5218379..c8e4a1a8 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -38,12 +38,14 @@ #include #include -//#define SPRITE +#define SPRITE //#define TILERENDER -#define PBUFSFUN modexDrawSpritePBufRegion -#define PBUFBFUN modexDrawBmpPBufRegion -#define PLAYERBMPDATA &player[pn].data +//modexDrawSpritePBufRegion +//modexDrawBmpPBufRegion +#define PBUFSFUN modexDrawSpriteRegion +#define PBUFBFUN modexDrawBmpRegion +#define PLAYERBMPDATA player[pn].data typedef struct { map_t *map; diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index 2f8d7a45..da79ebc8 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -42,7 +42,7 @@ * typedefs of the game variables! */ typedef struct { - byte huge *data; + byte *data; word width; word height; byte *palette; diff --git a/src/pcxtest.c b/src/pcxtest.c index c05cff5f..99e2669e 100755 --- a/src/pcxtest.c +++ b/src/pcxtest.c @@ -37,9 +37,30 @@ void main() { int plane; float t1, t2; + // DOSLIB: check our environment + probe_dos(); + + // 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. + cpu_probe(); + + // DOSLIB: check for VGA + if (!probe_vga()) { + printf("VGA probe failed\n"); + return; + } + // hardware must be VGA or higher! + if (!(vga_state.vga_flags & VGA_IS_VGA)) { + printf("This program requires VGA or higher graphics hardware\n"); + return; + } + //0000 bmp = bitmapLoadPcx("data/koishi~~.pcx"); -// bmp = bitmapLoadPcx("data/chikyuu.pcx"); - bmp = bitmapLoadPcx("data/koishi^^.pcx"); + bmp = bitmapLoadPcx("data/chikyuu.pcx"); +// bmp = bitmapLoadPcx("data/koishi^^.pcx"); // bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx"); p = planar_buf_from_bitmap(&bmp); VGAmodeX(1, 1, &gvar); diff --git a/src/pcxtest2.c b/src/pcxtest2.c index 059b448a..aea2eb9a 100755 --- a/src/pcxtest2.c +++ b/src/pcxtest2.c @@ -62,9 +62,30 @@ void main() { int plane; float t1, t2; + // DOSLIB: check our environment + probe_dos(); + + // 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. + cpu_probe(); + + // DOSLIB: check for VGA + if (!probe_vga()) { + printf("VGA probe failed\n"); + return; + } + // hardware must be VGA or higher! + if (!(vga_state.vga_flags & VGA_IS_VGA)) { + printf("This program requires VGA or higher graphics hardware\n"); + return; + } + //0000 bmp = bitmapLoadPcx("data/koishi~~.pcx"); -// bmp = bitmapLoadPcx("data/chikyuu.pcx"); - bmp = bitmapLoadPcx("data/koishi^^.pcx"); + bmp = bitmapLoadPcx("data/chikyuu.pcx"); +// bmp = bitmapLoadPcx("data/koishi^^.pcx"); // bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx"); p = planar_buf_from_bitmap(&bmp); VGAmodeX(1, 1, &gvar); diff --git a/src/scroll.c b/src/scroll.c index cd143846..ff380454 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -28,15 +28,14 @@ #define MODEX //this is for mode x initiating //word far *clock= (word far*) 0x046C; /* 18.2hz clock */ - +bitmap_t *p; global_game_variables_t gvar; static map_t map; player_t player[MaxPlayers]; //page_t screen, gvar.video.page[1], gvar.video.page[2]; map_view_t mv[4]; -bitmap_t p; //word pn=0; //i forgot ww -static planar_buf_t huge *pp; +//static planar_buf_t huge *pp; float t; sword bakapee; pan_t pan; @@ -115,7 +114,11 @@ void main(int argc, char *argv[]) //mappalptr = map.tiles->btdata->palette; /* data */ - //++++p = bitmapLoadPcx("data/ptmp.pcx"); // load sprite + //++++ + p = malloc(48*128); + player[0].data = p; + *p = bitmapLoadPcx("data/chikyuu.pcx"); // load sprite + *player[0].data = bitmapLoadPcx("data/chikyuu.pcx"); // load sprite //npctmp = bitmapLoadPcx("ptmp1.pcx"); // load sprite /* create the planar buffer */ @@ -150,7 +153,7 @@ void main(int argc, char *argv[]) // printf("Total used @ before palette initiation: %zu\n", oldfreemem-GetFreeSize()); //++++ player[0].data.offset=(paloffset/3); //++++ modexPalUpdate1(&player[0].data, &paloffset, 0, 0); - //modexPalUpdate1(p.palette); + modexPalUpdate1(p->palette); //++++0000 modexPalUpdate1(map.tiles->btdata->palette); //printf(" %d\n", sizeof(ptmp->data)); //printf("1: %d\n", paloffset); @@ -190,12 +193,14 @@ void main(int argc, char *argv[]) IN_initplayer(&player, 0); //IN_initplayer(&player, 1); + modexDrawSprite(mv[0].page, 16, 16, p); + modexDrawSprite(mv[0].page, 32+48, 16, (player[0].data)); #ifndef SPRITE modexClearRegion(mv[0].page, player[0].x, player[0].y-TILEWH, 16, 32, 15); //modexClearRegion(mv[1].page, player[0].x, player[0].y-TILEWH, 16, 32, 15); #else //PBUFSFUN(mv[1].page, player[0].x, player[0].y-TILEWH, 16, 64, 24, 32, PLAYERBMPDATA); - PBUFSFUN(mv[0].page, player[0].x, player[0].y-TILEWH, 16, 64, 16, 32, &pp); + PBUFSFUN(mv[0].page, player[0].x, player[0].y-TILEWH, 16, 64, 16, 32, p); #endif if(!pageflipflop) modexShowPage(mv[1].page); @@ -262,7 +267,7 @@ void main(int argc, char *argv[]) #ifdef FADE if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); IN_UserInput(1,1); } if(IN_KeyDown(22)){ - paloffset=0; modexPalBlack(); modexPalUpdate(&player[0].data, &paloffset, 0, 0); + paloffset=0; modexPalBlack(); modexPalUpdate(player[0].data, &paloffset, 0, 0); printf("1paloffset = %d\n", paloffset/3); modexPalUpdate(map.tiles->data, &paloffset, 0, 0); printf("2paloffset = %d\n", paloffset/3); @@ -297,6 +302,11 @@ void main(int argc, char *argv[]) modexClearRegion(mv[3].page, 0, 128, 28, 36, 15); //IN_UserInput(1,1); } + if(IN_KeyDown(66)) //f8 + { + modexDrawSprite(mv[0].page, 16, 16, p); + modexDrawSprite(mv[0].page, 32+48, 16, (player[0].data)); + } //TODO fmemtest into page /*if(IN_KeyDown(4+1)) //4 { -- 2.39.5