]> 4ch.mooo.com Git - 16.git/commitdiff
modified: Project 16.bfproject
authorsparky4 <sparky4@cock.li>
Mon, 24 Nov 2014 09:30:19 +0000 (03:30 -0600)
committersparky4 <sparky4@cock.li>
Mon, 24 Nov 2014 09:30:19 +0000 (03:30 -0600)
modified:   scroll.c
modified:   scroll.exe

Project 16.bfproject
scroll.c
scroll.exe

index ca24de0704e9ee6473dcc6acec4b44fa87baf3ce..39b70fd328873aaf8e87f7820195a0d258fa4abe 100644 (file)
@@ -1,7 +1,7 @@
 c2e.convert_special: 0
 e2c.convert_num: 0
 openfiles: /dos/z/16/doc/project.txt:102:0:0:
-openfiles: /dos/z/16/scroll.c:0:2959:1:
+openfiles: /dos/z/16/scroll.c:12437:11784:1:
 openfiles: /dos/z/16/modex16.c:9475:0:0:
 openfiles: /dos/z/16/modex16.h:1512:344:0:
 openfiles: /dos/z/16/pcxtest.c:1339:442:0:
@@ -22,13 +22,10 @@ c2e.convert_iso: 0
 opendir: file:///dos/z/16/lib
 wrap_text_default: 0
 bookmarks_filename_mode: 1
-ssearch_text: )*2
+ssearch_text: inc_
 snr_casesens: 1
 view_blocks: 1
 name: project 16
-replacelist: animatePlayer(spri
-replacelist: modexDrawSpriteRegion(spri
-replacelist: spri->page = modexDefaultPage();
 replacelist: screen2=modexNextPage(mv.page);
 replacelist: spri->page=draw->page;
 replacelist: mv
@@ -41,6 +38,9 @@ replacelist: 34);
 replacelist: bg
 replacelist: dest
 replacelist: animatePlayer(bg, spri,
+replacelist: qi=1
+replacelist: qi<=(
+replacelist: \t\t\t\t
 fb_show_hidden_f: 0
 editor_tab_width: 4
 show_visible_spacing: 1
@@ -96,14 +96,14 @@ 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/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/pcxtest.c
-recent_files: file:///dos/z/16/dos_kb.c
 recent_files: file:///dos/z/16/dos_kb.h
 recent_files: file:///dos/z/16/lib/lib_head.h
+recent_files: file:///dos/z/16/dos_kb.c
+recent_files: file:///dos/z/16/modex16.h
+recent_files: file:///dos/z/16/pcxtest.c
 recent_files: file:///dos/z/16/modex16.c
+recent_files: file:///dos/z/16/scroll.c
 snr_replacetype: 0
 savedir: file:///dos/z/16
 spell_check_default: 1
@@ -115,10 +115,6 @@ snr_escape_chars: 0
 htmlbar_view: 0
 spell_lang: en
 ssearch_dotmatchall: 0
-searchlist: wPage(draw
-searchlist: 32);
-searchlist: 33)
-searchlist: 3)
 searchlist: draw
 searchlist: 34)
 searchlist: 0x3DA
@@ -129,7 +125,11 @@ searchlist: clearpl
 searchlist: modexDrawSpriteRegion
 searchlist: bg
 searchlist: )*-
+searchlist: qi=0
+searchlist: qi<(
+searchlist:                 
 searchlist: )*2
+searchlist: inc_
 autocomplete: 1
 outputb_show_all_output: 0
 bookmarks_show_mode: 0
index da3369eb387fbeb8efbb14a6062a804ab62df941..aeee5929b834a60651633953f9f5a8ab61d158f7 100644 (file)
--- a/scroll.c
+++ b/scroll.c
@@ -51,7 +51,7 @@ void mapGoTo(map_view_t *mv, int tx, int ty);
 void mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y);
 void mapDrawRow(map_view_t *mv, int tx, int ty, word y);
 void mapDrawCol(map_view_t *mv, int tx, int ty, word x);
-void animatePlayer(map_view_t *src, map_view_t *dest, short d1, short d2, int x, int y, int ls, bitmap_t *bmp);
+void animatePlayer(map_view_t *src, map_view_t *dest, short d1, short d2, int x, int y, int ls, int lp, bitmap_t *bmp);
 
 #define TILEWH 16
 #define QUADWH (TILEWH/4)
