]> 4ch.mooo.com Git - 16.git/commitdiff
p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I...
authorsparky4 <sparky4@cock.li>
Wed, 19 Apr 2017 18:01:18 +0000 (13:01 -0500)
committersparky4 <sparky4@cock.li>
Wed, 19 Apr 2017 18:01:18 +0000 (13:01 -0500)
src/lib/16_mm.c

index ee484c1a39fd7f64057a02aa5aa94a3488554107..e2249abd0ec9c4daae564e16f5a608bdb73fef7c 100755 (executable)
@@ -1257,25 +1257,27 @@ void MM_SortMem (global_game_variables_t *gvar)
 =====================\r
 */\r
 \r
-//#define MMSMSORTNEWTYPE\r
-#define MMSHOWMEMOFFSET 0//(gvar->video.page[0].dx+(gvar->video.page[0].dy*gvar->video.page[0].stridew))\r
+#define MMSMPANVID\r
 \r
 void MM_ShowMemory (global_game_variables_t *gvar)\r
 {\r
        mmblocktype far *scan;\r
-       unsigned color,temp,x,y         ,w;//,bofstemp;\r
+       unsigned color,temp,x,y         ,w,width;\r
        sdword  end,owner;\r
        byte    scratch[160],scratch0[4096],str[16];\r
 \r
+       if(!gvar->video.page[0].width) gvar->video.page[0].sw = gvar->video.page[0].width = 320;        //to prevent division by 0\r
 //--   VL_SetLineWidth(40, gvar);\r
        //temp = gvar->video.ofs.bufferofs;\r
        //gvar->video.ofs.bufferofs = gvar->video.ofs.displayofs;\r
-       temp = BDOFSCONV gvar->video.BOFS+MMSHOWMEMOFFSET;\r
+       temp = BDOFSCONV gvar->video.BOFS;\r
        gvar->video.BOFS = gvar->video.DOFS;\r
        scan = gvar->mm.mmhead;\r
 \r
        end = -1; w = 0;\r
 \r
+       width = gvar->video.page[0].width;\r
+\r
        CA_OpenDebug (gvar);\r
        while (scan)\r
        {\r
@@ -1293,7 +1295,7 @@ void MM_ShowMemory (global_game_variables_t *gvar)
                        color = 1;              // red = locked\r
                        strcpy(scratch0, AARED);                // red = locked\r
                }\r
-               if(scan->start<=end)\r
+               if (scan->start<=end)\r
                {\r
                        printf("\nend==%d\n\n", end);\r
                        strcat(scratch, "MM_ShowMemory: Memory block order currupted!\n");\r
@@ -1306,28 +1308,20 @@ void MM_ShowMemory (global_game_variables_t *gvar)
                        write(gvar->handle.debughandle,scratch,strlen(scratch));\r
                        Quit (gvar, "MM_ShowMemory: Memory block order currupted!");\r
                }\r
-#ifdef MMSMSORTNEWTYPE\r
-               end = scan->start+(scan->length)-1;\r
-#else\r
                end = scan->length-1;\r
-#endif\r
-               if(!gvar->video.page[0].width) gvar->video.page[0].width = 352;\r
-               y = scan->start/gvar->video.page[0].width;\r
-               x = scan->start%gvar->video.page[0].width;\r
+               y = scan->start/width;\r
+               x = scan->start%width;\r
                VW_Hlin(x,x+end,y,color,gvar);\r
-               VL_Plot(x,y,15,gvar);\r
+               VL_Plot(x,y,5,gvar);\r
                for(w=(scan->start)/80;w<=end/80;w++)\r
                {\r
-                       //printf("+     %u      %lu\n", w, scan->length);\r
+//printf("+    %u      %lu\n", w, scan->length);\r
                        strcat(scratch0, "+");\r
                }\r
                //++==++==optional\r
                strcat(scratch0, AARESET); strcat(scratch0, AAGREY); strcat(scratch0,"_");\r
-#ifdef MMSMSORTNEWTYPE\r
+\r
                if (scan->next && scan->next->start > end+1)\r
-#else\r
-               if (scan->next && scan->next->start >= end+1)\r
-#endif\r
                {\r
                        VW_Hlin(x+end+1,x+(scan->next->start-scan->start),y,3,gvar);    // black = free//now green\r
                        strcat(scratch0, AARESET);\r
@@ -1335,7 +1329,7 @@ void MM_ShowMemory (global_game_variables_t *gvar)
                        strcat(scratch0,AAGREEN);\r
                        for(w=(end+1)/80;w<=((scan->next->start-scan->start)/80);w++)\r
                        {\r
-                               //printf("0     %x      %u      %lu\n", scan->next->start, w, scan->length);\r
+//printf("0    %x      %u      %lu\n", scan->next->start, w, scan->length);\r
                                strcat(scratch0,"0");\r
                        }\r
                        //printf("==================\n");\r
@@ -1380,11 +1374,50 @@ void MM_ShowMemory (global_game_variables_t *gvar)
 //fprintf(stdout, "%s", scratch);\r
 \r
                scan = scan->next;\r
+//if(color!=6) IN_Ack(gvar);\r
        }\r
 \r
        CA_CloseDebug (gvar);\r
 \r
+#ifdef MMSMPANVID\r
+       {\r
+               int dx,dy,odx,ody;\r
+               odx = gvar->video.page[0].dx;\r
+               ody = gvar->video.page[0].dy;\r
+               dx = dy = 0;\r
+               while(!gvar->in.inst->Keyboard[sc_Escape])\r
+               {\r
+                       if(gvar->in.inst->Keyboard[sc_UpArrow])\r
+                       {\r
+                               if(dy>0)\r
+                                       dy--;\r
+                       }\r
+                       else if(gvar->in.inst->Keyboard[sc_DownArrow])\r
+                       {\r
+                               if(dy<gvar->video.page[0].height-gvar->video.page[0].sh)\r
+                                       dy++;\r
+                       }\r
+                       if(gvar->in.inst->Keyboard[sc_LeftArrow])\r
+                       {\r
+                               if(dx>0)\r
+                                       dx--;\r
+                       }\r
+                       else if(gvar->in.inst->Keyboard[sc_RightArrow])\r
+                       {\r
+                               if(dx<gvar->video.page[0].width-gvar->video.page[0].sw)\r
+                                       dx++;\r
+                       }\r
+\r
+                       modexPanPage(&gvar->video.page[0], dx, dy);\r
+                       VL_ShowPage(&gvar->video.page[0], 1, 1);\r
+               }\r
+\r
+               gvar->video.page[0].dx = odx;\r
+               gvar->video.page[0].dy = ody;\r
+       }\r
+#else\r
        IN_Ack(gvar);\r
+#endif\r
 \r
        gvar->video.BOFS = (byte __far *)temp;\r
 }\r