From b852f11c4e5353371ae074f6e3b5e9dedcdbd8c7 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Sat, 22 Nov 2014 11:55:12 -0600 Subject: [PATCH] new file: 16/modex16/ptmp.pcx modified: 16/modex16/scroll.c modified: 16/modex16/scroll.exe working on scroll thingy i am confused --- 16/modex16/ptmp.pcx | Bin 0 -> 929 bytes 16/modex16/scroll.c | 132 +++++++++++++++++++++++++++++------------- 16/modex16/scroll.exe | Bin 18766 -> 19188 bytes 3 files changed, 91 insertions(+), 41 deletions(-) create mode 100644 16/modex16/ptmp.pcx diff --git a/16/modex16/ptmp.pcx b/16/modex16/ptmp.pcx new file mode 100644 index 0000000000000000000000000000000000000000..879e70c290e421070df45c09d121804d437f05f8 GIT binary patch literal 929 zcmd;LW#nK00)8L_gZ~hUXp&KYfsvtv=@BE*I#3i|V89P~7)W&xit(eI(GVD_ArPKa IwPni|04k0X`v3p{ literal 0 HcmV?d00001 diff --git a/16/modex16/scroll.c b/16/modex16/scroll.c index 55e2fe94..42655ffa 100644 --- a/16/modex16/scroll.c +++ b/16/modex16/scroll.c @@ -11,7 +11,7 @@ typedef struct { word tileWidth; unsigned int rows; unsigned int cols; - unsigned int tilex,tiley; // tile position on the map + //unsigned int tilex,tiley; // tile position on the map } tiles_t; @@ -34,9 +34,11 @@ typedef struct { word dyThresh; //???? } map_view_t; -struct { - int tx; //player position on the viewable map - int ty; //player position on the viewable map +struct { + int x; //player exact position on the viewable map + int y; //player exact position on the viewable map + int tx; //player tile position on the viewable map + int ty; //player tile position on the viewable map } player; @@ -56,15 +58,13 @@ void mapDrawCol(map_view_t *mv, int tx, int ty, word x); #define SPEED 2 //place holder definitions -#define MAPX 40 -#define MAPY 30 +#define MAPX 24 +#define MAPY 19 //#define SWAP(a, b) tmp=a; a=b; b=tmp; void main() { -// int show1=1; - int tx, ty; - int x, y; - //int ch=0x0; -// byte ch; + bitmap_t bmp; +// int tx, ty; +// int x, y; int q=0; page_t screen;//,screen2; map_t map; @@ -72,23 +72,17 @@ void main() { map_view_t *draw;//, *show, *tmp; byte *ptr; - //default player position on the viewable map - player.tx = 10; - player.ty = 8; - setkb(1); /* create the map */ map = allocMap(MAPX,MAPY); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly initMap(&map); mv.map = ↦ - - //initiate bottem right edge trigger -// mv.ttx = mv.tx + 20; -// mv.tty = mv.ty + 15; // mv2.map = ↦ /* draw the tiles */ - ptr = map.data; + ptr = map.data; + bmp = bitmapLoadPcx("ptmp.pcx"); // load sprite + modexPalUpdate(bmp.palette); modexEnter(); screen = modexDefaultPage(); screen.width += (TILEWH*2); @@ -106,57 +100,113 @@ void main() { mapGoTo(draw, 0, 0); //TODO: set player position data here according to the viewable map screen thingy + //default player position on the viewable map + player.tx = draw->tx + 10; + player.ty = draw->ty + 8; + player.x = player.tx*TILEWH; + player.y = player.ty*TILEWH; modexShowPage(draw->page); - while(!keyp(1)) { + while(!keyp(1)) + { //TODO: top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square //to stop scrolling and have the player position data move to the edge of the screen with respect to the direction - //when player.tx or player.ty == 0 or player.tx == 20 or player.ty == 15 then stop because that is edge of map and you do not want to walk of the map - if(keyp(77)){ - if(draw->tx >= 0 && draw->tx+20 < MAPX) - for(q=0; q<(TILEWH/SPEED); q++) { + //when player.tx or player.ty == 0 or player.tx == 20 or player.ty == 15 then stop because that is edge of map and you do not want to walk of the map + if(keyp(77)) + { + if(draw->tx >= 0 && draw->tx+20 <= MAPX && player.tx == draw->tx + 10) + { + for(q=0; q<(TILEWH/SPEED); q++) + { mapScrollRight(draw, SPEED); modexShowPage(draw->page); // mapScrollRight(draw, 1); // SWAP(draw, show); } - + } + else if(player.tx < draw->tx+20 && player.tx >= draw->tx + 10)// && player.tx <= draw->tx+10) + { + for(q=0; q<(TILEWH/SPEED); q++) + { + player.x+=SPEED; + modexDrawBmp(draw->page, player.x, player.y, &bmp); + modexShowPage(draw->page); + } + player.tx++; + } } if(keyp(75)){ - if(draw->tx > 0 && draw->tx+20 <= MAPX) - for(q=0; q<(TILEWH/SPEED); q++) { + if(draw->tx >= 0 && draw->tx+20 <= MAPX && player.tx == draw->tx + 10) + { + for(q=0; q<(TILEWH/SPEED); q++) + { mapScrollLeft(draw, SPEED); modexShowPage(draw->page); // mapScrollLeft(show, 1); // SWAP(draw, show); } - + } + else if(player.tx > 0 && player.tx <= draw->tx + 10)// && player.tx >= draw->tx+10) + { + for(q=0; q<(TILEWH/SPEED); q++) + { + player.x-=SPEED; + modexDrawBmp(draw->page, player.x, player.y, &bmp); + modexShowPage(draw->page); + } + player.tx--; + } } - if(keyp(80)){ - if(draw->ty >= 0 && draw->ty+15 < MAPY) - for(q=0; q<(TILEWH/SPEED); q++) { + if(keyp(80)) + { + if(draw->ty >= 0 && draw->ty+15 <= MAPY && player.ty == draw->ty + 8) + { + for(q=0; q<(TILEWH/SPEED); q++) + { mapScrollDown(draw, SPEED); modexShowPage(draw->page); // mapScrollDown(show, 1); // SWAP(draw, show); } - + } + else if(player.ty < draw->ty+15 && player.ty >= draw->ty + 8)// && player.ty <= draw->ty+8) + { + for(q=0; q<(TILEWH/SPEED); q++) + { + player.y+=SPEED; + modexDrawBmp(draw->page, player.x, player.y, &bmp); + modexShowPage(draw->page); + } + player.ty++; + } } - if(keyp(72)){ - if(draw->ty > 0 && draw->ty+15 <= MAPY) - for(q=0; q<(TILEWH/SPEED); q++) { + if(keyp(72)) + { + if(draw->ty >= 0 && draw->ty+15 <= MAPY && player.ty == draw->ty + 8) + { + for(q=0; q<(TILEWH/SPEED); q++) + { mapScrollUp(draw, SPEED); modexShowPage(draw->page); // mapScrollUp(show, 1); // SWAP(draw, show); } - + } + else if(player.ty > 0 && player.ty <= draw->ty + 8)// && player.ty >= draw->ty+8) + { + for(q=0; q<(TILEWH/SPEED); q++) + { + player.y-=SPEED; + modexDrawBmp(draw->page, player.x, player.y, &bmp); + modexShowPage(draw->page); + } + player.ty--; + } } - - //keyp(ch); + modexDrawBmp(draw->page, player.x, player.y, &bmp); //modexShowPage(draw->page); } @@ -166,8 +216,8 @@ void main() { printf("Project 16 scroll.exe\n"); printf("tx: %d\n", draw->tx); printf("ty: %d\n", draw->ty); - //printf("ttx: %d\n", draw->ttx); - //printf("tty: %d\n", draw->tty); + printf("player.tx: %d\n", player.tx); + printf("player.ty: %d\n", player.ty); } diff --git a/16/modex16/scroll.exe b/16/modex16/scroll.exe index 7b65f2fe5ba4e7e60270ee9cff412a1624e6c84a..e8303da0321b9eaf4429a0758dfa0042874661fc 100755 GIT binary patch delta 3193 zcmZuz4Ny~87QXkr5&r2&^Yq@IXO(xB@IFeDDX>HBczHz=!s~ACgG{p zBJ>tKBk*uB2wnDle++)h)(8nXNPIo2vSMe|?p@@cj;Uk;Bk?)4I|>Q0sJ(tpJjb+~ z=fr7=67#5CSP#-^@lphDo)r&-i=3jp{+8IUXgA*?=CSs}qYm>_Lgskp)pql!cvZ%m zKa&TePJ!jk6LKZ$bhA!@Ju4fz*4f26-7Jjnf@(}$r<8CT)h!-dp0FK>wJ@`0@+Gns zPvgUK4a$o}_9S5K5Y4~|tSv5c*3BR?C#JA`2_xQ6m>rAC#wlOX;3AnF-Ym@n zF81WiSzh-p>)^UrhSzpUe(mMc;?qG=0B0b;gde3Vz2^}67Yt!-K_8^62Dgk(*FPG ztj&HuZ3`o<{@E3DNZTDqdj(iZ+mZgi!1D^paq|kW%FX`Q%ElCvUw<$DN}lNvePO~T zWDyG^9Q};nCKF6mz-Qb>v!=VjMD?tL6}0~pbH z3+Qd^_oR>tELKlr! zrQsgBU9}qM)2iQr=N(mA;zzJkzh_~CXU{cRLs~ygaB$pb) zlb*VZdDRSVxoDHMj9d2$K}g)9%Jg*J#ho+QSCNO2t;`8FTClllE0k_>=6Hr@If4Rm zX+n*6B)1S1I1#YxjzNMEb$IkmNiV$Y*WJb4IyD^(j}OXK1WUlZJ@o7Fgv1_&_-2^1 zU$KevD2$|pah`{1pEQ*<<@YL-)@b2xG+VtL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