From: sparky4 Date: Tue, 6 Dec 2016 19:30:47 +0000 (-0600) Subject: ok wwwww zscroll and scroll compile disabled due to me being too tired to whack at... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=2e3fb239b58cf341ceb5b4e7b39b6542f5581cae;p=16.git ok wwwww zscroll and scroll compile disabled due to me being too tired to whack at code wwwwwwwwwwwwwwwwwww wwwww i think zcroll16 and scroll16 should be merged wwwwww wwww shinku added back.... bcexmm.exe is horrifically broken wwww i need to cut it down more wwww but later i also isolate the dbg stuff better wwww wwwww nibble added ^^ i hope it works wwww --- diff --git a/inputest.exe b/inputest.exe deleted file mode 100755 index 53a9bc31..00000000 Binary files a/inputest.exe and /dev/null differ diff --git a/makefile b/makefile index 1c1cd5ce..effed175 100755 --- a/makefile +++ b/makefile @@ -161,9 +161,9 @@ TESTEXEC = & vgmtest.exe & scroll.exe & zcroll.exe & + inputest.exe & vrstest.exe TESTEXEC2 = & - inputest.exe & maptest.exe & fmemtest.exe & fonttest.exe & diff --git a/src/inputest.c b/src/inputest.c index a573d54a..52d36283 100755 --- a/src/inputest.c +++ b/src/inputest.c @@ -23,6 +23,7 @@ input test */ #include "src/lib/16_in.h" +#include "src/lib/16_tail.h" void main(int argc, char *argv[]) @@ -30,21 +31,30 @@ main(int argc, char *argv[]) global_game_variables_t gvar; player_t player[MaxPlayers]; //extern struct inconfig inpu; - dbg_testkeyin=1; + dbg_testkeyin=0; dbg_testcontrolnoisy=1; - IN_Startup(); - IN_Default(0,&player,ctrl_Joystick1); - IN_SetControlType(0,&player,ctrl_Joystick1); - //while(!IN_KeyDown(sc_Escape)) + dbg_noplayerinpu=1; + if(!dbg_noplayerinpu) + { + IN_Startup(); + IN_Default(0,&player,ctrl_Joystick1); + IN_SetControlType(/*0,*/&player,ctrl_Joystick1); + } player[0].q=1; player[0].d=2; player[0].persist_aniframe=0; player[0].speed=4; start_timer(&gvar); + nibbletest(); + if(dbg_noplayerinpu) getch(); + booleantest(); + //printf("nibble size is %u\n", sizeof(nibble)); + if(!dbg_noplayerinpu){ + printf("dbg_testkeyin=%u dbg_testcontrolnoisy=%u dbg_noplayerinpu=%u\nloop if this is not responsive then please KILL or reset machine sorry!!\n", dbg_testkeyin, dbg_testcontrolnoisy, dbg_noplayerinpu); while(!IN_KeyDown(sc_Escape)) { - //shinkutxt(&gvar); - IN_ReadControl(0,&player); + shinkutxt(&gvar); + IN_ReadControl(/*0,*/&player); #define INC_PER_FRAME if(player[0].q&1) player[0].persist_aniframe++; if(player[0].persist_aniframe>4) player[0].persist_aniframe = 1; switch(player[0].d) { @@ -101,10 +111,11 @@ main(int argc, char *argv[]) //IN_Ack(); } } - IN_Shutdown(); + IN_Shutdown(); } //printf("%u\n", in.Keyboard[sc_Escape]); printf("inputest.exe "); printf("version %s\n", VERSION); printf("testkeyin=%u\n", dbg_testkeyin); printf("testcontrolnoisy=%u\n", dbg_testcontrolnoisy); + printf("dbg_noplayerinpu=%u\n", dbg_noplayerinpu); } diff --git a/src/lib/16_dbg.c b/src/lib/16_dbg.c index 13d5846d..960e7604 100755 --- a/src/lib/16_dbg.c +++ b/src/lib/16_dbg.c @@ -1,5 +1,16 @@ +#include "src/lib/16_dbg.h" +//#include "src/16.h" + + +#ifdef __DEBUG__ +#ifdef __DEBUG_PM__ +boolean dbg_debugpm=0; +#endif +#ifdef __DEBUG_InputMgr__ +boolean dbg_testkeyin=0,dbg_testcontrolnoisy=0,dbg_noplayerinpu=0; +#endif +#endif -#include "src/16.h" // TODO: Could we also provide a build mode to emit debug to the "Bochs E9 hack?" #ifdef DEBUGSERIAL @@ -10,15 +21,6 @@ unsigned char _DEBUG_INITed = 0; struct info_8250 *_DEBUG_uart = NULL; -#ifdef __DEBUG__ -#ifdef __DEBUG_PM__ -boolean dbg_debugpm=0; -#endif -#ifdef __DEBUG_InputMgr__ -boolean dbg_testkeyin=0,dbg_testcontrolnoisy=0; -#endif -#endif - int _DEBUG_INIT() { if (!_DEBUG_INITed) { unsigned int i; diff --git a/src/lib/16_dbg.h b/src/lib/16_dbg.h index 1454e091..32c89b59 100755 --- a/src/lib/16_dbg.h +++ b/src/lib/16_dbg.h @@ -2,16 +2,21 @@ #ifndef _SRC_LIB_16_DBG #define _SRC_LIB_16_DBG -//#define __DEBUG__ +#include "src/lib/16_head.h" +#include "src/lib/16_tdef.h" + +#define __DEBUG__ +#define __DEBUG_InputMgr__ //#define __DEBUG_PM__ //#define __DEBUG_MM__ + #ifdef __DEBUG__ #ifdef __DEBUG_PM__ -extern boolean dbg_debugpm=0; +extern boolean dbg_debugpm; #endif #ifdef __DEBUG_InputMgr__ -extern boolean dbg_testkeyin=0,dbg_testcontrolnoisy=0; +extern boolean dbg_testkeyin,dbg_testcontrolnoisy,dbg_noplayerinpu; #endif #endif diff --git a/src/lib/16_t.h b/src/lib/16_t.h index ada39a11..b0fdb481 100755 --- a/src/lib/16_t.h +++ b/src/lib/16_t.h @@ -41,6 +41,11 @@ typedef unsigned long int diword; typedef signed long int sdiword; typedef enum {false,true} boolean; +typedef enum {ichi,ni,san,yon,go,roku,shichi,hachi,kyu,ju,juichi,juni,jusan,juyon,jugo,juroku} nibble; +//typedef unsigned nibb:4 nibble; + +#define HI_NIBBLE(b) (((b) >> 4) & 0x0F) +#define LO_NIBBLE(b) ((b) & 0x0F) /*typedef unsigned memseg; memptr should be replaced by memseg in code. diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index b2acec13..414e51a1 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -70,13 +70,13 @@ void Startup16(global_game_variables_t *gvar) gvar->mm.mmstarted=0; gvar->pm.PMStarted=0; MM_Startup(gvar); +if(!dbg_noplayerinpu) IN_Startup(gvar); PM_Startup(gvar); PM_UnlockMainMem(gvar); CA_Startup(gvar); #ifdef __WATCOMC__ start_timer(gvar); - #endif } @@ -96,6 +96,7 @@ void Startup16(global_game_variables_t *gvar) void Shutdown16(global_game_variables_t *gvar) { PM_Shutdown(gvar); +if(!dbg_noplayerinpu) IN_Shutdown(gvar); CA_Shutdown(gvar); MM_Shutdown(gvar); @@ -205,3 +206,51 @@ void Quit (char *error) #endif //=========================================================================== + +const char *nibble_to_binary(nibble x) +{ + static char b[9]; + int z; + + b[0] = '\0'; + for (z = 8; z > 0; z >>= 1) + { + strcat(b, ((x & z) == z) ? "1" : "0"); + } + return b; +} + +const char *boolean_to_binary(boolean x) +{ + static char b[9]; + int z; + + b[0] = '\0'; + for (z = 1; z > 0; z >>= 1) + { + strcat(b, ((x & z) == z) ? "1" : "0"); + } + return b; +} + +void nibbletest() +{ + nibble pee; + printf("nibbletest\n"); + /* nibble to binary string */ + for(pee=0;pee<18;pee++) + printf(" %u %s\n", pee, nibble_to_binary(pee)); + printf(" sizeof(nibble)=%s\n", nibble_to_binary(sizeof(nibble))); + printf("end of nibble test\n"); +} + +void booleantest() +{ + boolean pee; + printf("booleantest\n"); + /* boolean to binary string */ + for(pee=0;pee<4;pee++) + printf(" %u %s\n", pee, boolean_to_binary(pee)); + printf(" sizeof(boolean)=%s\n", boolean_to_binary(sizeof(boolean))); + printf("end of boolean test\n"); +} diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index b22affdd..8d1274d8 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -35,5 +35,7 @@ void Startup16(global_game_variables_t *gvar); #ifdef __WATCOMC__ void Quit (char *error); #endif +void nibbletest(); +void booleantest(); #endif diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index f535c75d..137b0bfb 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -64,11 +64,9 @@ typedef struct { byte *palette; } planar_buf_t; - -enum direction {STOP, UP, DOWN, LEFT, RIGHT}; typedef struct { int dx, dy; //backwards compait - word id; /* the Identification number of the page~ For layering~ */ + nibble id; /* the Identification number of the page~ For layering~ */ byte far* data; /* the data for the page */ word sw; /* screen width */ word sh; /* screen heigth */ @@ -85,8 +83,8 @@ typedef struct { word stridew; /*width/4*/ word pagesize; /* page size */ word pi; /* incremention page by this much to preserve location */ - word delta; // How much should we shift the page for smooth scrolling - enum direction d; // Direction we should shift the page + sword delta; // How much should we shift the page for smooth scrolling + //enum direction d; // Direction we should shift the page } page_t; typedef struct { diff --git a/src/lib/zcroll16.c b/src/lib/zcroll16.c index 52182f2b..a58dfad1 100755 --- a/src/lib/zcroll16.c +++ b/src/lib/zcroll16.c @@ -185,47 +185,7 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) } } -unsigned char shinku_fps_indicator_page = 2; boolean pageflipflop = 1; -boolean pageploop = 1; - -/* sync */ -void shinku(global_game_variables_t *gv) -{ - word x = (0) + gv->video.page[/*!*/(gv->video.p)].dx; // follow the screen - word y = (0) + gv->video.page[/*!*/(gv->video.p)].dy; // follow the screen - word w = 64, h = 8, col = 7, bgcol = 0, type = 1; - byte o,o2,i; - if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second)) - { - sprintf(gv->pee, "%.0f fps", (double)gv->kurokku.tiku/ticktock(gv)); - //modexClearRegion(&(gv->video.page[shinku_fps_indicator_page]), x, y, w, h, 45); - modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, col, bgcol, gv->pee); - gv->kurokku.tiku=0; - }else //copy dat sheet - gv->kurokku.tiku++; - - switch(gv->kurokku.fpscap) - { - case 0: - gv->kurokku.frames_per_second=1; - break; - case 1: - //turn this off if XT - vga_wait_for_vsync(); - gv->kurokku.frames_per_second=60; - break; - } - /* - if(pageflipflop){ - if(gv->video.r){ - if(!pageploop) modexCopyPageRegion(&(gv->video.page[(gv->video.p)]), &(gv->video.page[(!gv->video.p)]), 0, 0, 0, 0, gv->video.page[gv->video.p].width, gv->video.page[!gv->video.p].height); - modexShowPage(&(gv->video.page[gv->video.p])); - if(!pageploop) gv->video.p=!gv->video.p; - gv->video.r=!gv->video.r; - } - }*/ -} void near animatePlayer(map_view_t *pip, player_t *player, sword scrollswitch) { diff --git a/src/scroll.c b/src/scroll.c index dd2db336..c92469cb 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -24,10 +24,13 @@ #include "src/lib/16_timer.h" #include "src/lib/wcpu/wcpu.h" #include "src/lib/mapread.h" +#include "src/lib/16_dbg.h" //#define FADE #define MODEX //this is for mode x initiating +boolean dbg_noplayerinpu=1; + //word far *clock= (word far*) 0x046C; /* 18.2hz clock */ //bitmap_t *p; global_game_variables_t gvar; @@ -39,7 +42,7 @@ float t; sword bakapee; pan_t pan; //debugswitches -boolean panswitch=0; +boolean panswitch=1; //extern boolean pageflipflop=1; unsigned int i; const char *cpus; @@ -119,9 +122,12 @@ void main(int argc, char *argv[]) #endif /* input! */ + if(!dbg_noplayerinpu) + { IN_Startup(); IN_Default(0,&player,ctrl_Joystick); //IN_Default(1,&player,ctrl_Joystick); + } /* save the palette */ #ifdef MODEX @@ -213,6 +219,7 @@ void main(int argc, char *argv[]) modexFadeOn(4, gpal); #endif #endif + if(!dbg_noplayerinpu) while(!IN_KeyDown(sc_Escape) && player[0].hp>0) { shinku(&gvar); @@ -307,6 +314,11 @@ void main(int argc, char *argv[]) //if(IN_KeyDown(11)){ modexPalOverscan(15); } if((player[0].q==1) && !(player[0].x%TILEWH==0 && player[0].y%TILEWH==0)) break; //incase things go out of sync! } + else + while(!kbhit()) + { + shinku(&gvar); + } /* fade back to text mode */ /* but 1st lets save the game palette~ */ @@ -318,6 +330,7 @@ void main(int argc, char *argv[]) #endif VGAmodeX(0, 1, &gvar); #endif + if(!dbg_noplayerinpu) IN_Shutdown(); printf("\nProject 16 scroll.exe. This is just a test file!\n"); printf("version %s\n", VERSION); diff --git a/src/zcroll.c b/src/zcroll.c index 2837930c..10f87f66 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -24,9 +24,12 @@ #include "src/lib/16_timer.h" #include "src/lib/wcpu/wcpu.h" #include "src/lib/16render.h" +#include "src/lib/16_dbg.h" -//TODO: known issues the array dependent mv stuff and player arrays +#define MODEXZ +boolean dbg_noplayerinpu=1; +//TODO: known issues the array dependent mv stuff and player arrays global_game_variables_t gvar; static map_t map; player_t *player; @@ -60,7 +63,7 @@ void main(int argc, char *argv[]) pan.pn=0; // OK, this one takes hellova time and needs to be done in farmalloc or MM_... - //USE MM AND CA AND PM WWWWWWWW + //TODO: USE MM AND CA AND PM WWWWWWWW player = malloc(sizeof(player_t)); player->ent = malloc(sizeof(entity_t)); player->ent->spri = malloc(sizeof(struct sprite)); @@ -78,7 +81,10 @@ void main(int argc, char *argv[]) read_vrs(&gvar, "data/spri/chikyuu.vrs", player->ent->spri->spritesheet); printf("sprite loaded\n"); // input! +if(!dbg_noplayerinpu) +{ IN_Default(0, player,ctrl_Joystick); printf("IN_defaulted\n"); +} // save the palette #ifdef FADE @@ -88,7 +94,7 @@ void main(int argc, char *argv[]) #endif textInit(); VGAmodeX(bakapee, 1, &gvar); - #ifdef MODEXZ +#ifdef MODEXZ #ifdef FADE modexPalBlack(); //reset the palette~ printf("VGA\n"); @@ -102,13 +108,19 @@ void main(int argc, char *argv[]) #endif // setup camera and screen~ +if(dbg_noplayerinpu) +{ + //sprintf(&gvar.pee, "press a key for video setup"); + strcpy(global_temp_status_text, "press a key for video setup"); + modexprint(mv->page, 0, 64, 1, 7, 0, global_temp_status_text); + getch(); +} modexHiganbanaPageSetup(&gvar.video); mv->page = &gvar.video.page[0]; mv->map = ↦ mv->video = &gvar.video; mv->pan = &pan; player->ent->spri->x = player->ent->spri->y = 20; - printf("pages ok\n"); // set up paging //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen @@ -145,6 +157,7 @@ void main(int argc, char *argv[]) modexFadeOn(4, gpal); #endif printf("LOOP\n"); + if(!dbg_noplayerinpu) while(!IN_KeyDown(sc_Escape) && player->hp>0) { shinku(&gvar); @@ -220,6 +233,12 @@ void main(int argc, char *argv[]) player->hp = 0; } + else + while(!kbhit()) + { + shinku(&gvar); + } + /* fade back to text mode */ /* but 1st lets save the game palette~ */ #ifdef FADE