From: sparky4 Date: Fri, 19 Jun 2015 03:45:48 +0000 (-0500) Subject: !! optimized 1 scroll function X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=e0bb448c52a976739f341c33a338a38447ab23b3;p=16.git !! optimized 1 scroll function modified: Project 16.bfproject modified: maptest.exe modified: pcxtest.exe modified: scroll.exe modified: src/scroll.c modified: test.exe modified: test2.exe --- diff --git a/Project 16.bfproject b/Project 16.bfproject index c5b969dd..ab8785b1 100644 --- a/Project 16.bfproject +++ b/Project 16.bfproject @@ -3,25 +3,25 @@ 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:20776:19775:0: +openfiles: /dos/z/16/src/scroll.c:22998:22397:1: openfiles: /dos/z/16/src/fmemtest.c:116:0:0: -openfiles: /dos/z/16/src/emmtest.c:732:0:0: +openfiles: /dos/z/16/src/emmtest.c:439:0:0: openfiles: /dos/z/16/src/emsdump.c:456:0:0: openfiles: /dos/z/16/src/maptest.c:463: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:2794:2497:1: -openfiles: /dos/z/16/src/lib/modex16.h:1062:586:0: +openfiles: /dos/z/16/src/lib/modex16.c:2760:2448:0: +openfiles: /dos/z/16/src/lib/modex16.h:1833: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:2448:0: +openfiles: /dos/z/16/src/lib/dos_kb.c:3264: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:584:0:0: -openfiles: /dos/z/16/src/lib/fmapread.c:5968:4626:0: +openfiles: /dos/z/16/src/lib/fmapread.c:5968:4541:0: openfiles: /dos/z/16/src/lib/fmapread.h:436: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: @@ -44,10 +44,10 @@ view_left_panel: 0 default_mime_type: text/plain e2c.convert_xml: 1 c2e.convert_iso: 0 -opendir: file:///dos/z/16/src/lib +opendir: file:///dos/z/16/src wrap_text_default: 0 bookmarks_filename_mode: 1 -ssearch_text: modexShowPage() +ssearch_text: drawcol snr_casesens: 0 view_blocks: 1 name: Project 16 @@ -77,41 +77,41 @@ 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/scroll.c +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/emmtest.c recent_files: file:///dos/z/16/src/pcxtest.c recent_files: file:///dos/z/16/src/fmemtest.c recent_files: file:///dos/z/16/src/emsdump.c recent_files: file:///dos/z/16/src/maptest.c -recent_files: file:///dos/z/16/src/maptest0.c +recent_files: file:///dos/z/16/src/emmtest.c recent_files: file:///dos/z/16/src/test.c -recent_files: file:///dos/z/16/src/test2.c +recent_files: file:///dos/z/16/src/lib/modex16.h recent_files: file:///dos/z/16/src/lib/planar.h -recent_files: file:///dos/z/16/src/lib/PLANAR.C +recent_files: file:///dos/z/16/src/maptest0.c +recent_files: file:///dos/z/16/src/lib/bitmap.h recent_files: file:///dos/z/16/src/lib/dos_kb.c +recent_files: file:///dos/z/16/src/lib/PLANAR.C recent_files: file:///dos/z/16/src/lib/dos_kb.h -recent_files: file:///dos/z/16/src/lib/mapread.h -recent_files: file:///dos/z/16/src/lib/fmapread.h -recent_files: file:///dos/z/16/src/lib/fmapread.c +recent_files: file:///dos/z/16/src/test2.c recent_files: file:///dos/z/16/src/lib/bitmap.c -recent_files: file:///dos/z/16/src/lib/bitmap.h recent_files: file:///dos/z/16/src/lib/mapread.c -recent_files: file:///dos/z/16/src/lib/exmm/emmsize.h -recent_files: file:///dos/z/16/src/lib/exmm/emmret.h +recent_files: file:///dos/z/16/src/lib/mapread.h +recent_files: file:///dos/z/16/src/lib/fmapread.c recent_files: file:///dos/z/16/src/lib/exmm/memory.c -recent_files: file:///dos/z/16/src/lib/jsmn/farjsmn.c +recent_files: file:///dos/z/16/src/lib/fmapread.h +recent_files: file:///dos/z/16/src/lib/exmm/emmret.h recent_files: file:///dos/z/16/src/lib/lib_head.h -recent_files: file:///dos/z/16/src/lib/jsmn/farjsmn.h -recent_files: file:///dos/z/16/src/lib/exmm/memory.h +recent_files: file:///dos/z/16/src/lib/types.h +recent_files: file:///dos/z/16/src/lib/jsmn/farjsmn.c recent_files: file:///dos/z/16/makefile +recent_files: file:///dos/z/16/src/lib/exmm/memory.h +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/lib/types.h -recent_files: file:///dos/z/16/src/lib/modex16.c -recent_files: file:///dos/z/16/src/lib/modex16.h +recent_files: file:///dos/z/16/src/scroll.c snr_replacetype: 0 -savedir: file:///dos/z/16/src/lib +savedir: file:///dos/z/16/src spell_check_default: 1 spell_insert_entities: 0 last_filefilter: @@ -121,13 +121,6 @@ snr_escape_chars: 0 htmlbar_view: 0 spell_lang: en ssearch_dotmatchall: 0 -searchlist: 0x3C4 -searchlist: SC_INDEX -searchlist: panswitch -searchlist: ++++ -searchlist: !! -searchlist: drawbmp -searchlist: move searchlist: next searchlist: bg searchlist: newde @@ -136,6 +129,13 @@ searchlist: (1) searchlist: map searchlist: screen, searchlist: modexShowPage() +searchlist: scrollright +searchlist: col +searchlist: dacol +searchlist: dcol +searchlist: drcol +searchlist: dracol +searchlist: drawcol autocomplete: 1 outputb_show_all_output: 0 bookmarks_show_mode: 0 diff --git a/maptest.exe b/maptest.exe index 4bddfea8..8c40dfa5 100644 Binary files a/maptest.exe and b/maptest.exe differ diff --git a/pcxtest.exe b/pcxtest.exe index da40e7ab..3a095beb 100644 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/scroll.exe b/scroll.exe index 7e8ed183..af5d7343 100644 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/scroll.c b/src/scroll.c index 29d7037d..e0a6efca 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -30,11 +30,16 @@ typedef struct { word d; //direction bitmap_t data; //supposively the sprite sheet data int hp; //hitpoints of the player -} actor_t; +} actor_t; + +typedef struct +{ + map_view_t *mv; +} map_view_db_t; map_t allocMap(int w, int h); void initMap(map_t *map); -void mapScrollRight(map_view_t *mv, byte offset); +void mapScrollRight(map_view_db_t *mvdb, byte offset, word id); void mapScrollLeft(map_view_t *mv, byte offest); void mapScrollUp(map_view_t *mv, byte offset); void mapScrollDown(map_view_t *mv, byte offset); @@ -72,7 +77,8 @@ void main() { page_t screen, screen2, screen3; map_t map; map_view_t mv, mv2, mv3; - map_view_t *bg, *spri, *mask;//, *tmp; + map_view_t *bg, *spri, *mask;//, *tmp; + map_view_db_t pgid[4]; byte *dpal, *gpal; byte *ptr; byte *mappalptr; @@ -201,7 +207,10 @@ void main() { /* set up paging */ bg = &mv; spri = &mv2; - mask = &mv3; + mask = &mv3; + pgid[0].mv = &mv; + pgid[1].mv = &mv2; + pgid[2].mv = &mv3; //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen mapGoTo(bg, 0, 0); @@ -256,8 +265,8 @@ void main() { INC_PER_FRAME; //animatePlayer(bg, spri, mask, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp); animatePlayer(bg, spri, player.d-1, 1, player.x, player.y, persist_aniframe, player.q, &ptmp); - mapScrollRight(bg, SPEED); - mapScrollRight(spri, SPEED); + mapScrollRight(pgid, SPEED, 0); + mapScrollRight(pgid, SPEED, 1); //mapScrollRight(mask, SPEED); modexShowPage(spri->page); player.q++; @@ -702,25 +711,27 @@ initMap(map_t *map) { void -mapScrollRight(map_view_t *mv, byte offset) { +mapScrollRight(map_view_db_t *mvdb, byte offset, word id) { word x, y; /* coordinate for drawing */ /* increment the pixel position and update the page */ - mv->page->dx += offset; + mvdb[id].mv->page->dx += offset; /* check to see if this changes the tile */ - if(mv->page->dx >= mv->dxThresh ) { + if(mvdb[id].mv->page->dx >= mvdb[id].mv->dxThresh ) { /* go forward one tile */ - mv->tx++; + mvdb[id].mv->tx++; /* Snap the origin forward */ - mv->page->data += 4; - mv->page->dx = mv->map->tiles->tileWidth; - //} + mvdb[id].mv->page->data += 4; + mvdb[id].mv->page->dx = mvdb[id].mv->map->tiles->tileWidth; /* draw the next column */ - x= SCREEN_WIDTH + mv->map->tiles->tileWidth; - if(mv->page->id==0) - mapDrawCol(mv, mv->tx + 20 , mv->ty-1, x); + x= SCREEN_WIDTH + mvdb[id].mv->map->tiles->tileWidth; + if(mvdb[id].mv->page->id==0) + mapDrawCol(mvdb[id].mv, mvdb[id].mv->tx + 20 , mvdb[id].mv->ty-1, x); + else + modexCopyPageRegion(mvdb[id].mv->page, mvdb[0].mv->page, x, 0, x, 0, mvdb[id].mv->map->tiles->tileWidth, mvdb[id].mv->map->tiles->tileHeight*17); +// mv[0] } } diff --git a/test.exe b/test.exe index 13eadb07..79a5b31d 100644 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index bfc3938a..7d62d246 100644 Binary files a/test2.exe and b/test2.exe differ