]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/planar.c
cleaned up the repo from debugging watcom2 ^^
[16.git] / src / lib / planar.c
index 5541217fe4fa2ac2cc76f74caaf67dbd2b4e5a5c..3fd1c5ed2b25b85ac5a5849bf9d282ea2d010cf2 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
  *\r
  * This file is part of Project 16.\r
  *\r
 /*\r
  * Implimentation of the planar buffer files.\r
  */\r
+#include <stdio.h>\r
 #include <stdlib.h>\r
+#include <malloc.h>\r
+\r
 #include "src/lib/planar.h"\r
 \r
 /* creates a planar buffer from the bitmap data.\r
    be destroyed with the planar_buf_free function when no longer\r
    needed.\r
  */\r
-planar_buf_t *\r
+planar_buf_t huge *\r
 planar_buf_from_bitmap(bitmap_t *b) {\r
        planar_buf_t *p;\r
        int plane, bi, pi, x, y;\r
+       word q;\r
 \r
        /* allocate the buffer */\r
        p = planar_buf_alloc(b->width, b->height);\r
@@ -59,12 +63,18 @@ planar_buf_from_bitmap(bitmap_t *b) {
        if(plane) pi++;\r
        }\r
 \r
+       p->palette = modexNewPal();\r
+       for(;q<PALSIZE;q++)\r
+       {\r
+               p->palette[q]=b->palette[q];\r
+       }\r
+\r
        return p;\r
 }\r
 \r
 \r
 /* allocates a planar buffer with specified dimensions */\r
-planar_buf_t *\r
+planar_buf_t huge *\r
 planar_buf_alloc(word width, word height) {\r
        planar_buf_t *p;\r
        int i;\r
@@ -77,7 +87,7 @@ planar_buf_alloc(word width, word height) {
 \r
        /* allocate the planes */\r
        for(i=0; i<4; i++) {\r
-       p->plane[i] = malloc(p->height * p->pwidth);\r
+               p->plane[i] = malloc(p->height * p->pwidth);\r
        }\r
 \r
        return p;\r