From e837acbc8cbdf0c936753e7ecfd7623eb60a71e2 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Sat, 20 Jun 2015 19:39:38 -0500 Subject: [PATCH] added more proffessional header files deleted: 16.c modified: Project 16.bfproject modified: scroll.exe new file: src/16.c new file: src/16.h new file: src/lib/scroll16.c new file: src/lib/scroll16.h modified: src/lib/types.h --- 16.c | 254 ------------------------------------------- Project 16.bfproject | 23 ++-- scroll.exe | Bin 60109 -> 60109 bytes src/16.c | 27 +++++ src/16.h | 27 +++++ src/lib/scroll16.c | 25 +++++ src/lib/scroll16.h | 27 +++++ src/lib/types.h | 21 ++++ 8 files changed, 140 insertions(+), 264 deletions(-) delete mode 100644 16.c create mode 100644 src/16.c create mode 100644 src/16.h create mode 100644 src/lib/scroll16.c create mode 100644 src/lib/scroll16.h diff --git a/16.c b/16.c deleted file mode 100644 index 31dc5fb7..00000000 --- a/16.c +++ /dev/null @@ -1,254 +0,0 @@ -include "src\lib\scroll.h" -void main() { - bitmap_t ptmp; // player sprite - word q=1; - const char *cpus; - static int persist_aniframe = 0; /* gonna be increased to 1 before being used, so 0 is ok for default */ - page_t screen, screen2, screen3; - map_t map; - map_view_t mv, mv2, mv3; - map_view_t *bg, *spri, *mask;//, *tmp; - byte *ptr; - - /* 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 = ↦ - mv2.map = ↦ - mv3.map = ↦ - - /* draw the tiles */ - ptr = map.data; - /*data\\*/ - ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite - setkb(1); - modexEnter(); - modexPalUpdate(ptmp.palette); - screen = modexDefaultPage(); - screen.width += (TILEWH*2); - screen.height += (TILEWH*2)+QUADWH; - mv.page = &screen; - screen2 = modexNextPage(mv.page); - mv2.page = &screen2; - screen3 = screen2; - mv3.page = &screen3; - - /* set up paging */ - bg = &mv; - spri = &mv2; - mask = &mv3; - -//TODO: LOAD map data and position the map in the middle of the screen if smaller then screen - mapGoTo(bg, 0, 0); - mapGoTo(spri, 0, 0); - //mapGoTo(mask, 0, 0); - - //TODO: put player in starting position of spot - //default player position on the viewable map - player.tx = bg->tx + 10; - player.ty = bg->ty + 8; - player.x = player.tx*TILEWH; - player.y = player.ty*TILEWH; - player.triggerx = player.tx; - player.triggery = player.ty+1; - //TODO: erase player initial draw - modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp); - //temp draw trigger box - modexClearRegion(spri->page, player.triggerx*16, player.triggery*16, 16, 16, 1); - modexClearRegion(bg->page, player.triggerx*16, player.triggery*16, 16, 16, 1); - modexShowPage(spri->page); - while(!keyp(1))//!keyp(1)) - { - //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 - - #define INC_PER_FRAME if(q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1; - - if(keyp(77) && !keyp(75)) - { - if(bg->tx >= 0 && bg->tx+20 < MAPX && player.tx == bg->tx + 10 && !(player.tx+1 == TRIGGX && player.ty == TRIGGY)) - { - for(q=1; q<=(TILEWH/SPEED); q++) - { - INC_PER_FRAME; - //animatePlayer(bg, spri, mask, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp); - animatePlayer(bg, spri, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp); - mapScrollRight(bg, SPEED, q); - mapScrollRight(spri, SPEED, q); - //mapScrollRight(mask, SPEED); - modexShowPage(spri->page); - } - player.tx++; - } - else if(player.tx < MAPX && !(player.tx+1 == TRIGGX && player.ty == TRIGGY)) - { - for(q=1; q<=(TILEWH/SPEED); q++) - { - INC_PER_FRAME; - player.x+=SPEED; - //animatePlayer(bg, spri, mask, 1, 0, player.x, player.y, persist_aniframe, q, &ptmp); - animatePlayer(bg, spri, 1, 0, player.x, player.y, persist_aniframe, q, &ptmp); - modexShowPage(spri->page); - } - player.tx++; - } - else - { - modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32); - modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 32, 24, 32, &ptmp); - modexShowPage(spri->page); - } - player.triggerx = player.tx+1; - player.triggery = player.ty; - } - - if(keyp(75) && !keyp(77)) - { - if(bg->tx > 0 && bg->tx+20 <= MAPX && player.tx == bg->tx + 10 && !(player.tx-1 == TRIGGX && player.ty == TRIGGY)) - { - for(q=1; q<=(TILEWH/SPEED); q++) - { - INC_PER_FRAME; - //animatePlayer(bg, spri, mask, 3, 1, player.x, player.y, persist_aniframe, q, &ptmp); - animatePlayer(bg, spri, 3, 1, player.x, player.y, persist_aniframe, q, &ptmp); - mapScrollLeft(bg, SPEED, q); - mapScrollLeft(spri, SPEED, q); - //mapScrollLeft(mask, SPEED); - modexShowPage(spri->page); - } - player.tx--; - } - else if(player.tx > 1 && !(player.tx-1 == TRIGGX && player.ty == TRIGGY)) - { - for(q=1; q<=(TILEWH/SPEED); q++) - { - INC_PER_FRAME; - player.x-=SPEED; - //animatePlayer(bg, spri, mask, 3, 0, player.x, player.y, persist_aniframe, q, &ptmp); - animatePlayer(bg, spri, 3, 0, player.x, player.y, persist_aniframe, q, &ptmp); - modexShowPage(spri->page); - } - player.tx--; - } - else - { - modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32); - modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 96, 24, 32, &ptmp); - modexShowPage(spri->page); - } - player.triggerx = player.tx-1; - player.triggery = player.ty; - } - - if(keyp(80) && !keyp(72)) - { - if(bg->ty >= 0 && bg->ty+15 < MAPY && player.ty == bg->ty + 8 && !(player.tx == TRIGGX && player.ty+1 == TRIGGY)) - { - for(q=1; q<=(TILEWH/SPEED); q++) - { - INC_PER_FRAME; - //animatePlayer(bg, spri, mask, 2, 1, player.x, player.y, persist_aniframe, q, &ptmp); - animatePlayer(bg, spri, 2, 1, player.x, player.y, persist_aniframe, q, &ptmp); - mapScrollDown(bg, SPEED, q); - mapScrollDown(spri, SPEED, q); - //mapScrollDown(mask, SPEED); - modexShowPage(spri->page); - } - player.ty++; - } - else if(player.ty < MAPY && !(player.tx == TRIGGX && player.ty+1 == TRIGGY)) - { - for(q=1; q<=(TILEWH/SPEED); q++) - { - INC_PER_FRAME; - player.y+=SPEED; - //animatePlayer(bg, spri, mask, 2, 0, player.x, player.y, persist_aniframe, q, &ptmp); - animatePlayer(bg, spri, 2, 0, player.x, player.y, persist_aniframe, q, &ptmp); - modexShowPage(spri->page); - } - player.ty++; - } - else - { - modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32); - modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp); - modexShowPage(spri->page); - } - player.triggerx = player.tx; - player.triggery = player.ty+1; - } - - if(keyp(72) && !keyp(80)) - { - if(bg->ty > 0 && bg->ty+15 <= MAPY && player.ty == bg->ty + 8 && !(player.tx == TRIGGX && player.ty-1 == TRIGGY)) - { - for(q=1; q<=(TILEWH/SPEED); q++) - { - INC_PER_FRAME; - //animatePlayer(bg, spri, mask, 0, 1, player.x, player.y, persist_aniframe, q, &ptmp); - animatePlayer(bg, spri, 0, 1, player.x, player.y, persist_aniframe, q, &ptmp); - mapScrollUp(bg, SPEED, q); - mapScrollUp(spri, SPEED, q); - //mapScrollUp(mask, SPEED); - modexShowPage(spri->page); - } - player.ty--; - } - else if(player.ty > 1 && !(player.tx == TRIGGX && player.ty-1 == TRIGGY)) - { - for(q=1; q<=(TILEWH/SPEED); q++) - { - INC_PER_FRAME; - player.y-=SPEED; - //animatePlayer(bg, spri, mask, 0, 0, player.x, player.y, persist_aniframe, q, &ptmp); - modexShowPage(spri->page); - animatePlayer(bg, spri, 0, 0, player.x, player.y, persist_aniframe, q, &ptmp); - } - player.ty--; - } - else - { - modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32); - modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 0, 24, 32, &ptmp); - modexShowPage(spri->page); - } - player.triggerx = player.tx; - player.triggery = player.ty-1; - } - //modexClearRegion(mask->page, 66, 66, 2, 40, 0); - - if((player.triggerx == TRIGGX && player.triggery == TRIGGY) && keyp(KEY_ENTER)) - { - short i; - for(i=600; i>=400; i--) - { - sound(i); - } - nosound(); - } - } - - modexLeave(); - setkb(0); - printf("Project 16 scroll.exe\n"); - printf("tx: %d\n", bg->tx); - printf("ty: %d\n", bg->ty); - printf("player.x: %d\n", player.x); - printf("player.y: %d\n", player.y); - printf("player.tx: %d\n", player.tx); - printf("player.ty: %d\n", player.ty); - printf("player.triggx: %d\n", player.triggerx); - printf("player.triggy: %d\n", player.triggery); - printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n"); - printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n"); - printf("\n"); - switch(detectcpu()) - { - case 0: cpus = "8086/8088 or 186/88"; break; - case 1: cpus = "286"; break; - case 2: cpus = "386 or newer"; break; - default: cpus = "internal error"; break; - } - printf("detected CPU type: %s\n", cpus); -} diff --git a/Project 16.bfproject b/Project 16.bfproject index 478acf62..bf9de3ac 100644 --- a/Project 16.bfproject +++ b/Project 16.bfproject @@ -3,26 +3,26 @@ e2c.convert_num: 0 openfiles: /dos/z/16/doc/project.txt:138:0:0: openfiles: /dos/z/16/src/palettec.c:179:0:0: openfiles: /dos/z/16/src/pcxtest.c:141:0:0: -openfiles: /dos/z/16/src/scroll.c:6670:5844:0: +openfiles: /dos/z/16/src/scroll.c:2181:1209:0: openfiles: /dos/z/16/src/fmemtest.c:116:0:0: openfiles: /dos/z/16/src/emmtest.c:439:0:0: openfiles: /dos/z/16/src/emsdump.c:59:0:0: -openfiles: /dos/z/16/src/maptest.c:62:0:0: +openfiles: /dos/z/16/src/maptest.c:64:0:0: openfiles: /dos/z/16/src/maptest0.c:366:0:0: openfiles: /dos/z/16/src/test.c:0:0:0: openfiles: /dos/z/16/src/test2.c:0:0:0: -openfiles: /dos/z/16/src/lib/modex16.c:2760:2448:0: +openfiles: /dos/z/16/src/lib/modex16.c:2759:2367:0: openfiles: /dos/z/16/src/lib/modex16.h:1279:866:0: openfiles: /dos/z/16/src/lib/planar.h:131:0:0: openfiles: /dos/z/16/src/lib/PLANAR.C:0:0:0: openfiles: /dos/z/16/src/lib/bitmap.c:1152:604:0: openfiles: /dos/z/16/src/lib/bitmap.h:257:0:0: -openfiles: /dos/z/16/src/lib/dos_kb.c:3264:2407:1: +openfiles: /dos/z/16/src/lib/dos_kb.c:2857:2407:0: openfiles: /dos/z/16/src/lib/dos_kb.h:0:0:0: openfiles: /dos/z/16/src/lib/mapread.c:2265:1988:0: openfiles: /dos/z/16/src/lib/mapread.h:585:0:0: openfiles: /dos/z/16/src/lib/fmapread.c:5968:4541:0: -openfiles: /dos/z/16/src/lib/fmapread.h:437:0:0: +openfiles: /dos/z/16/src/lib/fmapread.h:240:0:0: openfiles: /dos/z/16/src/lib/exmm/memory.c:308:99:0: openfiles: /dos/z/16/src/lib/exmm/memory.h:0:0:0: openfiles: /dos/z/16/src/lib/exmm/emmsize.h:0:0:0: @@ -30,9 +30,11 @@ openfiles: /dos/z/16/src/lib/exmm/emmret.h:0:0:0: openfiles: /dos/z/16/src/lib/jsmn/farjsmn.c:7182:6673:0: openfiles: /dos/z/16/src/lib/jsmn/farjsmn.h:861:381:0: openfiles: /dos/z/16/src/lib/lib_head.c:0:0:0: -openfiles: /dos/z/16/src/lib/lib_head.h:2786:1937:0: -openfiles: /dos/z/16/makefile:2533:2399:0: -openfiles: /dos/z/16/src/lib/types.h:274:0:0: +openfiles: /dos/z/16/src/lib/lib_head.h:2786:1673:0: +openfiles: /dos/z/16/makefile:2533:2173:0: +openfiles: /dos/z/16/src/lib/types.h:528:0:0: +openfiles: /dos/z/16/src/16.h:850:0:0: +openfiles: /dos/z/16/src/16.c:854:0:1: snr_recursion_level: 0 convertcolumn_horizontally: 0 adv_open_matchname: 0 @@ -44,7 +46,7 @@ view_left_panel: 0 default_mime_type: text/plain e2c.convert_xml: 1 c2e.convert_iso: 0 -opendir: file:///dos/z/16/src +opendir: file:///dos/z/16 wrap_text_default: 0 bookmarks_filename_mode: 1 ssearch_text: mapscrollr @@ -81,7 +83,6 @@ recent_files: file:///dos/z/16/src/emstest.c recent_files: file:///dos/z/16/src/lib/exmm/x.bat recent_files: file:///dos/z/16/src/lib/jsmn/jsmn.c recent_files: file:///dos/z/16/src/lib/jsmn/jsmn.h -recent_files: file:///dos/z/16/src/lib/modex16.c recent_files: file:///dos/z/16/doc/project.txt recent_files: file:///dos/z/16/src/palettec.c recent_files: file:///dos/z/16/src/pcxtest.c @@ -114,6 +115,8 @@ recent_files: file:///dos/z/16/src/lib/jsmn/farjsmn.h recent_files: file:///dos/z/16/src/lib/exmm/emmsize.h recent_files: file:///dos/z/16/src/lib/lib_head.c recent_files: file:///dos/z/16/src/scroll.c +recent_files: file:///dos/z/16/src/lib/modex16.c +recent_files: file:///dos/z/16/16.c snr_replacetype: 0 savedir: file:///dos/z/16/src spell_check_default: 1 diff --git a/scroll.exe b/scroll.exe index bdbd9dfb58984fba78b4c9bd86b4c88037dc1aa2..26477f334d740cfd25e7a78379ffdb059ecaba54 100644 GIT binary patch delta 372 zcmX?mmHF&d<_))*SvVNVBPSo=6rF6%DKGS2U>6fZuiFp9+b@`Sb~7^UVw$YV;>XA_ z*^o_!*{z6aasZq3I>E-$H=rffQ_3GRYN^5T!S4{!%}v* zH7O8l^fr&!}x$Gf3#Eu-!0H7UvITab1Cg1100%ULDst1xL+#qrbm^9&;%gDL; z5|0%JJBO%{sF@?GcbwCRzq$y#caXMO%TaZ$Q=((Ir3@10Ms!MbV3! eA2q&lWjwR_{PDvqKx*=tXhBAW&F}Bt;{gD)8g&-{ delta 372 zcmX?mmHF&d<_))*Sy&j#BPSo=6rF6%DKGS2U>6HRuiFp9+b@`Sb~7^UVwtSU;>XA` z*^o_!*{z6WasZq3I>E-$H=ldfQ_3GRYN^5T!S4{!%}v* zH7O8l^fr&!}x$Gf3#Eu-!0H7UvITeBAea6Rcf0Xjd@$KcG?ww~)}dU^As c#y75v=Qf`|ewYPFO+FJX$f&XT{oQ*!08+ko&;S4c diff --git a/src/16.c b/src/16.c new file mode 100644 index 00000000..1dae6896 --- /dev/null +++ b/src/16.c @@ -0,0 +1,27 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * 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. + * + */ + +void +main(int argc, char *argv[]) +{ + +} diff --git a/src/16.h b/src/16.h new file mode 100644 index 00000000..37ae3b7f --- /dev/null +++ b/src/16.h @@ -0,0 +1,27 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * 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. + * + */ + +#ifndef __16_H_ +#define __16_H_ + + +#endif __16_H_ diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c new file mode 100644 index 00000000..0b517d12 --- /dev/null +++ b/src/lib/scroll16.c @@ -0,0 +1,25 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * 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. + * + */ +/* + scroll16 library~ +*/ +#include "src/lib/scroll.h" diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h new file mode 100644 index 00000000..b97a9f3c --- /dev/null +++ b/src/lib/scroll16.h @@ -0,0 +1,27 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * 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. + * + */ + +#ifndef __SCROLL16_H_ +#define __SCROLL16_H_ + + +#endif __SCROLL16_H_ diff --git a/src/lib/types.h b/src/lib/types.h index 039653f2..a0bc6317 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -1,3 +1,24 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * 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. + * + */ /* * Just some handy typedefs that make it easier to think about the low * level code -- 2.39.5