git » fp-git.git » commit c92dcd8

all functionalities restaured with the new resources module and installer

author ecalot
2004-08-15 02:49:14 UTC
committer ecalot
2004-08-15 02:49:14 UTC
parent 2fc9661ffe04109bd6a82625858600391046abd5

all functionalities restaured with the new resources module and installer

FP/src/ker/kernel.c +1 -1
FP/src/ker/titles.c +1 -2
FP/src/res/maps.c +3 -3
FP/src/res/resources.c +6 -1

diff --git a/FP/src/ker/kernel.c b/FP/src/ker/kernel.c
index 25556c9..3b06ed1 100644
--- a/FP/src/ker/kernel.c
+++ b/FP/src/ker/kernel.c
@@ -50,7 +50,7 @@ int playgame(int optionflag,int level) {
 	/* Create objects */
 	tKey    key=inputCreateKey();
 	tKid    kid=kidCreate();
-	tData*  map=NULL; /*resLoad(RES_MAP+level);*/
+	tData*  map=resLoad(RES_MAP|level);
 	tRoom   room;
 	tRoomId roomId;
 	
diff --git a/FP/src/ker/titles.c b/FP/src/ker/titles.c
index 39efd5d..6ea83fe 100644
--- a/FP/src/ker/titles.c
+++ b/FP/src/ker/titles.c
@@ -75,9 +75,8 @@ tMenuOption showTitles() {
 	tData *main_title;
 	/*tData *main_text;*/
 	tMenuOption result;
-printf("hola oooo %08x %08x %08x %08x\n",res_set_part_type(RES_TYPE_IMG),res_set_part_from(73),res_set_part_size(3),res_set_part_size(0xffff));
+
 	main_title = resLoad(RES_IMG_MAIN_BACKGROUND);
-printf("hola %d\n",RES_IMG_MAIN_BACKGROUND);
 	if (! main_title) {
 		printf("The resource couldn't be loaded!\n");
 		return menuQuit;
diff --git a/FP/src/res/maps.c b/FP/src/res/maps.c
index f5a29b1..caf539f 100644
--- a/FP/src/res/maps.c
+++ b/FP/src/res/maps.c
@@ -37,7 +37,7 @@ maps.c: Freeprince : Map handling library
 #include "kid.h"
 #include "resources.h"
 
-#define slevel(field) (((tMap*)map->pFrames[0])->field)
+#define slevel(field) (((tMap*)(((tData*)map)->pFrames))->field)
 
 /* Privates 
 
@@ -72,7 +72,7 @@ void* mapLoadLevel(tMemory level) {
 	memcpy(map->fore,level.array+MAPS_BLOCK_OFFSET_WALL,30*24);
 	memcpy(map->back,level.array+MAPS_BLOCK_OFFSET_BACK,30*24);
 	memcpy(map->start,level.array+MAPS_BLOCK_OFFSET_START_POSITION,3);
-/*	memcpy(slevel(links),level.data+MAPS_BLOCK_OFFSET_LINKS,4*24);*/
+	memcpy(map->links,level.array+MAPS_BLOCK_OFFSET_LINK,4*24);
 	return (void*)map;
 }
 
@@ -220,7 +220,7 @@ tRoom mapGetRoom(tData* map, tRoomId roomId) {
 	return result;
 }
 
-void  mapStart(tData* map, tKid* kid, tRoomId* roomId) {
+void  mapStart(tData* map, tKid* kid, tRoomId *roomId) {
 	/* kid->x,y */
 	*roomId=slevel(start)[0];
 }
diff --git a/FP/src/res/resources.c b/FP/src/res/resources.c
index 256bba1..4b1b378 100644
--- a/FP/src/res/resources.c
+++ b/FP/src/res/resources.c
@@ -112,7 +112,11 @@ tData* resLoad(long id) {
 				return NULL;
 			}
 			mReadCloseDatFile();
-			return (tData*)mapLoadLevel(raw); /* transform from raw to a loaded map */
+			result=(tData*)malloc(sizeof(tData));
+			result->frames=1; /* drop filename and palette */
+			result->type=eLevels;
+			result->pFrames=(void**)mapLoadLevel(raw);
+			return result; /* transform from raw to a loaded map */
 		case RES_TYPE_IMG: {
 			tMemory palette;
       tImage image;
@@ -120,6 +124,7 @@ tData* resLoad(long id) {
 
 			result=(tData*)malloc(sizeof(tData));
 			result->frames=total-2; /* drop filename and palette */
+			result->type=eImages;
 			result->pFrames=(void**)malloc(result->frames*sizeof(void*));
 
 			if (!mReadBeginDatFile(&numberOfItems,res_file[res_list[from]])) {