@@ -64,6 +64,7 @@ void animatePlayer(map_view_t *src, map_view_t *dest, short d1, short d2, int x,
 void main() {
        bitmap_t ptmp; // player sprite
        int q=1;
+       static int persist_aniframe = 0;    /* gonna be increased to 1 before being used, so 0 is ok for default */
        page_t screen, screen2;
        map_t map;
        map_view_t mv, mv2;
@@ -112,15 +113,16 @@ void main() {
        //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
        
-       //TODO: render the player properly with animation and sprite sheet
-       //TODO: fexible speeds
+       #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)
                {
                        for(q=1; q<=(TILEWH/SPEED); q++)
                        {
-                               animatePlayer(bg, spri, 1, 1, player.x, player.y, q, &ptmp);
+                               INC_PER_FRAME;
+                               animatePlayer(bg, spri, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp);
                                mapScrollRight(bg, SPEED);
                                mapScrollRight(spri, SPEED);
                                modexShowPage(spri->page);
@@ -131,8 +133,9 @@ void main() {
                {
                        for(q=1; q<=(TILEWH/SPEED); q++)
                        {
+                               INC_PER_FRAME;
                                player.x+=SPEED;
-                               animatePlayer(bg, spri, 1, 0, player.x, player.y, q, &ptmp);
+                               animatePlayer(bg, spri, 1, 0, player.x, player.y, persist_aniframe, q, &ptmp);
                                modexShowPage(spri->page);
                        }
                        player.tx++;
@@ -151,8 +154,8 @@ void main() {
                {
                        for(q=1; q<=(TILEWH/SPEED); q++)
                        {
-                               
-                               animatePlayer(bg, spri, 3, 1, player.x, player.y, q, &ptmp);
+                               INC_PER_FRAME;
+                               animatePlayer(bg, spri, 3, 1, player.x, player.y, persist_aniframe, q, &ptmp);
                                mapScrollLeft(bg, SPEED);
                                mapScrollLeft(spri, SPEED);
                                modexShowPage(spri->page);
@@ -163,8 +166,9 @@ void main() {
                {
                        for(q=1; q<=(TILEWH/SPEED); q++)
                        {
+                               INC_PER_FRAME;
                                player.x-=SPEED;
-                               animatePlayer(bg, spri, 3, 0, player.x, player.y, q, &ptmp);
+                               animatePlayer(bg, spri, 3, 0, player.x, player.y, persist_aniframe, q, &ptmp);
                                modexShowPage(spri->page);
                        }
                        player.tx--;
@@ -183,7 +187,8 @@ void main() {
                {
                        for(q=1; q<=(TILEWH/SPEED); q++)
                        {
-                               animatePlayer(bg, spri, 2, 1, player.x, player.y, q, &ptmp);
+                               INC_PER_FRAME;
+                               animatePlayer(bg, spri, 2, 1, player.x, player.y, persist_aniframe, q, &ptmp);
                                mapScrollDown(bg, SPEED);
                                mapScrollDown(spri, SPEED);
                                modexShowPage(spri->page);
@@ -194,8 +199,9 @@ void main() {
                {
                        for(q=1; q<=(TILEWH/SPEED); q++)
                        {
+                               INC_PER_FRAME;
                                player.y+=SPEED;
-                               animatePlayer(bg, spri, 2, 0, player.x, player.y, q, &ptmp);
+                               animatePlayer(bg, spri, 2, 0, player.x, player.y, persist_aniframe, q, &ptmp);
                                modexShowPage(spri->page);
                        }
                        player.ty++;
@@ -214,7 +220,8 @@ void main() {
                {
                        for(q=1; q<=(TILEWH/SPEED); q++)
                        {
-                               animatePlayer(bg, spri, 0, 1, player.x, player.y, q, &ptmp);
+                               INC_PER_FRAME;
+                               animatePlayer(bg, spri, 0, 1, player.x, player.y, persist_aniframe, q, &ptmp);
                                mapScrollUp(bg, SPEED);
                                mapScrollUp(spri, SPEED);
                                modexShowPage(spri->page);
@@ -225,8 +232,9 @@ void main() {
                {
                        for(q=1; q<=(TILEWH/SPEED); q++)
                        {
+                               INC_PER_FRAME;
                                player.y-=SPEED;
-                               animatePlayer(bg, spri, 0, 0, player.x, player.y, q, &ptmp);
+                               animatePlayer(bg, spri, 0, 0, player.x, player.y, persist_aniframe, q, &ptmp);
                                modexShowPage(spri->page);
                        }
                        player.ty--;
@@ -471,15 +479,13 @@ mapDrawCol(map_view_t *mv, int tx, int ty, word x) {
 }
 
 void
-animatePlayer(map_view_t *src, map_view_t *dest, short d1, short d2, int x, int y, int ls, bitmap_t *bmp)
+animatePlayer(map_view_t *src, map_view_t *dest, short d1, short d2, int x, int y, int ls, int lp, bitmap_t *bmp)
 {
        short dire=32*d1;
        short qq;
-       short lo = ((TILEWH / SPEED) / 3);
-       short loo = (ls + lo);
 
        if(d2==0) qq = 0;
-       else qq = ((ls)*SPEED);
+       else qq = ((lp)*SPEED);
        switch (d1)
        {
                case 0:
index 110d9abd36ac3b5009b462a113dc3795b4395f3b..e8064a50cbf3619f665e5db88d04c21c8b3734bc 100644 (file)
Binary files a/scroll.exe and b/scroll.exe differ