From: sparky4 Date: Fri, 21 Apr 2017 14:34:15 +0000 (-0500) Subject: 16_ca needs huge amounts of work and I should remember what needs to be done soon... X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=a926eef7c1a72dcf71fc63bca7bddd8753b4eb98 16_ca needs huge amounts of work and I should remember what needs to be done soon[going to port rest of code to borland c some time so we can use the core components of id engine here ][going to add 16_us.c eventually but the debug system and CA_ PM_ and MM_ usage is priority now]older zcroll renamed to xcroll][zcroll is now the pre menu game loop system with PROPER data usage with CAMMPM] added 1st scroll back --- diff --git a/16/modex16/0croll.c b/16/modex16/0croll.c new file mode 100755 index 00000000..4ea630f8 --- /dev/null +++ b/16/modex16/0croll.c @@ -0,0 +1,371 @@ +//from https://github.com/sparky4/16/commit/7872dbf5d0240f01177588bd7966c3e042ced554 +#include "16/src/lib/omodex16.h" +#include "16/src/lib/bitmap.h" +#include +#include +#include +//#include "dos_kb.h" +#define SCREEN_WIDTH 320 +#define SCREEN_HEIGHT 240 + +//word far *clock= (word far*) 0x046C; /* 18.2hz clock */ + +typedef struct { + bitmap_t *data; + word tileHeight; + word tileWidth; + unsigned int rows; + unsigned int cols; + unsigned int tilex,tiley; // tile position on the map +} otiles_t; + + +typedef struct { + byte *data; + otiles_t *tiles; + int width; + int height; +} omap_t; + + +typedef struct { + omap_t *map; + opage_t *page; + int tx; //???? appears to be the tile position on the viewable screen map + int ty; //???? appears to be the tile position on the viewable screen map + word dxThresh; //???? + word dyThresh; //???? +} omap_view_t; + +struct { + int tx; //player position on the viewable map + int ty; //player position on the viewable map +} player; + + +omap_t allocMap(int w, int h); +void oinitMap(omap_t *map); +void omapScrollRight(omap_view_t *mv, byte offset); +void omapScrollLeft(omap_view_t *mv, byte offest); +void omapScrollUp(omap_view_t *mv, byte offset); +void omapScrollDown(omap_view_t *mv, byte offset); +void omapGoTo(omap_view_t *mv, int tx, int ty); +void omapDrawTile(otiles_t *t, word i, opage_t *page, word x, word y); +void omapDrawRow(omap_view_t *mv, int tx, int ty, word y); +void omapDrawCol(omap_view_t *mv, int tx, int ty, word x); + +//#define SWAP(a, b) tmp=a; a=b; b=tmp; +void main() { + static global_game_variables_t gvar; +// int show1=1; +// int tx, ty; +// int x, y; + //int ch=0x0; +// byte ch; +// int q=0; + opage_t screen;//,screen2; + omap_t map; + omap_view_t mv;//, mv2; + omap_view_t *draw;//, *show, *tmp; + byte *ptr; + + //default player position on the viewable map + player.tx = 10; + player.ty = 8; + +// setkb(1); + IN_Startup(&gvar); + /* create the map */ + map = allocMap(40,30); //20x15 is the resolution of the screen you can make omapS smaller than 20x15 but the null space needs to be drawn properly + oinitMap(&map); + mv.map = ↦ +// mv2.map = ↦ + + /* draw the tiles */ + ptr = map.data; + omodexEnter(1, 1, &gvar); + screen = omodexDefaultPage(); + screen.width += (TILEWH*2); + mv.page = &screen; + omapGoTo(&mv, 16, 16); +// screen2=omodexNextPage(mv.page); +// mv2.page = &screen2; +// omapGoTo(&mv2, 16, 16); +// omodexShowPage(mv.page); + + /* set up paging */ +// show = &mv; +// draw = &mv2; + draw = &mv; +//IN_StartAck (&gvar); while (!IN_CheckAck (&gvar)){ } omodexLeave(); IN_Shutdown(&gvar); exit(0); + + //TODO: set player position data here according to the viewable map screen thingy + + while(!gvar.in.inst->Keyboard[sc_Escape]) { + //TODO: top left corner & bottem right corner of map veiw be set as map edge trigger since omapS 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 + if(gvar.in.inst->Keyboard[77]){ +// for(q=0; qpage); +// omapScrollRight(draw, 1); +// SWAP(draw, show); +// } + } + + if(gvar.in.inst->Keyboard[75]){ +// for(q=0; qpage); +// omapScrollLeft(show, 1); +// SWAP(draw, show); +// } + } + + if(gvar.in.inst->Keyboard[80]){ +// for(q=0; qpage); +// omapScrollDown(show, 1); +// SWAP(draw, show); +// } + } + + if(gvar.in.inst->Keyboard[72]){ +// for(q=0; qpage); +// omapScrollUp(show, 1); +// SWAP(draw, show); +// } + } + + //keyp(ch); + omodexShowPage(draw->page); + + } + + omodexLeave(); + +// setkb(0); + IN_Shutdown(&gvar); +} + + +omap_t +allocMap(int w, int h) { + omap_t result; + + result.width =w; + result.height=h; + result.data = malloc(sizeof(byte) * w * h); + + return result; +} + + +void +oinitMap(omap_t *map) { + /* just a place holder to fill out an alternating pattern */ + int x, y; + int i; + int tile = 1; + map->tiles = malloc(sizeof(otiles_t)); + + /* create the tile set */ + map->tiles->data = malloc(sizeof(bitmap_t)); + map->tiles->data->width = (TILEWH*2); + map->tiles->data->height= TILEWH; + map->tiles->data->data = malloc((TILEWH*2)*TILEWH); + map->tiles->tileHeight = TILEWH; + map->tiles->tileWidth =TILEWH; + map->tiles->rows = 1; + map->tiles->cols = 2; + + i=0; + for(y=0; ytiles->data->data[i] = 0x24; + else + map->tiles->data->data[i] = 0x34; + i++; + } + } + + i=0; + for(y=0; yheight; y++) { + for(x=0; xwidth; x++) { + map->data[i] = tile; + tile = tile ? 0 : 1; + i++; + } + tile = tile ? 0 : 1; + } +} + + +void +omapScrollRight(omap_view_t *mv, byte offset) { + word x;//, y; /* coordinate for drawing */ + + /* increment the pixel position and update the page */ + mv->page->dx += offset; + + /* check to see if this changes the tile */ + if(mv->page->dx >= mv->dxThresh ) { + /* go forward one tile */ + mv->tx++; + /* Snap the origin forward */ + mv->page->data += 4; + mv->page->dx = mv->map->tiles->tileWidth; + + + /* draw the next column */ + x= SCREEN_WIDTH + mv->map->tiles->tileWidth; + omapDrawCol(mv, mv->tx + 20 , mv->ty-1, x); + } +} + + +void +omapScrollLeft(omap_view_t *mv, byte offset) { + //word x, y; /* coordinate for drawing */ + + /* increment the pixel position and update the page */ + mv->page->dx -= offset; + + /* check to see if this changes the tile */ + if(mv->page->dx == 0) { + /* go backward one tile */ + mv->tx--; + + /* Snap the origin backward */ + mv->page->data -= 4; + mv->page->dx = mv->map->tiles->tileWidth; + + /* draw the next column */ + omapDrawCol(mv, mv->tx-1, mv->ty-1, 0); + } +} + + +void +omapScrollUp(omap_view_t *mv, byte offset) { + word /*x,*/ y; /* coordinate for drawing */ + + /* increment the pixel position and update the page */ + mv->page->dy -= offset; + + /* check to see if this changes the tile */ + if(mv->page->dy == 0 ) { + /* go down one tile */ + mv->ty--; + /* Snap the origin downward */ + mv->page->data -= mv->page->width*4; + mv->page->dy = mv->map->tiles->tileHeight; + + + /* draw the next row */ + y= 0; + omapDrawRow(mv, mv->tx-1 , mv->ty-1, y); + } +} + + +void +omapScrollDown(omap_view_t *mv, byte offset) { + word /*x,*/ y; /* coordinate for drawing */ + + /* increment the pixel position and update the page */ + mv->page->dy += offset; + + /* check to see if this changes the tile */ + if(mv->page->dy >= mv->dyThresh ) { + /* go down one tile */ + mv->ty++; + /* Snap the origin downward */ + mv->page->data += mv->page->width*4; + mv->page->dy = mv->map->tiles->tileHeight; + + + /* draw the next row */ + y= SCREEN_HEIGHT + mv->map->tiles->tileHeight; + omapDrawRow(mv, mv->tx-1 , mv->ty+15, y); + } + +} + + +void +omapGoTo(omap_view_t *mv, int tx, int ty) { + int /*px,*/ py; + unsigned int i; + + /* set up the coordinates */ + mv->tx = tx; + mv->ty = ty; + mv->page->dx = mv->map->tiles->tileWidth; + mv->page->dy = mv->map->tiles->tileHeight; + + /* set up the thresholds */ + mv->dxThresh = mv->map->tiles->tileWidth * 2; + mv->dyThresh = mv->map->tiles->tileHeight * 2; + + /* draw the tiles */ + omodexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0); + py=0; + i=mv->ty * mv->map->width + mv->tx; + for(ty=mv->ty-1; py < SCREEN_HEIGHT+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) { + omapDrawRow(mv, tx-1, ty, py); + i+=mv->map->width - tx; + } +} + + +void +omapDrawTile(otiles_t *t, word i, opage_t *page, word x, word y) { + word rx; + word ry; + rx = (i % t->cols) * t->tileWidth; + ry = (i / t->cols) * t->tileHeight; + omodexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, t->data); +} + + +void +omapDrawRow(omap_view_t *mv, int tx, int ty, word y) { + word x; + int i; + + /* the position within the map array */ + i=ty * mv->map->width + tx; + for(x=0; xdxThresh && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) { + if(i>=0) { + /* we are in the map, so copy! */ + omapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); + } + i++; /* next! */ + } +} + + +void +omapDrawCol(omap_view_t *mv, int tx, int ty, word x) { + int y; + int i; + + /* location in the map array */ + i=ty * mv->map->width + tx; + + /* We'll copy all of the columns in the screen, + i + 1 row above and one below */ + for(y=0; ydyThresh && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) { + if(i>=0) { + /* we are in the map, so copy away! */ + omapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); + } + i += mv->map->width; + } +} diff --git a/16/modex16/dos_kb.h b/16/modex16/dos_kb.h index ea81462a..854632b1 100755 --- a/16/modex16/dos_kb.h +++ b/16/modex16/dos_kb.h @@ -1,6 +1,6 @@ #ifndef _DOSLIB_KB_H_ #define _DOSLIB_KB_H_ -#include "lib\lib_com.h" +#include "16/modex16/lib/lib_com.h" /* Maximum number of scan codes on keyboard controllers */ #define NUM_SCANCODES 128 diff --git a/makefile b/makefile index 22212468..5c21b2ad 100755 --- a/makefile +++ b/makefile @@ -83,6 +83,8 @@ MODEXLIB=$(SRCLIB)/modex VGMSNDLIB=$(SRCLIB)/vgmsnd DOSLIBDIR=$(SRCLIB)/doslib WCPULIB=$(SRCLIB)/wcpu +OLDMODEX16LIBDIR=16/modex16 +#16/$(SRCLIB) DOSLIB_CPU=$(DOSLIBDIR)/hw/cpu DOSLIB_DOS=$(DOSLIBDIR)/hw/dos @@ -414,18 +416,22 @@ ll.$(OBJ): $(SRCLIB)/ll.c $(SRCLIB)/ll.h # # old 16 lib # -0croll.exe: 0croll.$(OBJ) $(OLDLIBOBJS) omodex16.$(OBJ) 16_ino.$(OBJ) - wcl -0 $(WCLQ) 0croll.$(OBJ) omodex16.$(OBJ) bitmap.$(OBJ) 16_ino.$(OBJ) +0croll.exe: 0croll.$(OBJ) modex16.obj dos_kb.obj bitmap.obj# $(OLDLIBOBJS) omodex16.$(OBJ)# 16_ino.$(OBJ) + wcl -0 $(WCLQ) 0croll.$(OBJ) modex16.obj dos_kb.obj bitmap.obj# omodex16.$(OBJ) bitmap.$(OBJ)# 16_ino.$(OBJ) 0croll.$(OBJ): $(SRC)/0croll.c wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c src/0croll.c -16render.$(OBJ): 16/$(SRCLIB)/16render.c 16/$(SRCLIB)/16render.h - wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c 16/src/lib/16render.c -bitmap.$(OBJ): 16/$(SRCLIB)/bitmap.c 16/$(SRCLIB)/bitmap.h - wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c 16/src/lib/bitmap.c -omodex16.$(OBJ): 16/$(SRCLIB)/omodex16.c 16/$(SRCLIB)/omodex16.h - wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c 16/src/lib/omodex16.c -16_ino.$(OBJ): $(SRCLIB)/16_in.c $(SRCLIB)/16_in.h - wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=16_ino.$(OBJ) -c src/lib/16_in.c +#16render.$(OBJ): $(OLDMODEX16LIBDIR)/16render.c $(OLDMODEX16LIBDIR)/16render.h +# wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c $(OLDMODEX16LIBDIR)/16render.c +bitmap.$(OBJ): $(OLDMODEX16LIBDIR)/bitmap.c $(OLDMODEX16LIBDIR)/bitmap.h + wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c $(OLDMODEX16LIBDIR)/bitmap.c +#omodex16.$(OBJ): $(OLDMODEX16LIBDIR)/omodex16.c $(OLDMODEX16LIBDIR)/omodex16.h +# wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c $(OLDMODEX16LIBDIR)/omodex16.c +modex16.$(OBJ): $(OLDMODEX16LIBDIR)/modex16.c $(OLDMODEX16LIBDIR)/modex16.h + wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c $(OLDMODEX16LIBDIR)/modex16.c +#16_ino.$(OBJ): $(SRCLIB)/16_in.c $(SRCLIB)/16_in.h +# wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=16_ino.$(OBJ) -c src/lib/16_in.c +dos_kb.$(OBJ): $(OLDMODEX16LIBDIR)/dos_kb.c $(OLDMODEX16LIBDIR)/dos_kb.h + wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c $(OLDMODEX16LIBDIR)/dos_kb.c # #other~ diff --git a/src/0croll.c b/src/0croll.c index 4ea630f8..ea26363c 100755 --- a/src/0croll.c +++ b/src/0croll.c @@ -1,12 +1,8 @@ //from https://github.com/sparky4/16/commit/7872dbf5d0240f01177588bd7966c3e042ced554 -#include "16/src/lib/omodex16.h" -#include "16/src/lib/bitmap.h" +#include "16/modex16/modex16.h" #include #include -#include -//#include "dos_kb.h" -#define SCREEN_WIDTH 320 -#define SCREEN_HEIGHT 240 +#include "16/modex16/dos_kb.h" //word far *clock= (word far*) 0x046C; /* 18.2hz clock */ @@ -17,25 +13,25 @@ typedef struct { unsigned int rows; unsigned int cols; unsigned int tilex,tiley; // tile position on the map -} otiles_t; +} tiles_t; typedef struct { byte *data; - otiles_t *tiles; + tiles_t *tiles; int width; int height; -} omap_t; +} map_t; typedef struct { - omap_t *map; - opage_t *page; + map_t *map; + page_t *page; int tx; //???? appears to be the tile position on the viewable screen map int ty; //???? appears to be the tile position on the viewable screen map word dxThresh; //???? word dyThresh; //???? -} omap_view_t; +} map_view_t; struct { int tx; //player position on the viewable map @@ -43,119 +39,116 @@ struct { } player; -omap_t allocMap(int w, int h); -void oinitMap(omap_t *map); -void omapScrollRight(omap_view_t *mv, byte offset); -void omapScrollLeft(omap_view_t *mv, byte offest); -void omapScrollUp(omap_view_t *mv, byte offset); -void omapScrollDown(omap_view_t *mv, byte offset); -void omapGoTo(omap_view_t *mv, int tx, int ty); -void omapDrawTile(otiles_t *t, word i, opage_t *page, word x, word y); -void omapDrawRow(omap_view_t *mv, int tx, int ty, word y); -void omapDrawCol(omap_view_t *mv, int tx, int ty, word x); +map_t allocMap(int w, int h); +void initMap(map_t *map); +void mapScrollRight(map_view_t *mv, byte offset); +void mapScrollLeft(map_view_t *mv, byte offest); +void mapScrollUp(map_view_t *mv, byte offset); +void mapScrollDown(map_view_t *mv, byte offset); +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); +#define TILEWH 16 +#define QUADWH (TILEWH/4) //#define SWAP(a, b) tmp=a; a=b; b=tmp; void main() { - static global_game_variables_t gvar; // int show1=1; -// int tx, ty; -// int x, y; + int tx, ty; + int x, y; //int ch=0x0; // byte ch; -// int q=0; - opage_t screen;//,screen2; - omap_t map; - omap_view_t mv;//, mv2; - omap_view_t *draw;//, *show, *tmp; + int q=0; + page_t screen;//,screen2; + map_t map; + map_view_t mv;//, mv2; + map_view_t *draw;//, *show, *tmp; byte *ptr; //default player position on the viewable map player.tx = 10; player.ty = 8; -// setkb(1); - IN_Startup(&gvar); + setkb(1); /* create the map */ - map = allocMap(40,30); //20x15 is the resolution of the screen you can make omapS smaller than 20x15 but the null space needs to be drawn properly - oinitMap(&map); + map = allocMap(160,120); //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 = ↦ /* draw the tiles */ ptr = map.data; - omodexEnter(1, 1, &gvar); - screen = omodexDefaultPage(); + modexEnter(); + screen = modexDefaultPage(); screen.width += (TILEWH*2); mv.page = &screen; - omapGoTo(&mv, 16, 16); -// screen2=omodexNextPage(mv.page); + mapGoTo(&mv, 16, 16); +// screen2=modexNextPage(mv.page); // mv2.page = &screen2; -// omapGoTo(&mv2, 16, 16); -// omodexShowPage(mv.page); +// mapGoTo(&mv2, 16, 16); +// modexShowPage(mv.page); /* set up paging */ // show = &mv; // draw = &mv2; draw = &mv; -//IN_StartAck (&gvar); while (!IN_CheckAck (&gvar)){ } omodexLeave(); IN_Shutdown(&gvar); exit(0); //TODO: set player position data here according to the viewable map screen thingy - while(!gvar.in.inst->Keyboard[sc_Escape]) { - //TODO: top left corner & bottem right corner of map veiw be set as map edge trigger since omapS are actually square + while(!keyp(1)) { + //TODO: 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 - if(gvar.in.inst->Keyboard[77]){ + if(keyp(77)){ // for(q=0; qpage); -// omapScrollRight(draw, 1); + mapScrollRight(draw, 1); +// modexShowPage(draw->page); +// mapScrollRight(draw, 1); // SWAP(draw, show); // } } - if(gvar.in.inst->Keyboard[75]){ + if(keyp(75)){ // for(q=0; qpage); -// omapScrollLeft(show, 1); + mapScrollLeft(draw, 1); +// modexShowPage(draw->page); +// mapScrollLeft(show, 1); // SWAP(draw, show); // } } - if(gvar.in.inst->Keyboard[80]){ + if(keyp(80)){ // for(q=0; qpage); -// omapScrollDown(show, 1); + mapScrollDown(draw, 1); +// modexShowPage(draw->page); +// mapScrollDown(show, 1); // SWAP(draw, show); // } } - if(gvar.in.inst->Keyboard[72]){ + if(keyp(72)){ // for(q=0; qpage); -// omapScrollUp(show, 1); + mapScrollUp(draw, 1); +// modexShowPage(draw->page); +// mapScrollUp(show, 1); // SWAP(draw, show); // } } //keyp(ch); - omodexShowPage(draw->page); + modexShowPage(draw->page); } - omodexLeave(); - -// setkb(0); - IN_Shutdown(&gvar); + modexLeave(); + setkb(0); } -omap_t +map_t allocMap(int w, int h) { - omap_t result; + map_t result; result.width =w; result.height=h; @@ -166,12 +159,12 @@ allocMap(int w, int h) { void -oinitMap(omap_t *map) { +initMap(map_t *map) { /* just a place holder to fill out an alternating pattern */ int x, y; int i; int tile = 1; - map->tiles = malloc(sizeof(otiles_t)); + map->tiles = malloc(sizeof(tiles_t)); /* create the tile set */ map->tiles->data = malloc(sizeof(bitmap_t)); @@ -207,8 +200,8 @@ oinitMap(omap_t *map) { void -omapScrollRight(omap_view_t *mv, byte offset) { - word x;//, y; /* coordinate for drawing */ +mapScrollRight(map_view_t *mv, byte offset) { + word x, y; /* coordinate for drawing */ /* increment the pixel position and update the page */ mv->page->dx += offset; @@ -224,14 +217,14 @@ omapScrollRight(omap_view_t *mv, byte offset) { /* draw the next column */ x= SCREEN_WIDTH + mv->map->tiles->tileWidth; - omapDrawCol(mv, mv->tx + 20 , mv->ty-1, x); + mapDrawCol(mv, mv->tx + 20 , mv->ty-1, x); } } void -omapScrollLeft(omap_view_t *mv, byte offset) { - //word x, y; /* coordinate for drawing */ +mapScrollLeft(map_view_t *mv, byte offset) { + word x, y; /* coordinate for drawing */ /* increment the pixel position and update the page */ mv->page->dx -= offset; @@ -246,14 +239,14 @@ omapScrollLeft(omap_view_t *mv, byte offset) { mv->page->dx = mv->map->tiles->tileWidth; /* draw the next column */ - omapDrawCol(mv, mv->tx-1, mv->ty-1, 0); + mapDrawCol(mv, mv->tx-1, mv->ty-1, 0); } } void -omapScrollUp(omap_view_t *mv, byte offset) { - word /*x,*/ y; /* coordinate for drawing */ +mapScrollUp(map_view_t *mv, byte offset) { + word x, y; /* coordinate for drawing */ /* increment the pixel position and update the page */ mv->page->dy -= offset; @@ -269,14 +262,14 @@ omapScrollUp(omap_view_t *mv, byte offset) { /* draw the next row */ y= 0; - omapDrawRow(mv, mv->tx-1 , mv->ty-1, y); + mapDrawRow(mv, mv->tx-1 , mv->ty-1, y); } } void -omapScrollDown(omap_view_t *mv, byte offset) { - word /*x,*/ y; /* coordinate for drawing */ +mapScrollDown(map_view_t *mv, byte offset) { + word x, y; /* coordinate for drawing */ /* increment the pixel position and update the page */ mv->page->dy += offset; @@ -292,15 +285,15 @@ omapScrollDown(omap_view_t *mv, byte offset) { /* draw the next row */ y= SCREEN_HEIGHT + mv->map->tiles->tileHeight; - omapDrawRow(mv, mv->tx-1 , mv->ty+15, y); + mapDrawRow(mv, mv->tx-1 , mv->ty+15, y); } } void -omapGoTo(omap_view_t *mv, int tx, int ty) { - int /*px,*/ py; +mapGoTo(map_view_t *mv, int tx, int ty) { + int px, py; unsigned int i; /* set up the coordinates */ @@ -314,28 +307,28 @@ omapGoTo(omap_view_t *mv, int tx, int ty) { mv->dyThresh = mv->map->tiles->tileHeight * 2; /* draw the tiles */ - omodexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0); + modexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0); py=0; i=mv->ty * mv->map->width + mv->tx; for(ty=mv->ty-1; py < SCREEN_HEIGHT+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) { - omapDrawRow(mv, tx-1, ty, py); + mapDrawRow(mv, tx-1, ty, py); i+=mv->map->width - tx; } } void -omapDrawTile(otiles_t *t, word i, opage_t *page, word x, word y) { +mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) { word rx; word ry; rx = (i % t->cols) * t->tileWidth; ry = (i / t->cols) * t->tileHeight; - omodexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, t->data); + modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, t->data); } void -omapDrawRow(omap_view_t *mv, int tx, int ty, word y) { +mapDrawRow(map_view_t *mv, int tx, int ty, word y) { word x; int i; @@ -344,7 +337,7 @@ omapDrawRow(omap_view_t *mv, int tx, int ty, word y) { for(x=0; xdxThresh && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) { if(i>=0) { /* we are in the map, so copy! */ - omapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); } i++; /* next! */ } @@ -352,7 +345,7 @@ omapDrawRow(omap_view_t *mv, int tx, int ty, word y) { void -omapDrawCol(omap_view_t *mv, int tx, int ty, word x) { +mapDrawCol(map_view_t *mv, int tx, int ty, word x) { int y; int i; @@ -364,7 +357,7 @@ omapDrawCol(omap_view_t *mv, int tx, int ty, word x) { for(y=0; ydyThresh && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) { if(i>=0) { /* we are in the map, so copy away! */ - omapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); } i += mv->map->width; }