*\r
*/\r
\r
-#include "src/lib/scroll16.h"\r
+#include "src/lib/16_scr.h"\r
#include "src/lib/16_timer.h"\r
#include "src/lib/wcpu/wcpu.h"\r
+#include "src/lib/16_dbg.h"\r
\r
//#define FADE\r
#define MODEX //this is for mode x initiating\r
\r
//word far *clock= (word far*) 0x046C; /* 18.2hz clock */\r
//bitmap_t *p;\r
-global_game_variables_t gvar;\r
static map_t map;\r
player_t player[MaxPlayers];\r
map_view_t mv[4];\r
sword bakapee;\r
pan_t pan;\r
//debugswitches\r
-boolean panswitch=0;\r
+boolean panswitch=0;//1\r
//extern boolean pageflipflop=1;\r
unsigned int i;\r
const char *cpus;\r
//map_view_db_t pgid[4];\r
word pg;\r
//#ifdef FADE\r
- static word paloffset=0;\r
+ //static word paloffset=0;\r
byte *dpal;\r
//#endif\r
byte *gpal;\r
\r
void main(int argc, char *argv[])\r
{\r
- byte *mesg=malloc(sizeof(dword));\r
-\r
+ static global_game_variables_t gvar;\r
if(argv[1]) bakapee = atoi(argv[1]);\r
else bakapee = 1;\r
\r
- // DOSLIB: check our environment\r
- probe_dos();\r
-\r
- // DOSLIB: what CPU are we using?\r
- // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.\r
- // So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
- // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
- // the CPU to carry out tasks. --J.C.\r
- cpu_probe();\r
-\r
- // DOSLIB: check for VGA\r
- if (!probe_vga()) {\r
- printf("VGA probe failed\n");\r
- return;\r
- }\r
- // hardware must be VGA or higher!\r
- if (!(vga_state.vga_flags & VGA_IS_VGA)) {\r
- printf("This program requires VGA or higher graphics hardware\n");\r
- return;\r
- }\r
-\r
- if (_DEBUG_INIT() == 0) {\r
-#ifdef DEBUGSERIAL\r
- printf("WARNING: Failed to initialize DEBUG output\n");\r
-#endif\r
- }\r
- _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log\r
- _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);\r
+ Startup16(&gvar);\r
\r
pan.pn=1;\r
\r
- start_timer(&gvar);\r
-\r
/* create the map */\r
fprintf(stderr, "testing map load~ ");\r
loadmap("data/test.map", &map);\r
\r
#endif\r
/* input! */\r
- IN_Startup();\r
- IN_Default(0,&player,ctrl_Joystick);\r
- //IN_Default(1,&player,ctrl_Joystick);\r
+ IN_Default(0,&player,ctrl_Keyboard1);\r
\r
/* save the palette */\r
#ifdef MODEX\r
player[0].tx = mv[0].tx + mv[0].page->tilemidposscreenx;\r
player[0].ty = mv[0].ty + mv[0].page->tilemidposscreeny;\r
IN_initplayer(&player, 0);\r
- //IN_initplayer(&player, 1);\r
\r
#ifndef SPRITE\r
modexClearRegion(mv[0].page, player[0].x, player[0].y-TILEWH, 16, 32, 15);\r
//when player[0].tx or player[0].ty == 0 or player[0].tx == 20 or player[0].ty == 15 then stop because that is edge of map and you do not want to walk of the map\r
\r
//player movement\r
- IN_ReadControl(0,&player);\r
+ IN_ReadControl(0, &player);\r
if(!panswitch){\r
- walk(mv, player, 0);\r
+ walk(mv, &player, 0);\r
}else{\r
- panpagemanual(mv, player, 0);\r
+ panpagemanual(mv, &player, 0);\r
//printf(" player[0].q: %d", player[0].q); printf(" player[0].d: %d\n", player[0].d);\r
}\r
\r
#endif\r
VGAmodeX(0, 1, &gvar);\r
#endif\r
- IN_Shutdown();\r
+ Shutdown16(&gvar);\r
printf("\nProject 16 scroll.exe. This is just a test file!\n");\r
printf("version %s\n", VERSION);\r
- printf("tx: %d ", mv[0].tx);\r
- printf("ty: %d\n", mv[0].ty);\r
- printf("\n");\r
- printf("player vars:\n");\r
- printf(" x: %d", player[0].x); printf(" y: %d\n", player[0].y);\r
- //if(player[0].hp==0) printf("%d wwww\n", player[0].y+8);\r
- //else printf("\nplayer[0].y: %d\n", player[0].y);\r
- printf(" tx: %d", player[0].tx); printf(" ty: %d\n", player[0].ty);\r
- printf(" triggx: %d", player[0].triggerx); printf(" triggy: %d\n", player[0].triggery);\r
- printf(" hp: %d", (player[0].hp)); printf(" q: %d", player[0].q); printf(" player.info.dir: %d", player[0].info.dir); printf(" player.d: %d ", player[0].d);\r
- printf(" pdir=%d\n", player[0].pdir);\r
- printf(" tile data value at player trigger position: %d\n\n", mv[0].map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))]);\r
-// printf("palette offset: %d\n", paloffset/3);\r
-//++++ printf("Total used: %zu\n", oldfreemem-GetFreeSize());\r
-//++++ printf("Total free: %zu\n", GetFreeSize());\r
-//not used now printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n");\r
-//not used now printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n");\r
- printf("Virtual Screen: %dx", gvar.video.page[0].width); printf("%d ", gvar.video.page[0].height);\r
- printf("Screen: %dx", gvar.video.page[0].sw); printf("%d\n", gvar.video.page[0].sh);\r
- printf("virtual tile resolution: %dx", gvar.video.page[0].tilesw); printf("%d ", gvar.video.page[0].tilesh);\r
- printf("tile resolution: %dx", gvar.video.page[0].tw); printf("%d\n", gvar.video.page[0].th);\r
- printf("middle tile position: %dx", gvar.video.page[0].tilemidposscreenx); printf("%d\n", gvar.video.page[0].tilemidposscreeny);\r
- modexprintmeminfo(&gvar.video);\r
- //printf("mv[%u].tx: %d", pan.pn, mv[pan.pn].tx); printf(" mv[%u].ty: %d ", pan.pn, mv[pan.pn].ty);\r
- printf("gvar.video.p=%u ", gvar.video.p); printf("gvar.video.r=%u ", gvar.video.r);\r
- printf("pageflipflop=%u\n", pageflipflop);\r
- //0000printf("\ngvar.video.tickclk=%f\n", gvar.video.tickclk);\r
- //0000printf("gvar.video.clk=%f", gvar.video.clk);\r
- printf("\n");\r
- //printf("map.width=%d map.height=%d map.data[0]=%d\n", mv[0].map->width, mv[0].map->height, mv[0].map->data[0]);\r
-\r
- printf("\n");\r
+ SCROLLEXITMESG;\r
switch(detectcpu())\r
{\r
case 0: cpus = "8086/8088 or 186/88"; break;\r