]> 4ch.mooo.com Git - 16.git/blobdiff - src/scroll.c
modified: pcxtest.exe
[16.git] / src / scroll.c
index 18d8ace702f9eed3ff632a83ef1c4f43c5265e2c..e67fe514553dfa0c021a75354aa124539a9f9279 100644 (file)
@@ -2,7 +2,8 @@
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include "src\lib\dos_kb.h"\r
-#include "src\lib\wtest\wtest.c"\r
+#include "src\lib\wtest\wtest.c"
+#include "src\lib\xms.c"\r
 \r
 //word far *clock= (word far*) 0x046C; /* 18.2hz clock */\r
 \r
@@ -69,7 +70,7 @@ void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword
 #define MAPY 150\r
 #define TRIGGX 10\r
 #define TRIGGY 9\r
-//#define SWAP(a, b) tmp=a; a=b; b=tmp;\r
+\r
 void main() {\r
        bitmap_t ptmp;//, npctmp; // player sprite\r
        const char *cpus;\r
@@ -89,9 +90,9 @@ void main() {
        modexFadeOff(4, pal);\r
        modexPalBlack();\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
-       initMap(&map);\r
+       /* create the map */
+       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
+       initMap(&map);
        mv.map = &map;\r
        mv2.map = &map;\r
        mv3.map = &map;\r
@@ -275,7 +276,7 @@ void main() {
 */
 
        //player movement
-       //TODO: make movement into aa function!
+       //TODO: make movement into a function!
        //right movement\r
        if((keyp(77) && !keyp(75) && player.d == 0) || player.d == 2)\r
        {
@@ -441,7 +442,7 @@ void main() {
        }\r
        //modexClearRegion(mask->page, 66, 66, 2, 40, 0);\r
 
-       if(((player.triggerx == TRIGGX && player.triggery == TRIGGY) && keyp(KEY_ENTER))||(player.tx == 5 && player.ty == 5))\r
+       if(((player.triggerx == TRIGGX && player.triggery == TRIGGY) && keyp(0x1C))||(player.tx == 5 && player.ty == 5))\r
        {\r
                short i;\r
                for(i=800; i>=400; i--)\r
@@ -450,7 +451,8 @@ void main() {
                }\r
                nosound();\r
        }
-       if(player.q == (TILEWH/SPEED)+1 && player.d > 0 && (player.triggerx == 5 && player.triggery == 5)){ player.hp--; }\r
+       if(player.q == (TILEWH/SPEED)+1 && player.d > 0 && (player.triggerx == 5 && player.triggery == 5)){ player.hp--; }
+       //if(keyp(0x0E)) while(1){ if(xmsmalloc(24)) break; }\r
        }\r
 \r
        /* fade back to text mode */\r
@@ -461,8 +463,9 @@ void main() {
        printf("Project 16 scroll.exe\n");\r
        printf("tx: %d\n", bg->tx);\r
        printf("ty: %d\n", bg->ty);\r
-       printf("player.x: %d\n", player.x);\r
-       printf("player.y: %d\n", player.y);\r
+       printf("player.x: %d", player.x);
+       if(player.hp==0) printf("%d wwww\n", player.y+8);\r
+       else printf("\nplayer.y: %d\n", player.y);\r
        printf("player.tx: %d\n", player.tx);\r
        printf("player.ty: %d\n", player.ty);\r
        printf("player.triggx: %d\n", player.triggerx);\r
@@ -472,7 +475,8 @@ void main() {
        printf("player.d: %d\n", player.d);\r
        printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n");\r
        printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n");\r
-       printf("\n");\r
+       printf("\n");
+       xmsfree(&map);\r
        switch(detectcpu())\r
        {\r
                case 0: cpus = "8086/8088 or 186/88"; break;\r
@@ -491,8 +495,10 @@ allocMap(int w, int h) {
        map_t result;\r
 \r
        result.width =w;\r
-       result.height=h;\r
-       result.data = malloc(sizeof(byte) * w * h);\r
+       result.height=h;
+       if(initxms()>0)
+       result.data = malloc(sizeof(byte) * w * h);
+       else result.data = xmsmalloc(sizeof(byte) * w * h);
 \r
        return result;\r
 }\r
@@ -503,14 +509,20 @@ initMap(map_t *map) {
        /* just a place holder to fill out an alternating pattern */\r
        int x, y;\r
        int i;\r
-       int tile = 1;\r
-       map->tiles = malloc(sizeof(tiles_t));\r
-\r
-       /* create the tile set */\r
-       map->tiles->data = malloc(sizeof(bitmap_t));\r
+       int tile = 1;
+       if(initxms()>0)
+       map->tiles = malloc(sizeof(tiles_t));
+       else map->tiles = xmsmalloc(sizeof(tiles_t));\r
+\r
+       /* create the tile set */
+       if(initxms()>0)
+       map->tiles->data = malloc(sizeof(bitmap_t));
+       else map->tiles->data = xmsmalloc(sizeof(bitmap_t));
        map->tiles->data->width = (TILEWH*2);\r
-       map->tiles->data->height= TILEWH;\r
-       map->tiles->data->data = malloc((TILEWH*2)*TILEWH);\r
+       map->tiles->data->height= TILEWH;
+       if(initxms()>0)
+       map->tiles->data->data = malloc((TILEWH*2)*TILEWH);
+       else map->tiles->data->data = xmsmalloc((TILEWH*2)*TILEWH);\r
        map->tiles->tileHeight = TILEWH;\r
        map->tiles->tileWidth =TILEWH;\r
        map->tiles->rows = 1;\r