git » fp-git.git » commit e75f9ac

moved the binary object to its place

author ecalot
2006-02-17 15:20:34 UTC
committer ecalot
2006-02-17 15:20:34 UTC
parent 3e917ee68cf6ef543086c3a47949071037ebfd70

moved the binary object to its place

PR/src/Makefile +6 -2
PR/src/include/other.h +38 -0
PR/src/lib/object/object.c +9 -7
PR/src/lib/object/other/binary.c +57 -0

diff --git a/PR/src/Makefile b/PR/src/Makefile
index 30fd5b4..eca2f11 100644
--- a/PR/src/Makefile
+++ b/PR/src/Makefile
@@ -56,7 +56,7 @@ XML      = .parse.o .search.o .unknown.o .translate.o .tree.o
 COMPRESS = .lzg_compress.o .lzg_uncompress.o .rle_compress.o .rle_uncompress.o .rlec_uncompress.o 
 LAYERS   = .dat.o .memory.o .list.o .reslist.o .pallist.o .disk.o .idlist.o .autodetect.o .stringformat.o .resourcematch.o
 FORMAT   = .bmp.o .mid.o .pal.o .wav.o .plv.o
-OBJECT   = .object.o .pop1_4bit.o .image.o
+OBJECT   = .object.o .pop1_4bit.o .image.o .binary.o
 CONSOLE  = .main.o .filedir.o
 MAIN     = .pr.o
 
@@ -223,9 +223,13 @@ $(XMLFILE): xml/resources.xml
 	$(CC) $(OPTIONS) -c lib/layers/stringformat.c -o $@
 
 .pop1_4bit.o: lib/object/palette/pop1_4bit.c include/common.h
-	$(INFO) Compiling the POP1 16 colors palette object support...
+	$(INFO) Compiling the POP1 16 colors palette class support...
 	$(CC) $(OPTIONS) -c  lib/object/palette/pop1_4bit.c -o $@
 
+.binary.o: lib/object/other/binary.c include/common.h
+	$(INFO) Compiling the binary item class support...
+	$(CC) $(OPTIONS) -c  lib/object/other/binary.c -o $@
+
 .resourcematch.o: lib/layers/resourcematch.c include/search.h include/memory.h include/resourcematch.h
 	$(INFO) Compiling resource list parsing feature...
 	$(CC) $(OPTIONS) -c lib/layers/resourcematch.c -o $@
diff --git a/PR/src/include/other.h b/PR/src/include/other.h
new file mode 100644
index 0000000..5384e9e
--- /dev/null
+++ b/PR/src/include/other.h
@@ -0,0 +1,38 @@
+/*  Princed V3 - Prince of Persia Level Editor for PC Version
+    Copyright (C) 2003 Princed Development Team
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    The authors of this program may be contacted at http://forum.princed.com.ar
+*/
+
+/*
+other.h: Princed Resources : 
+\xaf\xaf\xaf\xaf\xaf
+ Copyright 2006 Princed Development Team
+  Created: 17 Feb 2006
+
+  Author: Enrique Calot <ecalot.cod@princed.com.ar>
+
+ Note:
+  DO NOT remove this copyright notice
+*/
+
+#ifndef _OTHER_H_
+#define _OTHER_H_
+
+void* objBinaryCreate(unsigned char* data, int size, int *error);
+
+#endif
diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c
index 7fec815..2987a2e 100644
--- a/PR/src/lib/object/object.c
+++ b/PR/src/lib/object/object.c
@@ -31,6 +31,8 @@ main.c: Princed Resources : Main item class implementation
 */
 
 #include "object.h"
+#include "reslist.h"
+#include "other.h"
 
 tObject getObject(tResource* r, int* error) {
 	tObject o;
@@ -38,27 +40,27 @@ tObject getObject(tResource* r, int* error) {
 	o.type=r->type;
 	switch (o.type) {
 	case eResTypeLevel:
-		/*o.obj=objLevelCreate(res->data,res->size,res->number,vDatFileName,res->name,res->desc,res->datAuthor,error); */
+		/*o.obj=objLevelCreate(r->data,r->size,r->number,vDatFileName,r->name,r->desc,r->datAuthor,error); */
 		break;
 	case eResTypeBinary: /* Binary files */
 	case eResTypeText: /* Text files */
 	case eResTypeRaw: /* Raw files */
-		/*o.obj=objBinaryCreate(res->data,res->size,error); */
+		o.obj=objBinaryCreate(r->data,r->size,error); 
 		break;
 	case eResTypePop1Palette4bits: /* save and remember palette file */
-		/*o.obj=objPalette_pop1_4bitsCreate(res->data,res->size,error); */
+		/*o.obj=objPalette_pop1_4bitsCreate(r->data,r->size,error); */
 		break;
 	case eResTypePcspeaker: /* save pcs file */
-		/*o.obj=objPcspeakerCreate(res->data,res->size,error); */
+		/*o.obj=objPcspeakerCreate(r->data,r->size,error); */
 		break;
 	case eResTypeMidi:	/* save midi file */
-		/*o.obj=objMidiCreate(res->data,res->size,error); */
+		/*o.obj=objMidiCreate(r->data,r->size,error); */
 		break;
 	case eResTypeWave: /* save wav file */
-		/*o.obj=objWaveCreate(res->data,res->size,error); */
+		/*o.obj=objWaveCreate(r->data,r->size,error); */
 		break;
 	case eResTypeImage: /* save image */
-		/*o.obj=objImageCreate(res->data,res->size,res->pal,error); */
+		/*o.obj=objImageCreate(r->data,r->size,r->pal,error); */
 		break;
 	default:
 		break;
diff --git a/PR/src/lib/object/other/binary.c b/PR/src/lib/object/other/binary.c
new file mode 100644
index 0000000..6aa22a4
--- /dev/null
+++ b/PR/src/lib/object/other/binary.c
@@ -0,0 +1,57 @@
+/*  Princed V3 - Prince of Persia Level Editor for PC Version
+    Copyright (C) 2003 Princed Development Team
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    The authors of this program may be contacted at http://forum.princed.com.ar
+*/
+
+/*
+.c: Princed Resources : 
+\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf
+ Copyright 2006 Princed Development Team
+  Created: 17 Feb 2006
+
+  Author: Enrique Calot <ecalot.cod@princed.com.ar>
+  Version: 1.01 (2006-Feb-09)
+
+ Note:
+  DO NOT remove this copyright notice
+*/
+
+/***************************************************************\
+|                  I M P L E M E N T A T I O N                  |
+\***************************************************************/
+
+#include "binary.h" /* tBinary */
+#include "common.h"
+#include <stdlib.h>
+
+/***************************************************************\
+|                         Binary Object                         |
+\***************************************************************/
+
+void* objBinaryCreate(unsigned char* data, int size, int *error) { /* use get like main.c */
+	tBinary* r;
+	*error=PR_RESULT_SUCCESS;
+	
+	r=(tBinary*)malloc(sizeof(tBinary));
+	r->data=data;
+	r->size=size;
+	return (void*)r;
+}
+
+
+