From: sparky4 Date: Sun, 23 Nov 2014 20:05:53 +0000 (-0600) Subject: modified: 16/modex16/scroll.c X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=a19d7592507e5f7aa91f4a6b6611e021bd1a3e8d;p=16.git modified: 16/modex16/scroll.c modified: 16/modex16/scroll.exe modified: Project 16.bfproject modified: modex16.c modified: modex16.h modified: pcxtest.exe modified: scroll.c modified: scroll.exe modified: test.exe modified: test2.exe --- diff --git a/16/modex16/scroll.c b/16/modex16/scroll.c index 78733026..65ea0279 100644 --- a/16/modex16/scroll.c +++ b/16/modex16/scroll.c @@ -67,7 +67,7 @@ void main() { page_t screen, screen2; map_t map; map_view_t mv, mv2; - map_view_t *draw, *show, *tmp; + map_view_t *draw, *spri, *tmp; byte *ptr; setkb(1); @@ -90,13 +90,13 @@ void main() { modexShowPage(mv.page); /* set up paging */ - show = &mv; - draw = &mv2; + draw = &mv; + spri = &mv2; // draw = &mv; //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen mapGoTo(draw, 0, 0); - mapGoTo(show, 0, 0); + mapGoTo(spri, 0, 0); //TODO: put player in starting position of spot //default player position on the viewable map @@ -233,9 +233,6 @@ void main() { player.ty--; } } -// modexDrawBmp(draw->page, player.x, player.y, &bmp); - //modexShowPage(draw->page); - } modexLeave(); @@ -477,32 +474,35 @@ void animatePlayer(map_view_t *mv, short d1, short d2, int x, int y, int ls, bit { case 0: //up - if(ls<2) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); - if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 48, 0, 24, 32, bmp); - if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 0, 0, 24, 32, bmp); - if(ls>6) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); + //if(ls==0) modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); + if(ls<1) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); } + if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 48, 0, 24, 32, bmp); } + if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 0, 0, 24, 32, bmp); } + if(ls>=7) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); } break; case 1: // right - //right - if(ls<2) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); - if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 48, 32, 24, 32, bmp); - if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 0, 32, 24, 32, bmp); - if(ls>6) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); + //if(ls==0) modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); + if(ls<1) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); } + if(4>ls && ls>=1) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 48, 32, 24, 32, bmp); } + if(7>ls && ls>=4) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 0, 32, 24, 32, bmp); } + if(ls>=7) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); } break; case 2: //down - if(ls<2) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); - if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 48, 64, 24, 32, bmp); - if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 0, 64, 24, 32, bmp); - if(ls>6) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); + //if(ls==0) modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); + if(ls<1) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); } + if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 48, 64, 24, 32, bmp); } + if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 0, 64, 24, 32, bmp); } + if(ls>=7) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); } break; case 3: //left - if(ls<2) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); - if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 48, 96, 24, 32, bmp); - if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 0, 96, 24, 32, bmp); - if(ls>6) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); + //if(ls==0) modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); + if(ls<1) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); } + if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 48, 96, 24, 32, bmp); } + if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 0, 96, 24, 32, bmp); } + if(ls>=7) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); } break; } } diff --git a/16/modex16/scroll.exe b/16/modex16/scroll.exe index fcf55ffd..6bf9ba9f 100755 Binary files a/16/modex16/scroll.exe and b/16/modex16/scroll.exe differ diff --git a/Project 16.bfproject b/Project 16.bfproject index c75ec9aa..3a2786fe 100644 --- a/Project 16.bfproject +++ b/Project 16.bfproject @@ -1,7 +1,9 @@ c2e.convert_special: 0 e2c.convert_num: 0 openfiles: /dos/z/16/doc/project.txt:0:0:0: -openfiles: /dos/z/16/scroll.c:82:0:1: +openfiles: /dos/z/16/scroll.c:12102:11962:1: +openfiles: /dos/z/16/modex16.c:6464:6244:0: +openfiles: /dos/z/16/modex16.h:1191:2119:0: snr_recursion_level: 0 convertcolumn_horizontally: 0 adv_open_matchname: 0 @@ -16,7 +18,7 @@ c2e.convert_iso: 0 opendir: file:///dos/z/16 wrap_text_default: 0 bookmarks_filename_mode: 1 -ssearch_text: mapScrollRight +ssearch_text: color snr_casesens: 1 view_blocks: 1 name: project 16 @@ -25,6 +27,9 @@ replacelist: \t replacelist: putPixel_X replacelist: SCREEN_WIDTH replacelist: SCREEN_HEIGHT +replacelist: animatePlayer(spri +replacelist: animatePlayer(draw +replacelist: modexClearPlayer(mv->page fb_show_hidden_f: 0 editor_tab_width: 4 show_visible_spacing: 1 @@ -38,8 +43,6 @@ ssearch_regex: 0 e2c.convert_iso: 0 ssearch_casesens: 0 charmap_block: 1 -recent_files: file:///dos/z/16/16/lib/x/MXPN.ASM -recent_files: file:///dos/z/4x4_16/!/c/TUT10.C recent_files: file:///dos/z/16/16/lib/x/MXVS.ASM recent_files: file:///dos/z/16/16/lib/x/MAKEFILE recent_files: file:///dos/z/16/16/lib/x/MODEX.DEF @@ -86,10 +89,12 @@ recent_files: file:///dos/z/16/16/lib/x/MODEX.H recent_files: file:///dos/z/16/16/modex16/dos_kb.h recent_files: file:///dos/z/16/doc/16.16 recent_files: file:///dos/z/16/doc/16story.txt -recent_files: file:///dos/z/16/doc/project.txt recent_files: file:///dos/z/16/scroll.c +recent_files: file:///dos/z/16/doc/project.txt +recent_files: file:///dos/z/16/modex16.h +recent_files: file:///dos/z/16/modex16.c snr_replacetype: 0 -savedir: file:///dos/z/16/16/modex16 +savedir: file:///dos/z/16 spell_check_default: 1 spell_insert_entities: 0 last_filefilter: @@ -99,21 +104,21 @@ snr_escape_chars: 0 htmlbar_view: 0 spell_lang: en ssearch_dotmatchall: 0 -searchlist: QUADWH -searchlist: pdump -searchlist: #include "modex16.h"\r\n#include \r\n\r\nword far* clock= (word far*) 0x046C; /* 18.2hz clock */\r\n\r\nvoid main() {\r\n#include "modex16.h"\r\n#include \r\n\r\nword far* clock= (word far*) 0x046C; /* 18.2hz clock */\r\n\r\nvoid main() {\r\n -searchlist: extern -searchlist: VGA -searchlist: vga -searchlist: clock -searchlist: setvideo -searchlist: gq -searchlist: SC_INDEX -searchlist: draw -searchlist: int index -searchlist: map.dat -searchlist: 32 searchlist: mapScrollRight +searchlist: 32 +searchlist: map.dat +searchlist: int index +searchlist: draw +searchlist: SC_INDEX +searchlist: gq +searchlist: setvideo +searchlist: clock +searchlist: vga +searchlist: color 0 +searchlist: sprite +searchlist: clear +searchlist: modexClearRegion(mv->page +searchlist: color autocomplete: 1 outputb_show_all_output: 0 bookmarks_show_mode: 0 diff --git a/modex16.c b/modex16.c index f01116b5..256a08ef 100644 --- a/modex16.c +++ b/modex16.c @@ -213,7 +213,62 @@ modexClearRegion(page_t *page, int x, int y, int w, int h, byte color) { JNZ SCAN_START } } + + +void +modexClearPlayer(page_t *page, int x, int y, int w, int h) { + word pageOff = (word) page->data; + word xoff=x/4; /* xoffset that begins each row */ + word scanCount=w/4; /* number of iterations per row (excluding right clip)*/ + word poffset = pageOff + y*(page->width/4) + xoff; /* starting offset */ + word nextRow = page->width/4-scanCount-1; /* loc of next row */ + byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */ + byte rclip[] = {0x00, 0x01, 0x03, 0x07}; + byte left = lclip[x&0x03]; + byte right = rclip[(x+w)&0x03]; + + /* handle the case which requires an extra group */ + if((x & 0x03) && !((x+w) & 0x03)) { + right=0x0f; + } + + __asm { + MOV AX, SCREEN_SEG ; go to the VGA memory + MOV ES, AX + MOV DI, poffset ; go to the first pixel + MOV DX, SC_INDEX ; point to the map mask + MOV AL, MAP_MASK + OUT DX, AL + INC DX + MOV AL, NULL ; get ready to write colors + SCAN_START: + MOV CX, scanCount ; count the line + MOV BL, AL ; remember color + MOV AL, left ; do the left clip + OUT DX, AL ; set the left clip + MOV AL, BL ; restore color + STOSB ; write the color + DEC CX + JZ SCAN_DONE ; handle 1 group stuff + ;-- write the main body of the scanline + MOV BL, AL ; remember color + MOV AL, 0x0f ; write to all pixels + OUT DX, AL + MOV AL, BL ; restore color + REP STOSB ; write the color + SCAN_DONE: + MOV BL, AL ; remeber color + MOV AL, right + OUT DX, AL ; do the right clip + MOV AL, BL ; restore color + STOSB ; write pixel + ADD DI, nextRow ; go to the next row + DEC h + JNZ SCAN_START + } +} + void modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) { diff --git a/modex16.h b/modex16.h index 77573105..855042ff 100644 --- a/modex16.h +++ b/modex16.h @@ -29,7 +29,8 @@ page_t modexNextPage(page_t *p); void modexShowPage(page_t *page); void modexPanPage(page_t *page, int dx, int dy); void modexSelectPlane(byte plane); -void modexClearRegion(page_t *page, int x, int y, int w, int h, byte color); +void modexClearRegion(page_t *page, int x, int y, int w, int h, byte color); +void modexClearPlayer(page_t *page, int x, int y, int w, int h); void modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp); void modexDrawBmpRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp); void modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp); diff --git a/pcxtest.exe b/pcxtest.exe index de765ece..f70b085b 100644 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/scroll.c b/scroll.c index 78733026..65ea0279 100644 --- a/scroll.c +++ b/scroll.c @@ -67,7 +67,7 @@ void main() { page_t screen, screen2; map_t map; map_view_t mv, mv2; - map_view_t *draw, *show, *tmp; + map_view_t *draw, *spri, *tmp; byte *ptr; setkb(1); @@ -90,13 +90,13 @@ void main() { modexShowPage(mv.page); /* set up paging */ - show = &mv; - draw = &mv2; + draw = &mv; + spri = &mv2; // draw = &mv; //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen mapGoTo(draw, 0, 0); - mapGoTo(show, 0, 0); + mapGoTo(spri, 0, 0); //TODO: put player in starting position of spot //default player position on the viewable map @@ -233,9 +233,6 @@ void main() { player.ty--; } } -// modexDrawBmp(draw->page, player.x, player.y, &bmp); - //modexShowPage(draw->page); - } modexLeave(); @@ -477,32 +474,35 @@ void animatePlayer(map_view_t *mv, short d1, short d2, int x, int y, int ls, bit { case 0: //up - if(ls<2) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); - if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 48, 0, 24, 32, bmp); - if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 0, 0, 24, 32, bmp); - if(ls>6) modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); + //if(ls==0) modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); + if(ls<1) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); } + if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 48, 0, 24, 32, bmp); } + if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 0, 0, 24, 32, bmp); } + if(ls>=7) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); } break; case 1: // right - //right - if(ls<2) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); - if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 48, 32, 24, 32, bmp); - if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 0, 32, 24, 32, bmp); - if(ls>6) modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); + //if(ls==0) modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); + if(ls<1) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); } + if(4>ls && ls>=1) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 48, 32, 24, 32, bmp); } + if(7>ls && ls>=4) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 0, 32, 24, 32, bmp); } + if(ls>=7) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); } break; case 2: //down - if(ls<2) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); - if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 48, 64, 24, 32, bmp); - if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 0, 64, 24, 32, bmp); - if(ls>6) modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); + //if(ls==0) modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); + if(ls<1) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); } + if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 48, 64, 24, 32, bmp); } + if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 0, 64, 24, 32, bmp); } + if(ls>=7) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); } break; case 3: //left - if(ls<2) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); - if(4>ls && ls>=2) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 48, 96, 24, 32, bmp); - if(6>ls && ls>=4) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 0, 96, 24, 32, bmp); - if(ls>6) modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); + //if(ls==0) modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); + if(ls<1) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); } + if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 48, 96, 24, 32, bmp); } + if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 0, 96, 24, 32, bmp); } + if(ls>=7) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); } break; } } diff --git a/scroll.exe b/scroll.exe index fcf55ffd..6bf9ba9f 100644 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/test.exe b/test.exe index 99404b1a..38a4eb9d 100644 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index 2b870eff..c71ba0e2 100644 Binary files a/test2.exe and b/test2.exe differ