git » fp-git.git » commit d39a3b5

moved formats folder to src/formats

author ecalot
2003-10-24 11:24:28 UTC
committer ecalot
2003-10-24 11:24:28 UTC
parent f4750477f50b6d322c763886c97279e894e12284

moved formats folder to src/formats

PR/src/lib/formats/Attic/mid.c +0 -56
PR/src/lib/formats/Attic/pal.c +0 -117
PR/src/lib/formats/Attic/wav.c +0 -73

diff --git a/PR/src/lib/formats/Attic/mid.c b/PR/src/lib/formats/Attic/mid.c
deleted file mode 100644
index b1ce4d9..0000000
--- a/PR/src/lib/formats/Attic/mid.c
+++ /dev/null
@@ -1,56 +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
-*/
-
-/*
-mid.c: Princed Resources : MIDI files support
-\xaf\xaf\xaf\xaf\xaf
- Copyright 2003 Princed Development Team
-  Created: 24 Aug 2003
-
-  Author: Enrique Calot <ecalot.cod@princed.com.ar>
-  Version: 1.01 (2003-Oct-23)
-
- Note:
-  DO NOT remove this copyright notice
-*/
-
-//Includes
-#include "mid.h"
-#include "extract.h"
-#include "compile.h"
-#include "memory.h"
-#include <string.h>
-
-char mFormatExtractMid(unsigned char* data, char *vFileext,unsigned long int size) {
-	//Mid files are saved as raw except you must ignore checksum & sound type
-	return writeData(data,2,vFileext,size);
-}
-
-char mFormatCompileMid(unsigned char* data, FILE* fp, tResource *res) {
-	unsigned char* file;
-
-	file=getMemory((*res).size);
-	file[0]=(*res).type-2; //Now should be 0x02 //First character must be a 0x01 (wav type in dat)
-	memcpy(file+1,data,(*res).size);
-	(*res).size++;
-	mAddFileToDatFile(fp,file,(*res).size);
-	free(file);
-	return 1;
-}
diff --git a/PR/src/lib/formats/Attic/pal.c b/PR/src/lib/formats/Attic/pal.c
deleted file mode 100644
index 55701f0..0000000
--- a/PR/src/lib/formats/Attic/pal.c
+++ /dev/null
@@ -1,117 +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
-*/
-
-/*
-pal.c: Princed Resources : JASC PAL files support
-\xaf\xaf\xaf\xaf\xaf
- Copyright 2003 Princed Development Team
-  Created: 24 Aug 2003
-
-  Author: Enrique Calot <ecalot.cod@princed.com.ar>
-  Version: 1.01 (2003-Oct-23)
-
- Note:
-  DO NOT remove this copyright notice
-*/
-
-//Includes
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "pal.h"
-#include "memory.h"
-#include "extract.h"
-#include "parser.h"
-#include "resources.h"
-
-/***************************************************************\
-|                 Jasc Palette handling functions               |
-\***************************************************************/
-
-char mFormatExtractPal(unsigned char** data, char *vFileext,unsigned long int size) {
-	//Convert palette from POP format to JASC format
-	mExportPalette(data,&size);
-	//save JASC palette
-	return writeData(*data,0,vFileext,size);
-}
-
-char mImportPalette(unsigned char** data, unsigned short *size) {
-
-	//declare variables
-	unsigned char palh[]=PAL_HEADER;
-	unsigned char pals[]=PAL_SAMPLE;
-	unsigned char* pal;
-	unsigned short int parsed;
-	int i=0;
-	int k=0;
-
-	//check size
-	if (*size<130) return 0;
-
-	pal=getMemory(100);
-
-	//set palette with sample
-	memcpy(pal,pals,100);
-
-	//verify jasc pal header
-	while (palh[i]==(*data)[i++]);
-	if (i!=sizeof(palh)) return 0;
-
-	//set current values
-	for (;k<16;k++) {
-		getNumberToken((*data),&parsed,' ',&i,4);
-		pal[(k*3)+4]=(parsed+2)>>2;
-		getNumberToken((*data),&parsed,' ',&i,4);
-		pal[(k*3)+5]=(parsed+2)>>2;
-		getNumberToken((*data),&parsed,'\r',&i,4);
-		pal[(k*3)+6]=(parsed+2)>>2;
-		i++; //Jump \n
-	}
-
-	//free old data and set new
-	free(*data);
-	*data=pal;
-	*size=100;
-	return 1;
-}
-
-void mExportPalette(unsigned char** data, unsigned long int *size) {
-	unsigned char* pal=getMemory(240);
-	unsigned char* aux=getMemory(240);
-	unsigned char i;
-
-	sprintf(pal,PAL_HEADER);
-
-	for (i=0;i<16;i++) {
-		sprintf(aux,pal);
-		sprintf(pal,"%s%d %d %d\r\n",aux,(*data)[(i*3)+5]<<2,(*data)[(i*3)+6]<<2,(*data)[(i*3)+7]<<2);
-	}
-	for (i=0;pal[i];i++);
-	free(*data);
-	free(aux);
-	(*data)=pal;
-	*size=i-1;
-}
-
-void mLoadPalette(char* array,tImage *image) {
-	int k=0;
-	int i;
-	for (i=5;i<(5+16*3);i++) (*image).pal[k++]=array[i];
-}
diff --git a/PR/src/lib/formats/Attic/wav.c b/PR/src/lib/formats/Attic/wav.c
deleted file mode 100644
index 41d3c3c..0000000
--- a/PR/src/lib/formats/Attic/wav.c
+++ /dev/null
@@ -1,73 +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
-*/
-
-/*
-wav.c: Princed Resources : WAV files support
-\xaf\xaf\xaf\xaf\xaf
- Copyright 2003 Princed Development Team
-  Created: 24 Aug 2003
-
-  Author: Enrique Calot <ecalot.cod@princed.com.ar>
-  Version: 1.01 (2003-Oct-23)
-
- Note:
-  DO NOT remove this copyright notice
-*/
-
-//Includes
-#include "wav.h"
-#include "compile.h"
-
-char mFormatExtractWav(unsigned char* data, char *vFileext,unsigned long int size) {
-	FILE*         target;
-	char ok;
-	unsigned char wav[]=WAVE_HEADER;
-
-	size-=2;
-	ok=((target=fopen(vFileext,"wb"))!=NULL);
-
-	wav[4]=(unsigned char)((size+36)&0xFF);
-	wav[5]=(unsigned char)(((size+36)>>8)&0xFF);
-	wav[6]=(unsigned char)(((size+36)>>16)&0xFF);
-	wav[7]=(unsigned char)(((size+36)>>24)&0xFF);
-
-	wav[40]=(unsigned char)((size)&0xFF);
-	wav[41]=(unsigned char)(((size)>>8)&0xFF);
-	wav[42]=(unsigned char)(((size)>>16)&0xFF);
-	wav[43]=(unsigned char)(((size)>>24)&0xFF);
-
-	ok=ok&&fwrite(wav,sizeof(wav),1,target);
-	ok=ok&&fwrite(data+2,size-2,1,target);
-	ok=ok&&(!fclose(target));
-
-	return ok;
-}
-
-char mFormatCompileWav(unsigned char* data, FILE* fp, tResource *res) {
-	unsigned char wav[]=WAVE_HEADER;
-	int i=sizeof(wav);
-
-	if ((*res).size<=i) return 0;
-	(*res).size-=(--i);
-	while ((i==4||i==5||i==6||i==7||i==40||i==41||i==42||i==43||(data[i]==wav[i]))&&(i--));
-	data[sizeof(wav)-1]=1; //First character must be a 0x01 (wav type in dat)
-	if (i==-1) mAddFileToDatFile(fp,data+sizeof(wav)-1,(*res).size);
-	return 1;
-}