]> 4ch.mooo.com Git - 16.git/blobdiff - src/scroll.c
modified: src/lib/jsmn/example/MAPTEST.EXE
[16.git] / src / scroll.c
index 9e197f09d455465c3e75cdc8c5c470e7e2b268a6..8f485f90a8e538d91c570aeb502fb15e52d83678 100644 (file)
@@ -1,15 +1,15 @@
 #include "src\lib\modex16.h"\r
 #include <stdio.h>\r
-#include <stdlib.h>\r
+#include <stdlib.h>
+#include <string.h>\r
 #include "src\lib\dos_kb.h"\r
 #include "16\lib\x\modex.h"\r
 #include "src\lib\wtest\wtest.c"\r
-#include "src\lib\ems.c"\r
+#include "src\lib\planar.c"\r
+//====#include "src\lib\ems.c"\r
 \r
 //word far *clock= (word far*) 0x046C; /* 18.2hz clock */\r
 \r
-int emmhandle,ist;\r
-\r
 typedef struct {\r
        bitmap_t *data;\r
        word tileHeight;\r
@@ -60,7 +60,7 @@ void mapScrollDown(map_view_t *mv, byte offset);
 void mapGoTo(map_view_t *mv, int tx, int ty);\r
 void mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y);\r
 void mapDrawRow(map_view_t *mv, int tx, int ty, word y);\r
-void mapDrawCol(map_view_t *mv, int tx, int ty, word x);
+void mapDrawCol(map_view_t *mv, int tx, int ty, word x);\r
 void qclean();\r
 void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword d, short scrolloffsetswitch, int x, int y, int ls, int lp, bitmap_t *bmp);\r
 \r
@@ -76,7 +76,12 @@ void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword
 #define TRIGGY 9\r
 \r
 void main() {\r
+       long emmhandle;\r
+       long emsavail;\r
+       char teststr[80];\r
+       int i;\r
        bitmap_t ptmp;//, npctmp; // player sprite\r
+       planar_buf_t *p;\r
        const char *cpus;\r
        static int persist_aniframe = 0;    /* gonna be increased to 1 before being used, so 0 is ok for default */\r
        page_t screen, screen2, screen3;\r
@@ -87,9 +92,33 @@ void main() {
        byte *ptr;\r
        actor_t player;\r
        //actor_t npc0;\r
-
+\r
 //     atexit(qclean());\r
-//     if(isEMS() || checkEMS()){ printf("%d\n", coretotalEMS()); emmhandle = mallocEMS(coretotalEMS()); }\r
+       /*if(!emmtest())\r
+       {\r
+               printf("Expanded memory is not present\n");\r
+               exit(0);\r
+       }\r
+     \r
+       if(!emmok())\r
+       {\r
+               printf("Expanded memory manager is not present\n");\r
+               exit(0);\r
+       }\r
+     \r
+       emsavail = emmavail();\r
+       if(emsavail == -1)\r
+       {\r
+               printf("Expanded memory manager error\n");\r
+               exit(0);\r
+       }\r
+       printf("There are %ld pages available\n",emsavail);\r
+\r
+       if((emmhandle = emmalloc(emsavail)) < 0)\r
+       {\r
+               printf("Insufficient pages available\n");\r
+               exit(0);\r
+       }*/\r
 \r
        /* create the map */\r
        map = allocMap(MAPX,MAPY); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly\r
@@ -105,6 +134,9 @@ void main() {
        ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite\r
        //npctmp = bitmapLoadPcx("ptmp1.pcx"); // load sprite\r
 \r
+       /* create the planar buffer */\r
+       p = planar_buf_from_bitmap(&ptmp);\r
+\r
        /*if(isEMS())\r
        {\r
                XMOVE mm;\r
@@ -136,7 +168,7 @@ void main() {
        }\r
 */\r
        /* save the palette */\r
-       pal  = modexNewPal();\r
+       pal = modexNewPal();\r
        modexPalSave(pal);\r
        modexFadeOff(4, pal);\r
        modexPalBlack();\r
@@ -491,7 +523,17 @@ void main() {
                nosound();\r
        }\r
        if(player.q == (TILEWH/SPEED)+1 && player.d > 0 && (player.triggerx == 5 && player.triggery == 5)){ player.hp--; }\r
-       //if(keyp(0x0E)) while(1){ if(xmsmalloc(24)) break; }\r
+       //if(keyp(0x0E)) while(1){ if(xmsmalloc(24)) break; }
+       if(keyp(87))
+       {
+               modexLeave();\r
+               setkb(0);
+               __asm
+               {
+                       mov ah,31h
+                       int 21h
+               }
+       }\r
        }\r
 \r
        /* fade back to text mode */\r
@@ -521,13 +563,7 @@ void main() {
        //xmsfree(spri);\r
        //xmsfree(mask);\r
        //xmsreport();\r
-       /*if(isEMS())\r
-       {\r
-               printf("%d\n", get_emem());\r
-               printf("%d\n", coretotalEMS());\r
-               dealloc_emem(emmhandle);\r
-               printf("%d\n", coretotalEMS());\r
-       }*/\r
+       //emmclose(emmhandle);\r
        switch(detectcpu())\r
        {\r
                case 0: cpus = "8086/8088 or 186/88"; break;\r
@@ -778,13 +814,13 @@ mapDrawCol(map_view_t *mv, int tx, int ty, word x) {
        }\r
        i += mv->map->width;\r
        }\r
-}
-
-void qclean()
-{
+}\r
+\r
+void qclean()\r
+{\r
        modexLeave();\r
-       setkb(0);
-}
+       setkb(0);\r
+}\r
 \r
 void\r
 animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword d, short scrolloffsetswitch, int x, int y, int ls, int lp, bitmap_t *bmp)\r