/* Project 16 Source Code~\r
- * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
*\r
* This file is part of Project 16.\r
*\r
#include <stdlib.h>\r
#include <malloc.h>\r
#include "src/lib/bitmap.h"\r
+#include "src/lib/16_mm.h"\r
+#include "src/lib/16_pm.h"\r
+#include "src/lib/16_ca.h"\r
+\r
+static struct pcxHeader {\r
+ byte id;\r
+ byte version;\r
+ byte encoding;\r
+ byte bpp;\r
+ word xmin;\r
+ word ymin;\r
+ word xmax;\r
+ word ymax;\r
+ word hres;\r
+ word vres;\r
+ byte pal16[48];\r
+ byte res1;\r
+ word bpplane;\r
+ word palType;\r
+ word hScreenSize;\r
+ word vScreenSize;\r
+ byte padding[54];\r
+} head;\r
\r
static void loadPcxStage1(FILE *file, bitmap_t *result) {\r
- long bufSize;\r
- int index;\r
- byte count, val;\r
- long int pos;\r
+ //long bufSize;\r
+ //int index;\r
+ //byte count, val;\r
+ //long int pos;\r
\r
/* read the header */\r
fread(&head, sizeof(char), sizeof(struct pcxHeader), file);\r
\r
\r
bitmap_t\r
-bitmapLoadPcx(char *filename) {\r
+bitmapLoadPcx(char *filename, global_game_variables_t *gv) {\r
FILE *file;\r
bitmap_t result;\r
dword bufSize;\r
/* allocate the buffer */\r
//printf("%zu\n", _memmax());\r
bufSize = (/*(dword)*/result.width * result.height);\r
+ //CA_LoadFile(filename, (memptr *)(result.data), gv);\r
result.data = malloc(bufSize);\r
+\r
// result.data = (byte far *)_fmalloc(bufSize);\r
// result.data = (byte __huge *)halloc(bufSize, sizeof(byte));\r
/*printf("&bufSize=%p\n", &bufSize);\r
printf("Size of result.width is %zu \n", result.width);\r
printf("Size of result.height is %zu \n", result.height);\r
printf("Dimensions of result is %lu\n", (dword)result.width*result.height);*/\r
- //exit(0);\r
if(!result.data) {\r
fprintf(stderr, "Could not allocate memory for bitmap data.");\r
fclose(file);\r
result.data[index] = val;\r
}\r
} while(index < bufSize);\r
- printf("index=%d\n", index);\r
+ //printf("index=%d\n", index);\r
\r
loadPcxPalette(file, &result);\r
\r