git » fp-git.git » commit a8af8a0

code broken. Hooked pop2 4bit palette

author ecalot
2006-06-08 13:41:35 UTC
committer ecalot
2006-06-08 13:41:35 UTC
parent 1394ef4668e096cb7dba9b29c699d67bf024871b

code broken. Hooked pop2 4bit palette

PR/src/lib/object/object.c +11 -2
PR/src/lib/object/palette/pop1_mono.c +0 -43

diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c
index d1b01bb..0bfb699 100644
--- a/PR/src/lib/object/object.c
+++ b/PR/src/lib/object/object.c
@@ -90,6 +90,7 @@ tObject getObject(tResource* r, int* error) {
 	default:
 printf("Exception: Unhooked type %d\n",o.type);
 		*error=PR_RESULT_SUCCESS; /* NOTE: change to 1 to detect unhooked types */
+		o.obj=NULL;
 		break;
 	}
 	
@@ -110,6 +111,9 @@ int writeObject(tObject o, const char* file, int optionflag, const char* backupE
 	case eResTypePop1Palette4bits: /* save and remember palette file */
 		error=objPalette_pop1_4bitsWrite(o.obj,file,optionflag,backupExtension);
 		break;
+	case eResTypePop2Palette4bits: /* save and remember palette file */
+		error=objPalette_pop2_4bitsWrite(o.obj,file,optionflag,backupExtension);
+		break;
 	case eResTypePcspeaker: /* save pcs file */
 		error=objPcspeakerWrite(o.obj,file,optionflag,backupExtension);
 		break;
@@ -129,6 +133,7 @@ int writeObject(tObject o, const char* file, int optionflag, const char* backupE
 		error=objImage256Write(o.obj,file,optionflag,backupExtension);
 		break;
 	default:
+printf("Warning: Couldn't write unhooked type %d\n",o.type);
 		break;
 	}
 
@@ -142,6 +147,7 @@ int paletteGetBits(tObject pal) {
 	case eResTypePop2PaletteNColors:
 		return 8;
 	case eResTypePop1Palette4bits: 
+	case eResTypePop2Palette4bits: 
 		return 4;
 	case eResTypePop1PaletteMono: 
 		return 1;
@@ -155,6 +161,7 @@ int paletteGetColors(tObject pal) {
 	case eResTypePop2PaletteNColors:
 		return 256;
 	case eResTypePop1Palette4bits: 
+	case eResTypePop2Palette4bits: 
 		return 16;
 	case eResTypePop1PaletteMono: 
 		return 2;
@@ -167,6 +174,8 @@ tColor* paletteGetColorArray(tObject pal) {
 	switch (pal.type) {
 	case eResTypePop1Palette4bits: /* save and remember palette file */
 		return objPalette_pop1_4bitsGetColors(pal.obj);
+	case eResTypePop2Palette4bits: /* save and remember palette file */
+		return objPalette_pop2_4bitsGetColors(pal.obj);
 	case eResTypePop2PaletteNColors:
 		return objPalette_pop2_ncolorsGetColors(pal.obj);
 	default:
@@ -181,7 +190,7 @@ tColor* paletteGetColorArray(tObject pal) {
 void setObject(tObject o,int *result,tResource* res) {
 	switch (o.type) {
 		case eResTypeLevel:
-			/*o.obj=objLevelRead(file,res.content,result);*/
+			/*result=objLevelSet(o.obj,res); TODO */
 			break;
 		case eResTypeImage16:
 			*result=objImage16Set(o.obj,res);
@@ -212,7 +221,7 @@ tObject readObject(const char* file,tResource* res,int *result) {
 	tObject o;
 	switch (res->type) {
 		case eResTypeLevel:
-			/*o.obj=objLevelRead(file,res.content,result);*/
+			/*o.obj=objLevelRead(file,res.content,result); TODO */
 			break;
 		case eResTypeImage16:
 			o.obj=objImage16Read(file,res->palette,result);
diff --git a/PR/src/lib/object/palette/pop1_mono.c b/PR/src/lib/object/palette/pop1_mono.c
deleted file mode 100644
index 147222f..0000000
--- a/PR/src/lib/object/palette/pop1_mono.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*  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
-*/
-
-/*
-palette.c: Princed Resources : The palette object implementation
-\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf
- Copyright 2006 Princed Development Team
-  Created: 09 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 "pal.h"
-
-tColor* objPalette_pop1_monoGetColors(void* o) {
-	static tColor c[2]={{0,0,0},{255,255,255}};
-	return c;
-}