From f238018d45d05a57a7ba93381f14f9d1b108c745 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Fri, 13 Jan 2017 09:26:12 -0600 Subject: [PATCH] ==== MAJOR CHANGES ARE BEING MADE!! WWWW ==== --- DEBUG.16W | 210 +++++++++++++++++++ HEAP.16W | 69 +++++++ MMDUMP.16W | Bin 0 -> 2550 bytes src/0.c | 2 +- src/inputest.c | 36 ++-- src/lib/16_enti.h | 32 +-- src/lib/16_in.c | 36 ++-- src/lib/16_in.h | 15 +- src/lib/16_tdef.h | 97 ++++++++- src/lib/doslib | 2 +- src/lib/scroll16.c | 453 ++++++++++++++++++++++++----------------- src/lib/scroll16.h | 21 +- src/lib/wcpu/16_wcpu.c | 19 +- src/scroll.c | 18 +- src/test.c | 3 +- src/vrstest.c | 8 +- src/zcroll.c | 8 +- wcpu.exe | Bin 13136 -> 13312 bytes 18 files changed, 749 insertions(+), 280 deletions(-) create mode 100755 DEBUG.16W create mode 100755 HEAP.16W create mode 100755 MMDUMP.16W diff --git a/DEBUG.16W b/DEBUG.16W new file mode 100755 index 00000000..6bab6d13 --- /dev/null +++ b/DEBUG.16W @@ -0,0 +1,210 @@ +Seg:0 Size:9962 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++0000 +Seg:27b3 Size:44 Owner:0x0 ++ +Seg:27df Size:256 Owner:0x1954 +++++ +Seg:28df Size:256 Owner:0x1746 +++++ +Seg:29df Size:256 Owner:0x1748 ++++++ +Seg:2adf Size:256 Owner:0x174a +++++ +Seg:2bdf Size:256 Owner:0x174c +++++ +Seg:2cdf Size:256 Owner:0x174e +++++ +Seg:2ddf Size:256 Owner:0x1750 +++++ +Seg:2edf Size:256 Owner:0x1752 ++++++ +Seg:2fdf Size:256 Owner:0x1754 +++++ +Seg:30df Size:256 Owner:0x1756 +++++ +Seg:31df Size:256 Owner:0x1758 +++++ +Seg:32df Size:256 Owner:0x175a +++++ +Seg:33df Size:256 Owner:0x175c ++++++ +Seg:34df Size:256 Owner:0x175e +++++ +Seg:35df Size:256 Owner:0x1760 +++++ +Seg:36df Size:256 Owner:0x1762 +++++ +Seg:37df Size:256 Owner:0x1764 +++++ +Seg:38df Size:256 Owner:0x1766 ++++++ +Seg:39df Size:256 Owner:0x1768 +++++ +Seg:3adf Size:256 Owner:0x176a +++++ +Seg:3bdf Size:256 Owner:0x176c +++++ +Seg:3cdf Size:256 Owner:0x176e +++++ +Seg:3ddf Size:256 Owner:0x1770 ++++++ +Seg:3edf Size:256 Owner:0x1772 +++++ +Seg:3fdf Size:256 Owner:0x1774 +++++ +Seg:40df Size:256 Owner:0x1776 +++++ +Seg:41df Size:256 Owner:0x1778 +++++ +Seg:42df Size:256 Owner:0x177a ++++++ +Seg:43df Size:256 Owner:0x177c +++++ +Seg:44df Size:256 Owner:0x177e +++++ +Seg:45df Size:256 Owner:0x1780 +++++ +Seg:46df Size:256 Owner:0x1782 +++++ +Seg:47df Size:256 Owner:0x1784 ++++++ +Seg:48df Size:256 Owner:0x1786 +++++ +Seg:49df Size:256 Owner:0x1788 +++++ +Seg:4adf Size:256 Owner:0x178a +++++ +Seg:4bdf Size:256 Owner:0x178c +++++ +Seg:4cdf Size:256 Owner:0x178e ++++++ +Seg:4ddf Size:256 Owner:0x1790 +++++ +Seg:4edf Size:256 Owner:0x1792 +++++ +Seg:4fdf Size:256 Owner:0x1794 +++++ +Seg:50df Size:256 Owner:0x1796 +++++ +Seg:51df Size:256 Owner:0x1798 ++++++ +Seg:52df Size:256 Owner:0x179a +++++ +Seg:53df Size:256 Owner:0x179c +++++ +Seg:54df Size:256 Owner:0x179e +++++ +Seg:55df Size:256 Owner:0x17a0 +++++ +Seg:56df Size:256 Owner:0x17a2 ++++++ +Seg:57df Size:256 Owner:0x17a4 +++++ +Seg:58df Size:256 Owner:0x17a6 +++++ +Seg:59df Size:256 Owner:0x17a8 +++++ +Seg:5adf Size:256 Owner:0x17aa +++++ +Seg:5bdf Size:256 Owner:0x17ac ++++++ +Seg:5cdf Size:256 Owner:0x17ae +++++ +Seg:5ddf Size:256 Owner:0x17b0 +++++ +Seg:5edf Size:256 Owner:0x17b2 +++++ +Seg:5fdf Size:256 Owner:0x17b4 +++++ +Seg:60df Size:256 Owner:0x17b6 ++++++ +Seg:61df Size:256 Owner:0x17b8 +++++ +Seg:62df Size:256 Owner:0x17ba +++++ +Seg:63df Size:256 Owner:0x17bc +++++ +Seg:64df Size:256 Owner:0x17be +++++ +Seg:65df Size:256 Owner:0x17c0 ++++++ +Seg:66df Size:256 Owner:0x17c2 +++++ +Seg:67df Size:256 Owner:0x17c4 +++++ +Seg:68df Size:256 Owner:0x17c6 +++++ +Seg:69df Size:256 Owner:0x17c8 +++++ +Seg:6adf Size:256 Owner:0x17ca ++++++ +Seg:6bdf Size:256 Owner:0x17cc +++++ +Seg:6cdf Size:256 Owner:0x17ce +++++ +Seg:6ddf Size:256 Owner:0x17d0 +++++ +Seg:6edf Size:256 Owner:0x17d2 +++++ +Seg:6fdf Size:256 Owner:0x17d4 ++++++ +Seg:70df Size:256 Owner:0x17d6 +++++ +Seg:71df Size:256 Owner:0x17d8 +++++ +Seg:72df Size:256 Owner:0x17da +++++ +Seg:73df Size:256 Owner:0x17dc +++++ +Seg:74df Size:256 Owner:0x17de ++++++ +Seg:75df Size:256 Owner:0x17e0 +++++ +Seg:76df Size:256 Owner:0x17e2 +++++ +Seg:77df Size:256 Owner:0x17e4 +++++ +Seg:78df Size:256 Owner:0x17e6 +++++ +Seg:79df Size:256 Owner:0x17e8 ++++++ +Seg:7adf Size:256 Owner:0x17ea +++++ +Seg:7bdf Size:256 Owner:0x17ec +++++ +Seg:7cdf Size:256 Owner:0x17ee +++++ +Seg:7ddf Size:256 Owner:0x17f0 +++++ +Seg:7edf Size:256 Owner:0x17f2 ++++++ +Seg:7fdf Size:256 Owner:0x17f4 +++++ +Seg:80df Size:256 Owner:0x17f6 +++++ +Seg:81df Size:256 Owner:0x17f8 +++++ +Seg:82df Size:256 Owner:0x17fa +++++ +Seg:83df Size:256 Owner:0x17fc ++++++ +Seg:84df Size:256 Owner:0x17fe +++++ +Seg:85df Size:256 Owner:0x1800 +++++ +Seg:86df Size:256 Owner:0x1802 +++++ +Seg:87df Size:256 Owner:0x1804 +++++ +Seg:88df Size:256 Owner:0x1806 ++++++ +Seg:89df Size:256 Owner:0x1808 +++++ +Seg:8adf Size:256 Owner:0x180a +++++ +Seg:8bdf Size:256 Owner:0x180c +++++ +Seg:8cdf Size:401 Owner:0xef22 +++++++ +Seg:b7df Size:18464 Owner:0x0 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \ No newline at end of file diff --git a/HEAP.16W b/HEAP.16W new file mode 100755 index 00000000..c1fae019 --- /dev/null +++ b/HEAP.16W @@ -0,0 +1,69 @@ + + == default == + + USED block at 27d50016 of size 136 + FREE block at 27d5009e of size 68 + USED block at 27d500e2 of size 50 + USED block at 27d50114 of size 50 + USED block at 27d50146 of size 50 + USED block at 27d50178 of size 50 + USED block at 27d501aa of size 50 + USED block at 27d501dc of size 50 + USED block at 27d5020e of size 50 + USED block at 27d50240 of size 50 + USED block at 27d50272 of size 50 + USED block at 27d502a4 of size 50 + USED block at 27d502d6 of size 50 + USED block at 27d50308 of size 50 + FREE block at 27d5033a of size 14 + USED block at 27d50348 of size 20 + FREE block at 27d5035c of size 7328 +OK - end of heap + + == near == + + USED block at 17d4ef66 of size 12 + USED block at 17d4ef72 of size 330 + USED block at 17d4f0bc of size 52 + USED block at 17d4f0f0 of size 20 + USED block at 17d4f104 of size 20 + USED block at 17d4f118 of size 20 + USED block at 17d4f12c of size 20 + USED block at 17d4f140 of size 20 + USED block at 17d4f154 of size 3752 +OK - end of heap + + == far == + + USED block at 27d50016 of size 136 + USED block at 27d5009e of size 68 + USED block at 27d500e2 of size 50 + USED block at 27d50114 of size 50 + USED block at 27d50146 of size 50 + USED block at 27d50178 of size 50 + USED block at 27d501aa of size 50 + USED block at 27d501dc of size 50 + USED block at 27d5020e of size 50 + USED block at 27d50240 of size 50 + USED block at 27d50272 of size 50 + USED block at 27d502a4 of size 50 + USED block at 27d502d6 of size 50 + USED block at 27d50308 of size 50 + USED block at 27d5033a of size 14 + USED block at 27d50348 of size 20 + USED block at 27d5035c of size 7328 +OK - end of heap + +Memory Type Total Used Free +---------------- -------- -------- -------- +Default 8166 756 7410 +Near 4246 494 3752 +Far 8166 756 7410 +---------------- -------- -------- -------- +coreleft = 3750 +farcoreleft = 35566 +GetFreeSize = 31836 +GetNearFreeSize = 3752 +GetFarFreeSize = 31836 +memavl = 3750 +stackavail = 31545 diff --git a/MMDUMP.16W b/MMDUMP.16W new file mode 100755 index 0000000000000000000000000000000000000000..dabc7f6fdc3463a10e7e5b67f506148261f7b6dc GIT binary patch literal 2550 zcmZ|Ry-h z=hNHqapY@CFVE>WghEpo3Jc*(3O9wjf*hwDryQporyN<1EJv0j%aP^Ca%4HO97T>I zN0Fn*QRFCc6gi3+#BIl3G}jv>d8W5_Y&7;+3bh8$ClDaVv!$}#1ba!fg<97~QR z$C6{ovE*2CEIF1OTaGQqmSfAY<=Ap;IW`=T;D`iABse0$5ebe+a72Qmo{!^~{~K=Y M+vDBK_usht0VksO9smFU literal 0 HcmV?d00001 diff --git a/src/0.c b/src/0.c index f635289a..2eceb18a 100755 --- a/src/0.c +++ b/src/0.c @@ -141,7 +141,7 @@ int main(int argc,char **argv) gvar.video.page[0].dx=gvar.video.page[0].dy=gvar.video.page[1].dx=gvar.video.page[1].dy=16; mv[0].tx = mv[0].ty = mv[1].tx = mv[1].ty = INITTNUM; modexShowPage(&(gvar.video.page[gvar.video.panp])); - player[0].q = 1; player[0].d = 2; + player[0].enti.q = 1; player[0].enti.d = 2; x=y=0; xdir=ydir=1; //TESTBG; diff --git a/src/inputest.c b/src/inputest.c index d020d58c..07b39306 100755 --- a/src/inputest.c +++ b/src/inputest.c @@ -41,10 +41,10 @@ main(int argc, char *argv[]) IN_Default(0,&player,ctrl_Keyboard1); IN_SetControlType(0,&player,ctrl_Keyboard1); - player[0].q=1; - player[0].d=2; - player[0].persist_aniframe=0; - player[0].speed=4; + player[0].enti.q=1; + player[0].enti.d=2; + player[0].enti.persist_aniframe=0; + player[0].enti.speed=4; //0000 nibbletest(); //0000 booleantest(); @@ -53,43 +53,43 @@ main(int argc, char *argv[]) { //0000 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) + #define INC_PER_FRAME if(player[0].enti.q&1) player[0].enti.persist_aniframe++; if(player[0].enti.persist_aniframe>4) player[0].enti.persist_aniframe = 1; + switch(player[0].enti.d) { //right movement case 3: - if(player[0].q<=(TILEWH/(player[0].speed))) + if(player[0].enti.q<=(TILEWH/(player[0].enti.speed))) { INC_PER_FRAME; - player[0].q++; - } else { player[0].q = 1; player[0].d = 2; } + player[0].enti.q++; + } else { player[0].enti.q = 1; player[0].enti.d = 2; } break; //left movement case 1: - if(player[0].q<=(TILEWH/(player[0].speed))) + if(player[0].enti.q<=(TILEWH/(player[0].enti.speed))) { INC_PER_FRAME; - player[0].q++; - } else { player[0].q = 1; player[0].d = 2; } + player[0].enti.q++; + } else { player[0].enti.q = 1; player[0].enti.d = 2; } break; //down movement case 4: - if(player[0].q<=(TILEWH/(player[0].speed))) + if(player[0].enti.q<=(TILEWH/(player[0].enti.speed))) { INC_PER_FRAME; - player[0].q++; - } else { player[0].q = 1; player[0].d = 2; } + player[0].enti.q++; + } else { player[0].enti.q = 1; player[0].enti.d = 2; } break; //up movement case 0: - if(player[0].q<=(TILEWH/(player[0].speed))) + if(player[0].enti.q<=(TILEWH/(player[0].enti.speed))) { INC_PER_FRAME; - player[0].q++; - } else { player[0].q = 1; player[0].d = 2; } + player[0].enti.q++; + } else { player[0].enti.q = 1; player[0].enti.d = 2; } break; } //printf("%u\n", IN_KeyDown(sc_Escape)); diff --git a/src/lib/16_enti.h b/src/lib/16_enti.h index 17ee10fa..4e92d990 100755 --- a/src/lib/16_enti.h +++ b/src/lib/16_enti.h @@ -5,21 +5,21 @@ #include "src/lib/16_head.h" #include "src/lib/16_in.h" - -typedef struct -{ - int x; // exact position on the viewable map - int y; // exact position on the viewable map - int tx; // tile position on the viewable map - int ty; // tile position on the viewable map - int triggerx; // trigger box tile position on the viewable map - int triggery; // trigger box tile position on the viewable map - byte d; // direction the NPC faces - struct sprite *spri; // sprite used by NPC - sword hp; // hitpoints of the NPC - byte near pdir; // previous direction~ - word speed; // NPC's speed - word spt; // speed per tile -} entity_t; +//moved to 16_tdef.h +// typedef struct +// { +// int x; // exact position on the viewable map +// int y; // exact position on the viewable map +// int tx; // tile position on the viewable map +// int ty; // tile position on the viewable map +// int triggerx; // trigger box tile position on the viewable map +// int triggery; // trigger box tile position on the viewable map +// byte d; // direction the NPC faces +// struct sprite *spri; // sprite used by NPC +// sword hp; // hitpoints of the NPC +// byte near pdir; // previous direction~ +// word speed; // NPC's speed +// word spt; // speed per tile +// } entity_t; #endif diff --git a/src/lib/16_in.c b/src/lib/16_in.c index 314ddbfd..2e54a627 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -703,7 +703,7 @@ IN_Default(boolean gotit,player_t *player,ControlType nt) //in.KbdDefs[0].downright = 0x51; IN_SetControlType(0,player,nt); for(i=0; i>MaxPlayers;i++) - player[i].d=2; + player[i].enti.d =2; } /////////////////////////////////////////////////////////////////////////// @@ -814,7 +814,7 @@ IN_ReadCursor(CursorInfo *info) // /////////////////////////////////////////////////////////////////////////// void near -IN_ReadControl(int pn,player_t *player) +IN_ReadControl(word pn, player_t *player) { boolean realdelta; #if DEMO0 @@ -949,10 +949,10 @@ register KeyboardDef *def; player[pn].info.dir = DirTable[conpee]; if(DirTable[conpee]!=2) player[pn].pdir=DirTable[conpee]; - if(player[pn].q==1 &&( dir!=2 || (mx!=motion_None || my!=motion_None))) + if(player[pn].enti.q==1 &&( dir!=2 || (mx!=motion_None || my!=motion_None))) { - if(dir==2) player[pn].d = player[pn].info.dir; - else player[pn].d = DirTable[dir]; + if(dir==2) player[pn].enti.d = player[pn].info.dir; + else player[pn].enti.d = DirTable[dir]; } #if DEMO0 @@ -982,12 +982,12 @@ register KeyboardDef *def; #endif #ifdef __DEBUG_InputMgr__ if(dbg_testcontrolnoisy > 0) -if(player[pn].info.dir!=2/*(inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])*/ || player[pn].q>1) +if(player[pn].info.dir!=2/*(inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])*/ || player[pn].enti.q>1) { //printf("b1=%u b2=%u b3=%u b4=%u ", player[pn].info.button0, player[pn].info.button1, player[pn].info.button2, player[pn].info.button3); - //printf("q=%d ", player[pn].q); + //printf("q=%d ", player[pn].enti.q); //printf("cpee=%c ", dirchar(conpee)); - printf("pdir=%c d=%c dir=%c ", dirchar(player[pn].pdir), dirchar(player[pn].d), dirchar(player[pn].info.dir)); + printf("pdir=%c d=%c dir=%c ", dirchar(player[pn].pdir), dirchar(player[pn].enti.d), dirchar(player[pn].info.dir)); /*if(realdelta) */printf("dx=%d dy=%d mx=%d my=%d", player[pn].info.x, player[pn].info.y, player[pn].info.xaxis, player[pn].info.yaxis); //else if(!realdelta) printf("%c%d %c%d %c%d %c%d", dirchar(0), inpu.Keyboard[def->up], dirchar(4), inpu.Keyboard[def->down], dirchar(1), inpu.Keyboard[def->left], dirchar(3), inpu.Keyboard[def->right]); printf("\n"); @@ -1279,18 +1279,18 @@ boolean IN_qb(byte kee) //init player! void IN_initplayer(player_t *player, word pn) { - player[pn].x = player[pn].tx*TILEWH; - player[pn].y = player[pn].ty*TILEWH; - player[pn].triggerx = player[pn].tx; - player[pn].triggery = player[pn].ty+1; + player[pn].enti.x = player[pn].enti.tx*TILEWH; + player[pn].enti.y = player[pn].enti.ty*TILEWH; + player[pn].enti.triggerx = player[pn].enti.tx; + player[pn].enti.triggery = player[pn].enti.ty+1; /* player[0].info.x = player[0].tx; player[0].info.xaxis = player[0].tx*TILEWH; player[0].info.y = player[0].ty; player[0].info.yaxis = player[0].ty*TILEWH;*/ - player[pn].q=1; - player[pn].d=2; - player[pn].hp=4; - player[pn].speed=4; - player[pn].persist_aniframe=0; - player[pn].spt=(TILEWH/(player[pn].speed)); //speed per tile wwww + player[pn].enti.q =1; + player[pn].enti.d =2; + player[pn].enti.hp=4; + player[pn].enti.speed=4; + player[pn].enti.persist_aniframe=0; + player[pn].enti.spt=(TILEWH/(player[pn].enti.speed)); //speed per tile wwww } diff --git a/src/lib/16_in.h b/src/lib/16_in.h index 5e23274d..f03b337d 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -56,7 +56,7 @@ #define MaxPads 2 #define NumCodes 128 -typedef byte ScanCode; +//typedef byte ScanCode; #define sc_None 0 #define sc_Bad 0xff #define sc_Return 0x1c @@ -155,7 +155,8 @@ typedef enum { demo_Off,demo_Record,demo_Playback,demo_PlayDone } Demo; #endif -typedef enum { +//moved to 16_tdef.h +/*typedef enum { //ctrl_None, // MDM (GAMERS EDGE) - added ctrl_Keyboard, ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2, @@ -216,12 +217,8 @@ typedef struct byte d; //direction to render sprite!! wwww byte q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www byte near pdir; //previous direction~ - //byte near kd[2]; //array of arrow key pressed word speed; //player speed! word spt; //speed per tile -//0000 planar_buf_t huge *data; //supposively the sprite sheet data -// planar_buf_t data; //supposively the sprite sheet data -////0000---- #ifdef __WATCOMC__ struct sprite *spri; //supposively the sprite sheet data memptr gr; @@ -230,12 +227,12 @@ typedef struct bitmap_t *data; //supposively the sprite sheet data//old format bitmap_t bmp; sword hp; //hitpoints of the player - int persist_aniframe; /* gonna be increased to 1 before being used, so 0 is ok for default */ + int persist_aniframe; // gonna be increased to 1 before being used, so 0 is ok for default CursorInfo info; ControlType Controls; //newer vars int dx, dy, delta; //TODO: what is this? ^^ -} player_t; +} player_t;*/ /* ============================================================================= @@ -287,7 +284,7 @@ extern void IN_SetKeyHook(void (*hook)()); extern void IN_ClearKeysDown(); //static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy); extern void IN_ReadCursor(CursorInfo *info); -extern void near IN_ReadControl(int pn,player_t *player); +extern void near IN_ReadControl(word pn, player_t *player); extern void IN_SetControlType(word pn,player_t *player,ControlType type); #if DEMO0 extern boolean IN_StartDemoRecord(word bufsize); diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 00ce03a3..5936022d 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -89,7 +89,7 @@ typedef struct { char name[16]; } map_t; -// tile info +//TODO USE THIS tile info typedef struct{ word tw; /* screen width in tiles */ word th; /* screen height in tiles */ @@ -126,6 +126,26 @@ typedef struct { sword delta; // How much should we shift the page for smooth scrolling } page_t; +//new structs +typedef struct +{ + int x; //entity exact position on the viewable map + int y; //entity exact position on the viewable map + int tx; //entity tile position on the viewable map + int ty; //entity tile position on the viewable map + int triggerx; //entity's trigger box tile position on the viewable map + int triggery; //entity's trigger box tile position on the viewable map + int sheetsetx; //NOT USED YET! entity sprite sheet set on the image x + int sheetsety; //NOT USED YET! entity sprite sheet set on the image y + byte d; //direction to render sprite!! wwww + byte q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www + word speed; //entity speed! + word spt; //speed per tile + struct sprite *spri; // sprite used by entity + sword hp; //hitpoints of the entity + int persist_aniframe; /* gonna be increased to 1 before being used, so 0 is ok for default */ +} entity_t; + //TODO: MAKE THIS WWWW typedef struct { @@ -140,6 +160,81 @@ typedef struct spri_t *spri; } vrs_t; +//from 16_in +//========================================================================== +typedef byte ScanCode; + +typedef enum { + //ctrl_None, // MDM (GAMERS EDGE) - added + ctrl_Keyboard, + ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2, + ctrl_Joystick, + ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2, + ctrl_Mouse, + } ControlType; +typedef enum { + motion_Left = -1,motion_Up = -1, + motion_None = 0, + motion_Right = 1,motion_Down = 1 + } Motion; +typedef enum { + dir_North,//dir_NorthEast, + dir_West,//dir_Nortinest, + dir_None, + dir_East,//,dir_SouthEast, + dir_South,//dir_Soutinest, + } Direction; +typedef struct { + boolean near button0,button1,button2,button3; + int near x,y; + Motion near xaxis,yaxis; + Direction near dir; + } CursorInfo; + +typedef struct { + ScanCode near button0,button1, + //upleft, + up, + down, + left, + right + //upright, + //downleft, + //,downright + ; + } KeyboardDef; +typedef struct { + word near joyMinX,joyMinY, + threshMinX,threshMinY, + threshMaxX,threshMaxY, + joyMaxX,joyMaxY, + joyMultXL,joyMultYL, + joyMultXH,joyMultYH; + } JoystickDef; + +//========================================================================== + +typedef struct +{ + entity_t near enti; + entity_t *ent; +#ifdef __WATCOMC__ + //struct sprite *spri; //supposively the sprite sheet data + memptr gr; +#endif + bitmap_t *data; //supposively the sprite sheet data//old format + bitmap_t bmp; + + //input + byte near pdir; //previous direction~ used in IN_16 in IN_ReadControl() + CursorInfo info; + ControlType Controls; +//newer vars + int dx, dy, delta; //TODO: what is this? ^^ +} player_t; + +//===========================================// + typedef struct { int profilehandle,debughandle,showmemhandle; diff --git a/src/lib/doslib b/src/lib/doslib index dc29677c..b68c3627 160000 --- a/src/lib/doslib +++ b/src/lib/doslib @@ -1 +1 @@ -Subproject commit dc29677c473373bf29d2c349db6aebcff24b973a +Subproject commit b68c362763ae81c36e275dc8b962558b28d46241 diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index cab3823f..51d8137d 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -24,11 +24,11 @@ */ #include "src/lib/scroll16.h" -void walk(map_view_t *pip, player_t *player, word pn) +void oldwalk(map_view_t *pip, player_t *player, word pn) { - #define INC_PER_FRAME if(player[pn].q&1) player[pn].persist_aniframe++; if(player[pn].persist_aniframe>4) player[pn].persist_aniframe = 1; - //printf("player[%d].d=%d\n", pn, player[pn].d); - switch(player[pn].d) + #define INC_PER_FRAME if(player[pn].enti.q&1) player[pn].enti.persist_aniframe++; if(player[pn].enti.persist_aniframe>4) player[pn].enti.persist_aniframe = 1; + //printf("player[%d].d=%d\n", pn, player[pn].enti.d); + switch(player[pn].enti.d) { //no direction case 2: @@ -37,10 +37,10 @@ void walk(map_view_t *pip, player_t *player, word pn) //right movement case 3: //printf("pip[0].page->tilesw=%d ", pip[0].page->tilesw); printf("pip[0].page->tw=%d\n", pip[0].page->tw); - if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && - !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! + if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->tilemidposscreenx && + !(pip[0].map->data[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection! { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); @@ -49,42 +49,42 @@ void walk(map_view_t *pip, player_t *player, word pn) //mapScrollRight(pip, player, !(pip[0].video->p), pn); mapScrollRight(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].q++; + player[pn].enti.q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; } } - else if(player[pn].tx < pip[0].map->width && !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY)) + else if(player[pn].enti.tx < pip[0].map->width && !(pip[0].map->data[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY)) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - player[pn].x+=(player[pn].speed); + player[pn].enti.x+=(player[pn].enti.speed); animatePlayer(pip, player, pn, 0); if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; } } else { - if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 24, 32); + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32); #ifdef SPRITE - modexDrawSpriteRegion(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATAPTR); + modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATAPTR); #else - modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 14); + modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 14); #endif if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].d = 2; + player[pn].enti.d = 2; } - player[pn].triggerx = player[pn].tx+1; - player[pn].triggery = player[pn].ty; + player[pn].enti.triggerx = player[pn].enti.tx+1; + player[pn].enti.triggery = player[pn].enti.ty; break; //left movement case 1: - if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && - !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! + if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->tilemidposscreenx && + !(pip[0].map->data[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection! { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); @@ -93,42 +93,42 @@ void walk(map_view_t *pip, player_t *player, word pn) //mapScrollLeft(pip, player, !(pip[0].video->p), pn); mapScrollLeft(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].q++; + player[pn].enti.q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; } } - else if(player[pn].tx > 1 && !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY)) + else if(player[pn].enti.tx > 1 && !(pip[0].map->data[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY)) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - player[pn].x-=(player[pn].speed); + player[pn].enti.x-=(player[pn].enti.speed); animatePlayer(pip, player, pn, 0); if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; } } else { - if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 24, 32); + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32); #ifdef SPRITE - modexDrawSpriteRegion(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATAPTR); + modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATAPTR); #else - modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 10); + modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 10); #endif if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].d = 2; + player[pn].enti.d = 2; } - player[pn].triggerx = player[pn].tx-1; - player[pn].triggery = player[pn].ty; + player[pn].enti.triggerx = player[pn].enti.tx-1; + player[pn].enti.triggery = player[pn].enti.ty; break; //down movement case 4: - if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && - !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY)) //collision detection! + if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->tilemidposscreeny && + !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY)) //collision detection! { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); @@ -137,42 +137,42 @@ void walk(map_view_t *pip, player_t *player, word pn) //mapScrollDown(pip, player, !(pip[0].video->p), pn); mapScrollDown(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].q++; + player[pn].enti.q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; } } - else if(player[pn].ty < pip[0].map->height && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY)) + else if(player[pn].enti.ty < pip[0].map->height && !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY)) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - player[pn].y+=(player[pn].speed); + player[pn].enti.y+=(player[pn].enti.speed); animatePlayer(pip, player, pn, 0); if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; } } else { - if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 24, 32); + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32); #ifdef SPRITE - modexDrawSpriteRegion(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATAPTR); + modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATAPTR); #else - modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 9); + modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 9); #endif if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].d = 2; + player[pn].enti.d = 2; } - player[pn].triggerx = player[pn].tx; - player[pn].triggery = player[pn].ty+1; + player[pn].enti.triggerx = player[pn].enti.tx; + player[pn].enti.triggery = player[pn].enti.ty+1; break; //up movement case 0: - if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && - !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY)) //collision detection! + if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->tilemidposscreeny && + !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY)) //collision detection! { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); @@ -181,34 +181,34 @@ void walk(map_view_t *pip, player_t *player, word pn) //mapScrollUp(pip, player, !(pip[0].video->p), pn); mapScrollUp(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].q++; + player[pn].enti.q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; } } - else if(player[pn].ty > 1 && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY)) + else if(player[pn].enti.ty > 1 && !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY)) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - player[pn].y-=(player[pn].speed); + player[pn].enti.y-=(player[pn].enti.speed); animatePlayer(pip, player, 0, pn); if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; } } else { - if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 24, 32); + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32); #ifdef SPRITE - modexDrawSpriteRegion(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATAPTR); + modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATAPTR); #else - modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 12); + modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 12); #endif if(!pageflipflop) modexShowPage(pip[1].page); - player[pn].d = 2; + player[pn].enti.d = 2; } - player[pn].triggerx = player[pn].tx; - player[pn].triggery = player[pn].ty-1; + player[pn].enti.triggerx = player[pn].enti.tx; + player[pn].enti.triggery = player[pn].enti.ty-1; break; } } @@ -225,8 +225,8 @@ src/lib/scroll16.c: mv->video->r=1; void ZC_walk(map_view_t *pip, player_t *player, word pn) { - #define INC_PER_FRAME if(player[pn].q&1) player[pn].persist_aniframe++; if(player[pn].persist_aniframe>4) player[pn].persist_aniframe = 1; - switch(player[pn].d) + #define INC_PER_FRAME if(player[pn].enti.q&1) player[pn].enti.persist_aniframe++; if(player[pn].enti.persist_aniframe>4) player[pn].enti.persist_aniframe = 1; + switch(player[pn].enti.d) { //no direction case 2: @@ -234,155 +234,155 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) break; //right movement case 3: - if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && - !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! + if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->tilemidposscreenx && + !(pip[0].map->data[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection! { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); ScrollRight(pip, player, 3, pn); ScrollRight(pip, player, 2, pn); mapScrollRight(pip, player, (pip[0].video->p), pn); - player[pn].q++; + player[pn].enti.q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; } } - else if(player[pn].tx < pip[0].map->width && !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY)) + else if(player[pn].enti.tx < pip[0].map->width && !(pip[0].map->data[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY)) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - player[pn].x+=(player[pn].speed); + player[pn].enti.x+=(player[pn].enti.speed); animatePlayer(pip, player, pn, 0); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; } } else { #ifdef SPRITE - modexDrawSpriteRegion(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATAPTR); + modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATAPTR); #else - modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 14); + modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 14); #endif - player[pn].d = 2; + player[pn].enti.d = 2; } - player[pn].triggerx = player[pn].tx+1; - player[pn].triggery = player[pn].ty; + player[pn].enti.triggerx = player[pn].enti.tx+1; + player[pn].enti.triggery = player[pn].enti.ty; break; //left movement case 1: - if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && - !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! + if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->tilemidposscreenx && + !(pip[0].map->data[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY)) //collision detection! { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); ScrollLeft(pip, player, 3, pn); ScrollLeft(pip, player, 2, pn); mapScrollLeft(pip, player, (pip[0].video->p), pn); - player[pn].q++; + player[pn].enti.q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; } } - else if(player[pn].tx > 1 && !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY)) + else if(player[pn].enti.tx > 1 && !(pip[0].map->data[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY)) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - player[pn].x-=(player[pn].speed); + player[pn].enti.x-=(player[pn].enti.speed); animatePlayer(pip, player, pn, 0); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; } } else { #ifdef SPRITE - modexDrawSpriteRegion(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATAPTR); + modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATAPTR); #else - modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 10); + modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 10); #endif - player[pn].d = 2; + player[pn].enti.d = 2; } - player[pn].triggerx = player[pn].tx-1; - player[pn].triggery = player[pn].ty; + player[pn].enti.triggerx = player[pn].enti.tx-1; + player[pn].enti.triggery = player[pn].enti.ty; break; //down movement case 4: - if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && - !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY)) //collision detection! + if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->tilemidposscreeny && + !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY)) //collision detection! { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); ScrollDown(pip, player, 3, pn); ScrollDown(pip, player, 2, pn); mapScrollDown(pip, player, (pip[0].video->p), pn); - player[pn].q++; + player[pn].enti.q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; } } - else if(player[pn].ty < pip[0].map->height && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY)) + else if(player[pn].enti.ty < pip[0].map->height && !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY)) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - player[pn].y+=(player[pn].speed); + player[pn].enti.y+=(player[pn].enti.speed); animatePlayer(pip, player, pn, 0); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; } } else { #ifdef SPRITE - modexDrawSpriteRegion(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATAPTR); + modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATAPTR); #else - modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 9); + modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 9); #endif - player[pn].d = 2; + player[pn].enti.d = 2; } - player[pn].triggerx = player[pn].tx; - player[pn].triggery = player[pn].ty+1; + player[pn].enti.triggerx = player[pn].enti.tx; + player[pn].enti.triggery = player[pn].enti.ty+1; break; //up movement case 0: - if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && - !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY)) //collision detection! + if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->tilemidposscreeny && + !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY)) //collision detection! { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); ScrollUp(pip, player, 3, pn); ScrollUp(pip, player, 2, pn); mapScrollUp(pip, player, (pip[0].video->p), pn); - player[pn].q++; + player[pn].enti.q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; } } - else if(player[pn].ty > 1 && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY)) + else if(player[pn].enti.ty > 1 && !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY)) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - player[pn].y-=(player[pn].speed); + player[pn].enti.y-=(player[pn].enti.speed); animatePlayer(pip, player, 0, pn); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; } } else { #ifdef SPRITE - modexDrawSpriteRegion(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATAPTR); + modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATAPTR); #else - modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 12); + modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 12); #endif - player[pn].d = 2; + player[pn].enti.d = 2; } - player[pn].triggerx = player[pn].tx; - player[pn].triggery = player[pn].ty-1; + player[pn].enti.triggerx = player[pn].enti.tx; + player[pn].enti.triggery = player[pn].enti.ty-1; break; } } @@ -391,18 +391,18 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) void ZC_panPageManual(map_view_t *pip, player_t *player, word pn) { #define SHOWMVFUN_ ZC_ShowMV(pip, 0, 0); - switch(player[pn].d) + switch(player[pn].enti.d) { //right movement case 3: if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].page->tilesw) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { pip[0].page->dx+=4; SHOWMVFUN_; - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[0].tx++; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; pip[0].tx++; } } break; @@ -410,12 +410,12 @@ void ZC_panPageManual(map_view_t *pip, player_t *player, word pn) case 1: if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].page->tilesw) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { pip[0].page->dx-=4; SHOWMVFUN_; - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[0].tx--; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; pip[0].tx--; } } break; @@ -423,12 +423,12 @@ void ZC_panPageManual(map_view_t *pip, player_t *player, word pn) case 4: if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].page->tilesh) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { pip[0].page->dy+=4; SHOWMVFUN_; - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[0].ty++; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; pip[0].ty++; } } break; @@ -436,12 +436,12 @@ void ZC_panPageManual(map_view_t *pip, player_t *player, word pn) case 0: if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].page->tilesh) { - if(player[pn].q<=player[pn].spt) + if(player[pn].enti.q<=player[pn].enti.spt) { pip[0].page->dy-=4; SHOWMVFUN_; - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[0].ty--; } + player[pn].enti.q++; + } else { player[pn].enti.q = 1; player[pn].enti.d = 2; pip[0].ty--; } } break; } @@ -614,7 +614,7 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) word x;//, y; /* coordinate for drawing */ /* increment the pixel position and update the page */ - mv[id].page[0].dx += player[plid].speed; + mv[id].page[0].dx += player[plid].enti.speed; /* check to see if this changes the tile */ if(mv[id].page[0].dx >= mv[id].dxThresh ) @@ -629,7 +629,7 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) /* draw the next column */ x= mv[0].page->sw + mv[id].map->tiles->tileWidth; - if(player[plid].q%4) + if(player[plid].enti.q%4) if(id==0) mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page[0].dx); else @@ -644,7 +644,7 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) word x;//,y; /* coordinate for drawing */ /* decrement the pixel position and update the page */ - mv[id].page[0].dx -= player[plid].speed; + mv[id].page[0].dx -= player[plid].enti.speed; /* check to see if this changes the tile */ if(mv[id].page[0].dx == 0) @@ -659,7 +659,7 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) /* draw the next column */ x= 0; - if(player[plid].q%4) + if(player[plid].enti.q%4) if(id==0) mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page[0].dx); else @@ -674,7 +674,7 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) word y;//x, /* coordinate for drawing */ /* decrement the pixel position and update the page */ - mv[id].page[0].dy -= player[plid].speed; + mv[id].page[0].dy -= player[plid].enti.speed; /* check to see if this changes the tile */ if(mv[id].page[0].dy == 0 ) @@ -689,7 +689,7 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) /* draw the next row */ y= 0; - if(player[plid].q%3) + if(player[plid].enti.q%3) if(id==0) mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page[0].dy); else @@ -703,7 +703,7 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) word y;//x, /* coordinate for drawing */ /* increment the pixel position and update the page */ - mv[id].page[0].dy += player[plid].speed; + mv[id].page[0].dy += player[plid].enti.speed; /* check to see if this changes the tile */ if(mv[id].page[0].dy >= mv[id].dyThresh ) @@ -718,7 +718,7 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) /* draw the next row */ y= mv[0].page->sh + mv[id].map->tiles->tileHeight; - if(player[plid].q%3) + if(player[plid].enti.q%3) if(id==0) mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, mv->page[0].dy); else @@ -732,7 +732,7 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) void near ScrollRight(map_view_t *mv, player_t *player, word id, word plid) { /* increment the pixel position and update the page */ - mv[id].page->dx += player[plid].speed; + mv[id].page->dx += player[plid].enti.speed; /* check to see if this changes the tile */ if(mv[id].page->dx >= mv[0].dxThresh ) @@ -749,7 +749,7 @@ void near ScrollRight(map_view_t *mv, player_t *player, word id, word plid) void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid) { /* decrement the pixel position and update the page */ - mv[id].page->dx -= player[plid].speed; + mv[id].page->dx -= player[plid].enti.speed; /* check to see if this changes the tile */ if(mv[id].page->dx == 0) @@ -766,7 +766,7 @@ void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid) void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid) { /* decrement the pixel position and update the page */ - mv[id].page->dy -= player[plid].speed; + mv[id].page->dy -= player[plid].enti.speed; /* check to see if this changes the tile */ if(mv[id].page->dy == 0) @@ -783,7 +783,7 @@ void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid) void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid) { /* increment the pixel position and update the page */ - mv[id].page->dy += player[plid].speed; + mv[id].page->dy += player[plid].enti.speed; /* check to see if this changes the tile */ if(mv[id].page->dy >= mv[0].dxThresh ) @@ -802,8 +802,8 @@ void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid) //default player position on the viewable map void playerXYpos(int x, int y, player_t *player, map_view_t *pip, nibble pn) { - player[pn].tx = x + pip[0].tx + pip[0].page->tilemidposscreenx; - player[pn].ty = y + pip[0].ty + pip[0].page->tilemidposscreeny; + player[pn].enti.tx = x + pip[0].tx + pip[0].page->tilemidposscreenx; + player[pn].enti.ty = y + pip[0].ty + pip[0].page->tilemidposscreeny; } //=========================================================================== @@ -948,11 +948,11 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) } } -void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *p, word poopoffset) +void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *player, word poopoffset) { word x; int i; - poopoffset%=p[0].speed; + poopoffset%=player[0].enti.speed; //printf("y: %d\n", poopoffset); /* the position within the map array */ i=ty * mv->map->width + tx; @@ -965,11 +965,11 @@ void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *p, word p } } -void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *p, word poopoffset) +void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *player, word poopoffset) { int y; int i; - poopoffset%=p[0].speed; + poopoffset%=player[0].enti.speed; //printf("x: %d\n", poopoffset); /* location in the map array */ i=ty * mv->map->width + tx; @@ -1095,15 +1095,27 @@ void shinku(global_game_variables_t *gv) } } +#ifdef SPRITE +#define FRAME1 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 48, dire, 24, 32, PLAYERBMPDATAPTR); +#define FRAME2 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, dire, 24, 32, PLAYERBMPDATAPTR); +#define FRAME3 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 0, dire, 24, 32, PLAYERBMPDATAPTR); +#define FRAME4 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, dire, 24, 32, PLAYERBMPDATAPTR); +#else +#define FRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 2+dire); +#define FRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire); +#define FRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, dire); +#define FRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire); +#endif + void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch) { - sword x = player[pn].x; - sword y = player[pn].y; + sword x = player[pn].enti.x; + sword y = player[pn].enti.y; sword bx = x+16; //buffer's x sword by = y+16; //buffer's y word dire=32; //direction sword qq; //scroll offset - word ls = player[pn].persist_aniframe; + word ls = player[pn].enti.persist_aniframe; switch(scrollswitch) { @@ -1111,22 +1123,22 @@ void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scroll qq = 0; break; default: - qq = ((player[pn].q)*(player[pn].speed)); + qq = ((player[pn].enti.q)*(player[pn].enti.speed)); break; } //x-=4; y-=pip[0].map->tiles->tileHeight; - switch (player[pn].d) + switch (player[pn].enti.d) { case 0: //up - dire*=player[pn].d; + dire*=player[pn].enti.d; y-=qq; by-=4; break; case 3: // right - dire*=(player[pn].d-2); + dire*=(player[pn].enti.d-2); x+=qq; bx+=4; break; @@ -1134,29 +1146,106 @@ void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scroll break; case 4: //down - dire*=(player[pn].d-2); + dire*=(player[pn].enti.d-2); y+=qq; by+=4; break; case 1: //left - dire*=(player[pn].d+2); + dire*=(player[pn].enti.d+2); + x-=qq; + bx-=4; + break; + } + + if(!pageflipflop) + modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 36); + else{ + //copy old bg to page0 + //modexCopyPageRegion(pip[3].page, pip[0].page, bx, by, 0, 0, 20, 36); + //update buffer + //modexCopyPageRegion(pip[0].page, pip[3].page, 0, 0, x, y, 20, 36); + } +//modexCopyPageRegion(page_t *dest, page_t *src, word sx, word sy, word dx, word dy, word width, word height); + //modexCopyPageRegion(pip[3].page, pip[!(pip->video->p)].page, x-4, y-4, 0, 128, 28, 36); + /*modexCopyPageRegion(pip[pip->video->p].page, + pip[!(pip->video->p)].page, x-4, y-4, x-4, y-4, 28, 36);*/ +// else modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 40); + switch(ls) + { + case 1: + FRAME1 + break; + case 2: + FRAME2 + break; + case 3: + FRAME3 + break; + case 4: + FRAME4 + break; + } +// if(2>ls && ls>=1) { FRAME1 }else +// if(3>ls && ls>=2) { FRAME2 }else +// if(4>ls && ls>=3) { FRAME3 }else +// if(5>ls && ls>=4) { FRAME4 } + //modexCopyPageRegion(pip[0].page, pip[3].page, 0, 0, x, y, 24, 32); + //printf("x=%d y=%d bx=%d by=%d\n", x, y, bx, by); + pip->video->r=1; +} + +void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch) +{ + sword x = player[pn].enti.x; + sword y = player[pn].enti.y; + sword bx = x+16; //buffer's x + sword by = y+16; //buffer's y + word dire=32; //direction + sword qq; //scroll offset + word ls = player[pn].enti.persist_aniframe; + + switch(scrollswitch) + { + case 0: + qq = 0; + break; + default: + qq = ((player[pn].enti.q)*(player[pn].enti.speed)); + break; + } + //x-=4; + y-=pip[0].map->tiles->tileHeight; + switch (player[pn].enti.d) + { + case 0: + //up + dire*=player[pn].enti.d; + y-=qq; + by-=4; + break; + case 3: + // right + dire*=(player[pn].enti.d-2); + x+=qq; + bx+=4; + break; + case 2: + break; + case 4: + //down + dire*=(player[pn].enti.d-2); + y+=qq; + by+=4; + break; + case 1: + //left + dire*=(player[pn].enti.d+2); x-=qq; bx-=4; break; } -#ifdef SPRITE -#define FRAME1 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 48, dire, 24, 32, PLAYERBMPDATAPTR); -#define FRAME2 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, dire, 24, 32, PLAYERBMPDATAPTR); -#define FRAME3 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 0, dire, 24, 32, PLAYERBMPDATAPTR); -#define FRAME4 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, dire, 24, 32, PLAYERBMPDATAPTR); -#else -#define FRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 2+dire); -#define FRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire); -#define FRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, dire); -#define FRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire); -#endif if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 36); else{ @@ -1243,7 +1332,7 @@ boolean ZC_walk2(entity_t *ent, map_view_t *map_v) void player_walk(player_t *player, map_view_t *map_v){ int dx=16, dy=16; - if(ZC_walk2(player->ent, map_v) && boundary_check(map_v->tx, map_v->ty, dx, dy, map_v->map->width - 2*map_v->page->tilesw, map_v->map->height - 2*map_v->page->tilesh)) + if(ZC_walk2(&(player->enti), map_v) && boundary_check(map_v->tx, map_v->ty, dx, dy, map_v->map->width - 2*map_v->page->tilesw, map_v->map->height - 2*map_v->page->tilesh)) { mapScroll(map_v, player); // (Un)load stuff? diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index 8feb3f48..69701875 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -87,8 +87,8 @@ typedef struct { #define MAPW 40 #define MAPH 30 - //if(player[0].hp==0) printf("%d wwww\n", player[0].y+8); - //else printf("\nplayer[0].y: %d\n", player[0].y); + //if(player[0].enti.hp==0) printf("%d wwww\n", player[0].enti.y+8); + //else printf("\nplayer[0].enti.y: %d\n", player[0].enti.y); // printf("palette offset: %d\n", paloffset/3); //++++ printf("Total used: %zu\n", oldfreemem-GetFreeSize()); //++++ printf("Total free: %zu\n", GetFreeSize()); @@ -102,13 +102,13 @@ typedef struct { printf("ty: %d\n", mv[0].ty);\ printf("\n");\ printf("player vars:\n");\ - printf(" x: %d", player[0].x); printf(" y: %d\n", player[0].y);\ + printf(" x: %d", player[0].enti.x); printf(" y: %d\n", player[0].enti.y);\ \ - printf(" tx: %d", player[0].tx); printf(" ty: %d\n", player[0].ty);\ - printf(" triggx: %d", player[0].triggerx); printf(" triggy: %d\n", player[0].triggery);\ - 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);\ + printf(" tx: %d", player[0].enti.tx); printf(" ty: %d\n", player[0].enti.ty);\ + printf(" triggx: %d", player[0].enti.triggerx); printf(" triggy: %d\n", player[0].enti.triggery);\ + printf(" hp: %d", (player[0].enti.hp)); printf(" q: %d", player[0].enti.q); printf(" player.info.dir: %d", player[0].info.dir); printf(" player.d: %d ", player[0].enti.d);\ printf(" pdir=%d\n", player[0].pdir);\ - 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))]);\ + printf(" tile data value at player trigger position: %d\n\n", mv[0].map->data[(player[0].enti.triggerx-1)+(map.width*(player[0].enti.triggery-1))]);\ \ printf("Virtual Screen: %dx", gvar.video.page[0].width); printf("%d ", gvar.video.page[0].height);\ printf("Screen: %dx", gvar.video.page[0].sw); printf("%d\n", gvar.video.page[0].sh);\ @@ -155,13 +155,14 @@ sword chkmap(map_t *map, word q); void mapGoTo(map_view_t *mv, int tx, int ty); void mapinitmapview(map_view_t *mv, int tx, int ty); void near mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y); -void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *p, word poopoffset); -void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *p, word poopoffset); +void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *player, word poopoffset); +void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *player, word poopoffset); void mapDrawWRow(map_view_t *mv, int tx, int ty, word y); void mapDrawWCol(map_view_t *mv, int tx, int ty, word x); //void qclean(); void shinku(global_game_variables_t *gv); -void near animatePlayer(map_view_t *pip, player_t *player, word playnum, sword scrollswitch); +void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch); +void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch); // Move an entity around. Should actually be in 16_entity boolean ZC_walk2(entity_t *ent, map_view_t *map_v); diff --git a/src/lib/wcpu/16_wcpu.c b/src/lib/wcpu/16_wcpu.c index 41de0e12..b6dfa8c3 100755 --- a/src/lib/wcpu/16_wcpu.c +++ b/src/lib/wcpu/16_wcpu.c @@ -131,9 +131,9 @@ const char *WCPU_cpudetectmesg() cput = WCPU_detectcpu(); switch(cput) { - case 0: cpus = "8086/8088 or 186/88"; break; - case 1: cpus = "286"; break; - case 2: cpus = "386 or newer"; break; + case 0: cpus = "8086/8088 or 80186/80188"; break; + case 1: cpus = "80286"; break; + case 2: cpus = "80386 or newer"; break; default: cpus = "internal error"; break; } return cpus; @@ -141,14 +141,23 @@ const char *WCPU_cpudetectmesg() const char *WCPU_fpudetectmesg() { - const char *fpus; + char *fpus; unsigned char fput; + word cput; fput = WCPU_detectfpu(); + cput = WCPU_detectcpu(); + switch(cput) + { + case 0: cput=80; break; + case 1: cput=802; break; + case 2: cput=803; break; + default: cput=0; break; + } switch(fput) { case 0: fpus = "none"; break; - case 1: fpus = "8087"; break; + case 1: sprintf(fpus, "%d87", cput); break; default: fpus = "internal error"; break; } return fpus; diff --git a/src/scroll.c b/src/scroll.c index cfb6ab2e..3b317745 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -121,9 +121,9 @@ void main(int argc, char *argv[]) IN_initplayer(&player, 0); #ifndef SPRITE - modexClearRegion(mv[0].page, player[0].x, player[0].y-TILEWH, 16, 32, 15); + modexClearRegion(mv[0].page, player[0].enti.x, player[0].enti.y-TILEWH, 16, 32, 15); #else - modexDrawSpriteRegion(&gvar.video.page[0], player[0].x, player[0].y-TILEWH, 16, 64, 16, 32, PCXBMPPTR); + modexDrawSpriteRegion(&gvar.video.page[0], player[0].enti.x, player[0].enti.y-TILEWH, 16, 64, 16, 32, PCXBMPPTR); #endif if(!pageflipflop) VL_ShowPage(mv[1].page, 0, 0);//modexShowPage(mv[1].page); @@ -150,12 +150,12 @@ void main(int argc, char *argv[]) modexFadeOn(4, gpal); #endif #endif - while(!IN_KeyDown(sc_Escape) && player[0].hp>0) + while(!IN_KeyDown(sc_Escape) && player[0].enti.hp>0) { shinku(&gvar); //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[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 + //when player[0].enti.tx or player[0].enti.ty == 0 or player[0].enti.tx == 20 or player[0].enti.ty == 15 then stop because that is edge of map and you do not want to walk of the map //player movement IN_ReadControl(0, &player); @@ -163,12 +163,12 @@ void main(int argc, char *argv[]) ZC_walk(&mv, &player, 0); }else{ PANKEYFUN;//panPageManual(&mv, &player, 0); - //printf(" player[0].q: %d", player[0].q); printf(" player[0].d: %d\n", player[0].d); + //printf(" player[0].enti.q: %d", player[0].enti.q); printf(" player[0].d: %d\n", player[0].d); } //the scripting stuff.... - //if(((player[0].triggerx == TRIGGX && player[0].triggery == TRIGGY) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5)) - if(((mv[0].map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5)) + //if(((player[0].enti.triggerx == TRIGGX && player[0].enti.triggery == TRIGGY) && IN_KeyDown(0x1C))||(player[0].enti.tx == 5 && player[0].enti.ty == 5)) + if(((mv[0].map->data[(player[0].enti.triggerx-1)+(map.width*(player[0].enti.triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].enti.tx == 5 && player[0].enti.ty == 5)) { short i; for(i=800; i>=400; i--) @@ -177,7 +177,7 @@ void main(int argc, char *argv[]) } nosound(); } - if(player[0].q == (TILEWH/(player[0].speed))+1 && player[0].info.dir != 2 && (player[0].triggerx == 5 && player[0].triggery == 5)){ player[0].hp--; } + if(player[0].enti.q == (TILEWH/(player[0].enti.speed))+1 && player[0].info.dir != 2 && (player[0].enti.triggerx == 5 && player[0].enti.triggery == 5)){ player[0].enti.hp--; } //debugging binds! #ifdef MODEX #ifdef FADE @@ -234,7 +234,7 @@ void main(int argc, char *argv[]) #endif if(IN_KeyDown(sc_R)){ modexPalOverscan(rand()%56); } //r - if((player[0].q==1) && !(player[0].x%TILEWH==0 && player[0].y%TILEWH==0)) break; //incase things go out of sync! + if((player[0].enti.q==1) && !(player[0].enti.x%TILEWH==0 && player[0].enti.y%TILEWH==0)) break; //incase things go out of sync! } /* fade back to text mode */ diff --git a/src/test.c b/src/test.c index 49d71602..b85e7859 100755 --- a/src/test.c +++ b/src/test.c @@ -73,7 +73,6 @@ void main(int argc, char *argv[]) _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);*/ Startup16(&gvar); - PCXBMP = bitmapLoadPcx("data/chikyuu.pcx", &gvar); // load sprite /* save the palette */ //====pal = modexNewPal(); @@ -203,7 +202,7 @@ void main(int argc, char *argv[]) printf("Project 16 test.exe. This is just a test file!\n"); printf("version %s\n", VERSION); modexprintmeminfo(&gvar.video); - printf("tx=%d ", mv[gvar.video.panp].tx); printf("ty=%d ", mv[gvar.video.panp].ty); printf("player.d=%d\n", player[0].d); + printf("tx=%d ", mv[gvar.video.panp].tx); printf("ty=%d ", mv[gvar.video.panp].ty); printf("player.d=%d\n", player[0].enti.d); //IN_Shutdown(); //====modexPalBlack(); //====modexFadeOn(1, pal); diff --git a/src/vrstest.c b/src/vrstest.c index bd3e1da1..b5642de0 100755 --- a/src/vrstest.c +++ b/src/vrstest.c @@ -31,6 +31,7 @@ extern boolean dbg_notest; static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ +static byte palette[768]; void main() { @@ -58,8 +59,7 @@ void main() Startup16(&gvar); // What should be done by read_vrs: - //sega = (mm.bufferseg); - //if( + VL_LoadPalFile("data/spri/chikyuu.pal", &palette); CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &gvar);//) baka=1; else baka=0; // Insert sanity cheks later @@ -127,7 +127,7 @@ void main() while(!IN_KeyDown(sc_Escape)) { - switch(w) + /*switch(w) { case 1024: modexPalUpdate0(pal); @@ -135,7 +135,7 @@ void main() default: w++; break; - } + }*/ FUNCTIONKEYFUNCTIONS; } VGAmodeX(0, 1, &gvar); diff --git a/src/zcroll.c b/src/zcroll.c index ec44168e..0adf2751 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -130,7 +130,7 @@ void main(int argc, char *argv[]) /*strcpy(global_temp_status_text, "press enter for the loop of zcroll\nescape to quit"); modexprint(&gvar.video.page[0], 144, 72, 1, 7, 0, global_temp_status_text); while(!IN_KeyDown(sc_Enter)){ if(IN_KeyDown(sc_Escape)) goto quit; } IN_UserInput(1,1);*///wwww - while(!IN_KeyDown(sc_Escape))// && player[0].hp>0) + while(!IN_KeyDown(sc_Escape))// && player[0].enti.hp>0) { shinku(&gvar); //top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square @@ -154,7 +154,7 @@ void main(int argc, char *argv[]) } nosound(); } - if(player[0].q == (TILEWH/(player[0].speed))+1 && player[0].info.dir != 2 && (player[0].triggerx == 5 && player[0].triggery == 5)){ player[0].hp--; } + if(player[0].enti.q == (TILEWH/(player[0].speed))+1 && player[0].info.dir != 2 && (player[0].triggerx == 5 && player[0].triggery == 5)){ player[0].enti.hp--; } */ //debugging binds! if(IN_KeyDown(2)){ modexShowPage(mv[0].page); gvar.video.panp=0; } if(IN_KeyDown(25)){ modexpdump(mv[0].page); @@ -203,8 +203,8 @@ void main(int argc, char *argv[]) #endif if(IN_KeyDown(sc_R)){ modexPalOverscan(rand()%56); } //r - if((player[0].q==1) && !(player[0].x%TILEWH==0 && player[0].y%TILEWH==0)) break; //incase things go out of sync! - player[0].hp = 0; + if((player[0].enti.q==1) && !(player[0].enti.x%TILEWH==0 && player[0].enti.y%TILEWH==0)) break; //incase things go out of sync! + player[0].enti.hp = 0; } /* fade back to text mode */ diff --git a/wcpu.exe b/wcpu.exe index 47dc411017701138dc389d7a9821a8f649c465c4..6a5fae4e3fd918f9bbf60ed7c83cc5b9a7215290 100755 GIT binary patch delta 3083 zcmYk84{%dO9>@1>k~U4#SlcvhV@Z=*N@2<9M7$ISu9XV!^hOL;lQxp*>Mi^o1~%p_vYxCGWoPwR7W} z`Rv>G+uh&qx4XaJzCH6q&y$`9TM03f9#Tf~wUXpgp-MUkAyyziT{J~Kc)Mx{X#mF^ zgj@w{z*CObJVo6px(|Ies|a}k{HP)1Kn5Xy1n+`jFa^po3Hc>>1$|!!g<3+kf*{xf zjF1(9v#2M5K8uh-a1eX|E`cT;A#Gqc`t8NL4;=1Bu_v1lT1d!C;1h7Ph>-KZSWL)V z&;gzY2f)A0gzyqVBn!rr5@G=hfFJaL3qY_EQUx9Z9bh}?1D}EfNCT6NkR_n|Hi~^^ zgnR)^cM~!XtN@$9)1Vvd2S>oazy)vvtS={I0#sr)c92H>_jvz#HX(Z}2noy~ZLf)B6eoj6_B@S+bqAF}1Xa!rr5Xh}2WCP&fG`I=o+X-05Yd9oN*o zEyiGbZt$Tz6Kk33ZJ7!-=$nEqhTSb`gGZdDhBK|}+hW|Uu@tAMEEQ|jvWv3x0jOwh zgq1Ctf()^1DxA2$cWG7%T7F*BCcMjC87=*RjLkwuibC02d?K@sE>ZCs?W1?5s5kN^ zkl%01Z~lhX4EG1L3s8=0OEb5qlH<+CQoJC`wyuQ@g+>GMU`g*?-9?qm~ekli$h|Hu!sL2SuWiiU*- z3+;4a0fux-^A8m4jQWa)8qy^3YYBZl;%;7?T?>8Q?1IV^WhY%@p*XwF3}x~RCiB>F zC~9Ok*oZ-N6^8L~5uwnVy<)-XLRkA4f=YQc))k@6r%F63?L6ntl_jm|usqnOItsP% zv+9Hpr&Iz^adY(70^JfPerm(@7$y<82wY+o@L8!QleFeJfwWpb1 z4ZG~Y4D7M#2tD{dm4y$;O49n}*(sWMCBdS@4e1nb%qfM^XLA?j7&Jy~ffsf}r zM^l9V%3wDS5qWQ{5lKQ`ZESCiDf1c57*X-}5FB6S@H2)Iy6Ff0gW(zOp4BSYIG@!k zoZ>c%Rf#dVtDeC8aKn@&B}Y*U*6ZQ*xV%)@b;MG`RARH#|BPh`wWi=B4UM^^pv6pg zj`?!xE_Gxfs=f?vR42#b|7mLh{Jmmbs+S{}b<*VDn;~}D)S`p3#*(y%*hT;$IHc8bBngTiE}IQy zU1g;vC1V=WOpOqq5J?(~K7&m zx6XWEnI?Vv>V~%IG1fU-KB&GbFMPOYx>?b22s+-Gwy^Cj$k~KJeE(KhnLmRQ3vmc+ z%?j4*7G@ydjqR;%vFXv%PMu1;AoW>j@_Rlwr%kBgmde*`2qDcS(9Q`?DV?@QBBS9WPE1A0l4~1F=XQ=D8IGRUWbQ z8^}I+Bx87)7MFu%IwA+nWPP^Qmvam*U*A0%8j~z1RD5-X8Tk>P;J>M`wd`Yd0Xy<~g%^u3UU8oh8Q(C+;TDg59Ztp~ zBPvWdhS`KhCzoYgeY7nWT&6dOhp8O?H$tO5tFx_W$@G7R8d~`WRok_4L@24SwAu_? zu;ir7#=2KS`35tX6i|SdX zlO)Wp%U{##KbkhkbM4kVoD*{GjbBk%U9IQQO|zdeJ>BxRPe(!72R&9yLKK5w{=U0)$MdCUoN+sxSjX7Yh~fn zn>#mm;B&sa7IzN$mp=WIOPp)M3GxwX@+$w<&+J}<`2G3tjuTpgSVh7!;;RtjAUzLp z?-S|PpWIxO3k+W}Pup#j5752mni~zGUI+(1#@C;S^V`Lg_$`sURXw)^pX23E{hom< z_G5&wGiR+?k>I=I<*2_PlIs|NIr+8~aXXR|k-3iK4-w)2LMUNT zMTPPQ`1~yYY~CaExwHLt=O3tf3o=ONr_WVfBCnS7|IA-*Pf@|@M4KS&!TnpX{sk9e W!5u)x3D!Gs#}tG~MV^lf@&5oh*RTix delta 3046 zcmY+G4R9037035hvMfus@E1mwZCUd7his(47(1qhG$2RfVhT1dZ*xL+q3|iKFZPBo9q* z=J)RI?c2BecHh0*p3N6F)vauC2`17_@<^IimWx!Rhmdwchy^IuRw~gt+_zT{@-kQi z9tPKKgiPD^))~7cx*s-GDneF)b8&<`ts$fnYy-am=fPKCC+rS_SK|p0w1i}WJdh5Z z5wziX3pfB?1#=S!Sqh#6p8*NsXc^~fg z7h^IdgcwT+xfiS~B@dC!c-RAufMeh~SXf3#BRB#kz@lx6N>LDM9V zffJgIf<~e+XysOI4gHSt_1X<75_S0x0p)%~x$|>c6J{uC=R@Ws3_X2)@p&N@3I-sNeE$eoGoJGoQGZo{A_j=OaC zS1PkTB@@}4O8vEc6vR23^fJ?I~=M4Y4VM_)eOS4Ph0Zj2hG$%(TmafU5P2(+3>MeGrNg#4ENK(dJf38|2+;rqU4Bbe>4VsDKRZpli| zz|>Z1kWU%M>ERR9+Ztg@6;}^tE!Rs_y7V;*j5s3_|7}(-vf}NmTKa*Jf19<4Zp`Gh z*<0v&13!^%GaWK0!CU;Y92+wfjbuar? zTHKfBNZLOzc( z?{R&Y$c7Z>Y06?br+ZfDEJD*%>EFVka3+>_@^0vf1QsLCX;}`B;mNZk5u5O3BKjgt zkc`f0X`@WYz-Q(~)FNTksdwBVd(0-zdjc4U!tHlk~^E>2Xo zn03+cn+;GOwl+fjwY3Z~FRujhp}Yk@hRGOnMrM5JW3hLuNyl=yZi~Kp;`clo5k_l9 zIv(EPj8GQzI3q&5YFlI^PL|>LbY3Bx-OS5HiXcCn5vImhF)5M=8(~2hA<&&B28m);xXf2uPrc{Cs%ghUw>5hAUO|UZ&eGe5XwaZmF=MiJ9IqKsm ze7qhTq4Rgpvq^(^;u~KyeuhcZqK-V1;8~(mN=;XKYs?Or%IEOnq81^UKVP)hii+^W$EaOw zIJ$(pUpY&A{wdgHHo7k42uQ;!KEL=dY%dqzgd8ks;l<_KwMza(OTn>nQ@ZkU*iKo7 zowg|DOZgM8MzNP`zXQ_fSV5RzXqIwIK+VBM@r9r14w4T~SgiQM>FN-TmTx zy1ze2F<)fRLQA{)SX}rY3)4D3318WD)&4ol2-5IX^fHLA$m{~*MijiEvH)ZKy0X}0 z!vO=eoDCn}Jax``Aol8iUj?I+mBq$td-VbWQ8gE$+VYEbi$i&?=GQ8VRQFU@@r1d> zu6fl}O3Tw5yEZCE)Vr5*W{CZF*M77bd%BIRcKLAv^tanw2C?L_Z^vn^K`bM_8TCG> z>%`>CeE;0sZjJKWi2ukSo+rMAf_v5rfsSN9vz@}JQaJ_rUAFL~{||TH?+!|$qegq5 zy@WhQZ|XMAc$n>PyxYU?RXq4@;eY?X8x~MJXk&k>7ccQ`_Vu*%(!j^|m#OJ{oRAfM uck$v0AYFR0mm|p-9UgVI~M?qWTd%A^!!LN~Ev= -- 2.39.2