X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fscroll.c;h=65929b5a9bca125bb8a076b16a0ecef6929f3839;hb=88411d17d209749656f107651bf5647a73bd65ce;hp=39990d1f10f691dbdab06153d50f6c905f92acdc;hpb=740ff188abdd2f0af303bad47590281447c1729b;p=16.git diff --git a/src/scroll.c b/src/scroll.c index 39990d1f..65929b5a 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -1,7 +1,29 @@ +/* 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. + * + */ + #include "src/lib/dos_kb.h" #include "src/lib/mapread.h" -#include "src/lib/wtest/wtest.c" -#include "src/lib/planar.c" +#include "src/lib/wcpu/wcpu.h" +#include "src/lib/planar.h" //====#include "src\lib\ems.c" //word far *clock= (word far*) 0x046C; /* 18.2hz clock */ @@ -49,7 +71,7 @@ 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 qclean(); void pdump(map_view_t *pee); -void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword d, short scrolloffsetswitch, int x, int y, int ls, int lp, bitmap_t *bmp); +void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword d, short scrolloffsetswitch, int x, int y, int ls, int lp, bitmap_t *bmp); #define TILEWH 16 #define QUADWH TILEWH/2 @@ -63,7 +85,7 @@ void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword //#define TRIGGY 9 void main() { - size_t oldfreemem=GetFreeSize(); +//++++ size_t oldfreemem=GetFreeSize(); /*long emmhandle; long emsavail; char teststr[80];*/ @@ -196,11 +218,11 @@ void main() { /* setup camera and screen~ */ screen = modexDefaultPage(); screen.width += (TILEWH*2); - screen.height += (TILEWH*2)+QUADWH; + screen.height += (TILEWH*2);//+QUADWH; mv[0].page = &screen; screen2 = modexNextPage(mv[0].page); mv[1].page = &screen2; - screen3 = modexNextPage0(mv[1].page, 352, 176); //(352*176)+1024 is the remaining amount of memory left wwww + screen3 = modexNextPage0(mv[1].page, 320, 240); //(352*176)+1024 is the remaining amount of memory left wwww //screen3 = modexNextPage0(mv2.page, 320, 192); //(352*176)+1024 is the remaining amount of memory left wwww mv[2].page = &screen3; @@ -208,9 +230,6 @@ void main() { bg = &mv[0]; spri = &mv[1]; mask = &mv[2]; - //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); @@ -241,7 +260,8 @@ void main() { modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp); modexShowPage(spri->page); -// printf("Total used @ before loop: %zu\n", oldfreemem-GetFreeSize()); +// printf("Total used @ before loop: %zu\n", oldfreemem-GetFreeSize()); + modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 1); modexFadeOn(4, gpal); while(!keyp(1) && player.hp>0) { @@ -264,9 +284,9 @@ 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); + animatePlayer(bg, spri, player.d-1, 1, player.x, player.y, persist_aniframe, player.q, &ptmp); mapScrollRight(mv, SPEED, 0); - mapScrollRight(mv, SPEED, 1); + mapScrollRight(mv, SPEED, 1); //mapScrollRight(mask, SPEED); modexShowPage(spri->page); player.q++; @@ -595,8 +615,8 @@ void main() { printf("player.hp: %d", player.hp); printf(" player.q: %d", player.q); printf(" player.d: %d\n", player.d); printf("tile data value at player trigger position: %d\n", bg->map->data[(player.triggerx-1)+(map.width*(player.triggery-1))]); printf("palette offset: %d\n", paloffset/3); - printf("Total used: %zu\n", oldfreemem-GetFreeSize()); - printf("Total free: %zu\n", GetFreeSize()); +//++++ printf("Total used: %zu\n", oldfreemem-GetFreeSize()); +//++++ printf("Total free: %zu\n", GetFreeSize()); 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("Screen: %dx", screen.width); printf("%d\n", screen.height); @@ -707,8 +727,8 @@ initMap(map_t *map) { } //tile = tile ? 0 : 1; }*/ -} - +} + void mapScrollRight(map_view_t *mv, byte offset, word id) @@ -729,7 +749,7 @@ mapScrollRight(map_view_t *mv, byte offset, word id) /* draw the next column */ x= SCREEN_WIDTH + mv[id].map->tiles->tileWidth; if(id==0) - mapDrawCol(&mv[id], mv[id].tx + 20 , mv[id].ty-1, x); + mapDrawCol(&mv[0], mv[0].tx + 20 , mv[0].ty-1, x); else modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*17); } @@ -753,11 +773,12 @@ mapScrollLeft(map_view_t *mv, byte offset, word id) mv[id].page->data -= 4; mv[id].page->dx = mv[id].map->tiles->tileWidth; - /* draw the next column */ + /* draw the next column */ + x= 0; if(id==0) - mapDrawCol(&mv[0], mv[id].tx-1, mv[id].ty-1, 0); + mapDrawCol(&mv[0], mv[0].tx-1, mv[0].ty-1, 0); else - modexCopyPageRegion(mv[id].page, mv[0].page, 0, 0, 0, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*17); + modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*17); } } @@ -779,11 +800,11 @@ mapScrollUp(map_view_t *mv, byte offset, word id) mv[id].page->dy = mv[id].map->tiles->tileHeight; /* draw the next row */ - //y= 0; + y= 0; if(id==0) - mapDrawRow(&mv[0], mv[id].tx-1 , mv[id].ty-1, 0); + mapDrawRow(&mv[0], mv[0].tx-1 , mv[0].ty-1, 0); else - modexCopyPageRegion(mv[id].page, mv[0].page, 0, 0, 0, 0, mv[id].map->tiles->tileWidth*22, mv[id].map->tiles->tileHeight); + modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*22, mv[id].map->tiles->tileHeight); } } @@ -807,7 +828,7 @@ mapScrollDown(map_view_t *mv, byte offset, word id) /* draw the next row */ y= SCREEN_HEIGHT + mv[id].map->tiles->tileHeight; if(id==0) - mapDrawRow(&mv[0], mv[id].tx-1 , mv[id].ty+15, y); + mapDrawRow(&mv[0], mv[0].tx-1 , mv[0].ty+15, y); else modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*22, mv[id].map->tiles->tileHeight); } @@ -956,6 +977,6 @@ animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword d, s //modexClearRegion(top->page, 66, 66, 2, 40, 0); //modexCopyPageRegion(dest->page, top->page, 66, 66, 66, 66, 2, 40); //turn this off if XT - //XTif(detectcpu() > 0) + //XTif(detectcpu() > 0) modexWaitBorder(); }