git » fp-git.git » commit 2b76202

more code

author ecalot
2004-08-14 00:57:04 UTC
committer ecalot
2004-08-14 00:57:04 UTC
parent 8cf6b1129f744cc053a2445951b33628be53aec7

more code

FP/src/include/maps.h +1 -1
FP/src/include/resources.h +2 -0
FP/src/res/resources.c +13 -10

diff --git a/FP/src/include/maps.h b/FP/src/include/maps.h
index 78ead31..5848fe3 100644
--- a/FP/src/include/maps.h
+++ b/FP/src/include/maps.h
@@ -52,7 +52,7 @@ typedef struct {
 typedef enum {eLeft=0,eRight=1,eUp=2,eDown=3}tDirection;
 
 /* called from reources */
-void* mapLoadLevel(tMemory* level);
+void* mapLoadLevel(tMemory level);
 void  mapDestroy(tData* map);
 
 /* called from the kernel */
diff --git a/FP/src/include/resources.h b/FP/src/include/resources.h
index a39eb7b..f724a65 100644
--- a/FP/src/include/resources.h
+++ b/FP/src/include/resources.h
@@ -79,7 +79,9 @@ typedef struct {
 
 #define RES_MOD_RIGHT          0x00010000
 #define RES_MOD_LEFT           0x00000000
+#define RES_MOD_MAP            0x00020000
 #define res_modIsRight(a) ((a)&0x0001)
+#define res_modIsMap(a)   ((a)&0x0002)
 #define res_modGetId(a)   ((a)&0xffff)
 #define res_modGetMask(a) ((a)>>16)
 
diff --git a/FP/src/res/resources.c b/FP/src/res/resources.c
index 66b86c5..4187bce 100644
--- a/FP/src/res/resources.c
+++ b/FP/src/res/resources.c
@@ -55,14 +55,16 @@ resources.c: Princed Resources : DAT Extractor
 
 tData* res_createData(int nFrames,int type) {
 	tData* result;
-	/* TODO: send those lines to res_createData*/
 	result=(tData*)malloc(sizeof(tData));
 	
 	switch (type) {
-		case RES_TYPE_IMG:
-			result->type=eImages;/*res_getVirtualTypeFromReal(res_getIdxType);*/
-			nFrames--;
-			break;
+	case RES_TYPE_IMG:
+		result->type=eImages;/*res_getVirtualTypeFromReal(res_getIdxType);*/
+		nFrames--;
+		break;
+	case RES_TYPE_LVL:
+		result->type=eLevel;/*res_getVirtualTypeFromReal(res_getIdxType);*/
+		break;
 	}
 	
 	result->pFrames=(void**)malloc(nFrames*sizeof(void*));
@@ -104,12 +106,14 @@ void res_createFrames(tMemory data,int type,void** returnValue,int number,int ma
 		case RES_TYPE_SND_MIDI:
 		case RES_TYPE_SND_WAVE:
 		case RES_TYPE_IMG_PALETTED:
-		case RES_TYPE_LVL:
 			result=(tMemory*)malloc(sizeof(tMemory)); /* both sides are void* :)  */
 			/* TODO: data->array must be copied or it wont be available after the file is closed */
 			*result=data;
 			printf("res_createFrames: Allocating resource[%d]\n",number);
 			
+			break;
+		case RES_TYPE_LVL:
+			(tMemory*)result=mapLoadLevel(data);
 			break;
 	}
 
@@ -186,7 +190,6 @@ int res_getDataByArray(short int* id,int maxItems,void** result,int ids,int type
  * */
 
 tData* resLoad(long id) {
-				
 	/* Initialize abstract variables to read this new DAT file */
 	unsigned short int numberOfItems;
 	tData* result;
@@ -219,15 +222,15 @@ tData* resLoad(long id) {
 	}
 
 	strncpy(file1,res_getIdxFile1,14);
-	
+
 	mReadCloseDatFile();
 
 	/* READ FILE */
-	
+
 	for (i=0;i<nFrames;i++) {
 		printf("frames[%d]=%d\n",i,frames[i]);
 	}
-	
+
 	if (!mReadBeginDatFile(&numberOfItems,file1)) {
 		printf("Fatal Error: resLoad: resource file not found!\n");
 		free(frames);