author | ecalot
<ecalot> 2006-06-19 05:45:14 UTC |
committer | ecalot
<ecalot> 2006-06-19 05:45:14 UTC |
parent | a131c0b6101b73e5de3fab848727924caf9512f7 |
PR/src/include/common.h | +2 | -2 |
PR/src/include/image.h | +5 | -5 |
PR/src/include/object.h | +2 | -2 |
PR/src/include/other.h | +5 | -5 |
PR/src/include/palette.h | +3 | -3 |
PR/src/include/sound.h | +6 | -6 |
PR/src/lib/actions/export.c | +11 | -11 |
PR/src/lib/layers/autodetect.c | +1 | -1 |
PR/src/lib/layers/pallist.c | +1 | -1 |
PR/src/lib/object/image/image16.c | +11 | -11 |
PR/src/lib/object/image/image2.c | +7 | -7 |
PR/src/lib/object/image/image256.c | +12 | -12 |
PR/src/lib/object/image/image_common.c | +11 | -11 |
PR/src/lib/object/level/level_common.c | +5 | -5 |
PR/src/lib/object/object.c | +28 | -28 |
PR/src/lib/object/other/binary.c | +5 | -5 |
PR/src/lib/object/palette/pop1_16c.c | +7 | -7 |
PR/src/lib/object/palette/pop2_256c.c | +8 | -8 |
PR/src/ports/winfiles/pr.dev | +34 | -33 |
diff --git a/PR/src/include/common.h b/PR/src/include/common.h index e36935b..089a407 100644 --- a/PR/src/include/common.h +++ b/PR/src/include/common.h @@ -93,7 +93,7 @@ typedef enum { eResTypeImage256=4, eResTypeLevelPop1=5, eResTypeSoundMidi=6, - eResTypePcspeaker=7, + eResTypeSoundPcspeaker=7, eResTypePalettePop1_16=8, eResTypePalettePop1_Guards=9, eResTypePalettePop1_Mono=10, @@ -205,7 +205,7 @@ PARSING_OPTRAW\ #define setFlag(a) optionflag|=(a) #define PR_RESULT_CHECKSUM_ERROR -24 -#define PR_RESULT_COMPRESS_RESULT_FATAL -26 +#define PR_RESULT_COMPRESS_RESULT_FATAL -26 #define PR_RESULT_COMPRESS_RESULT_WARNING -27 #define PR_RESULT_ERR_BMP_BITRATE_DIFFERS -31 #define PR_RESULT_ERR_COMMAND_LINE_SYNTAX -17 diff --git a/PR/src/include/image.h b/PR/src/include/image.h index 2e2f7cd..6498677 100644 --- a/PR/src/include/image.h +++ b/PR/src/include/image.h @@ -37,7 +37,7 @@ image.h: Princed Resources : Image handling headers #include "types.h" #include "binary.h" -typedef struct { +typedef struct { unsigned char r; unsigned char g; unsigned char b; @@ -51,7 +51,7 @@ typedef struct { int pop1rawSize; }tPalette; -typedef struct { +typedef struct { int width; int widthInBytes; int height; @@ -72,11 +72,11 @@ int objImage256Set(void* o,tResource* res); int objImage256Write(void* img,const char* file,int optionflag,const char* backupExtension); int objImage2Set(void* o,tResource* res); int objImage2Write(void* img,const char* file,int optionflag,const char* backupExtension); -void* objImage16Create(tBinary c, int *error); +void* objectImage16Create(tBinary c, int *error); void* objImage16Read(const char* file,tObject palette, int *result); -void* objImage256Create(tBinary c, int *error); +void* objectImage256Create(tBinary c, int *error); void* objImage256Read(const char* file,tObject palette, int *result); -void* objImage2Create(tBinary c, int *error); +void* objectImage2Create(tBinary c, int *error); void* objImage2Read(const char* file,tObject palette, int *result); #define getCarry(a) ((((a)>>4)&7)+1) diff --git a/PR/src/include/object.h b/PR/src/include/object.h index 97d4eda..d21cccb 100644 --- a/PR/src/include/object.h +++ b/PR/src/include/object.h @@ -37,8 +37,8 @@ object.h: Princed Resources : Main item class types and prototypes #include "common.h" #include "image.h" -tObject getObject(tResource* r, int* error); -int writeObject(tObject o, const char* file, int optionflag, const char* backupExtension); +tObject objectCreate(tResource* r, int* error); +int objectWrite(tObject o, const char* file, int optionflag, const char* backupExtension); tObject readObject(const char* file,tResource* newRes,int *result); void setObject(tObject o,int *result,tResource* res); diff --git a/PR/src/include/other.h b/PR/src/include/other.h index 3108c28..820ab9b 100644 --- a/PR/src/include/other.h +++ b/PR/src/include/other.h @@ -19,7 +19,7 @@ */ /* -other.h: Princed Resources : +other.h: Princed Resources : \xaf\xaf\xaf\xaf\xaf Copyright 2006 Princed Development Team Created: 17 Feb 2006 @@ -35,12 +35,12 @@ other.h: Princed Resources : #include "binary.h" -void* objBinaryCreate(tBinary c, int *error); -int objBinaryWrite(void* o, const char* file, int optionflag, const char* backupExtension); +void* objectBinaryCreate(tBinary c, int *error); +int objectBinaryWrite(void* o, const char* file, int optionflag, const char* backupExtension); void* objBinaryRead(const char* file,int *result); int objBinarySet(void* o,tResource* res); -void* objLevelCreate(tBinary content,int number,const char* datfile,const char* name,const char* desc,const char* datAuthor,int *error); /* TODO: move to level.h */ -int objLevelWrite(void* o, const char* file, int optionflag, const char* backupExtension); +void* objectLevelPop1Create(tBinary content,int number,const char* datfile,const char* name,const char* desc,const char* datAuthor,int *error); /* TODO: move to level.h */ +int objectLevelPop1Write(void* o, const char* file, int optionflag, const char* backupExtension); #endif diff --git a/PR/src/include/palette.h b/PR/src/include/palette.h index 18c38f1..70177ab 100644 --- a/PR/src/include/palette.h +++ b/PR/src/include/palette.h @@ -64,12 +64,12 @@ int applyPalette(tPalette* p,tImage *i); void* objPalette_pop2_4bitsCreate(tBinary c, int *error); int objPalette_pop2_4bitsWrite(void* o, const char* file, int optionflag, const char* backupExtension); -void* objPalette_pop1_4bitsCreate(tBinary c, int *error); +void* objectPalettePop1_16Create(tBinary c, int *error); int objPalette_pop1_4bitsWrite(void* o, const char* file, int optionflag, const char* backupExtension); void* objPop1Palette4bitsRead(const char* file,int *result); int objPop1Palette4bitsSet(void* o,tResource* res); /*int objPop2Palette4bitsSet(void* o,tResource* res);*/ -void* objPop2PaletteNColorsCreate(tBinary cont, int *error); +void* objectPalettePop2_NColorsCreate(tBinary cont, int *error); int objPop2PaletteNColorsWrite(void* o, const char* file, int optionflag, const char* backupExtension); void* objPop2PaletteNColorsRead(const char* file,int *result); int objPop2PaletteNColorsSet(void* o,tResource* res); @@ -92,6 +92,6 @@ tColor* objPalette_pop2_ncolorsGetColors(void* o); #define PAL_COLORS_eResTypePalettePop1_Mono 2 int getColorsByPop2PaletteObject(void* o); - + #endif diff --git a/PR/src/include/sound.h b/PR/src/include/sound.h index 0e0c2d1..3c086d4 100644 --- a/PR/src/include/sound.h +++ b/PR/src/include/sound.h @@ -19,7 +19,7 @@ */ /* -sound.h: Princed Resources : +sound.h: Princed Resources : \xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2006 Princed Development Team Created: 19 Feb 2006 @@ -45,9 +45,9 @@ void* objSoundCreate(tBinary c, int *error); int objWaveWrite(void* o, const char* file, int optionflag, const char* backupExtension); -#define objWaveCreate(a,b) objSoundCreate(a,b) -#define objMidiCreate(a,b) objSoundCreate(a,b) -#define objPcspeakerCreate(a,b) objSoundCreate(a,b) +#define objectSoundWaveCreate(a,b) objSoundCreate(a,b) +#define objectSoundMidiCreate(a,b) objSoundCreate(a,b) +#define objectSoundPcspeakerCreate(a,b) objSoundCreate(a,b) /*#define objWaveRead(a,b,c,d,e) objSoundRead(a,readWav,b,c,d,e)*/ /*void* objSoundRead(const char* file, int read(const char* file, tBinary* c, int *pchannels, long *psamplerate, long *pbps), int *result);*/ @@ -60,7 +60,7 @@ int objWaveSet(void* o,tResource* res); int objPcspeakerSet(void* o,tResource* res); int objMidiSet(void* o,tResource* res); -#define objMidiWrite(a,b,c,d) objBinaryWrite(a,b,c,d) -#define objPcspeakerWrite(a,b,c,d) objBinaryWrite(a,b,c,d) +#define objMidiWrite(a,b,c,d) objectBinaryWrite(a,b,c,d) +#define objPcspeakerWrite(a,b,c,d) objectBinaryWrite(a,b,c,d) #endif diff --git a/PR/src/lib/actions/export.c b/PR/src/lib/actions/export.c index aad7ade..aac8b27 100644 --- a/PR/src/lib/actions/export.c +++ b/PR/src/lib/actions/export.c @@ -46,7 +46,7 @@ export.c: Princed Resources : DAT Extractor #include "memory.h" #include "object.h" #include "palette.h" -#include "pallist.h" +#include "pallist.h" #include "unknown.h" extern FILE* outputStream; @@ -70,7 +70,7 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti int indexNumber; int ok; /* tImage image; * this is used to make a persistent palette */ - tObject currentPalette=getObject(NULL,&ok); /*TODO: move to pallist */ + tObject currentPalette=objectCreate(NULL,&ok); /*TODO: move to pallist */ unsigned short int numberOfItems; tResourceId nullPalette={0,"",0}; /* tPaletteList paletteBuffer;*/ @@ -111,10 +111,10 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti /* handle palette linking */ switch (res.type) { /*case eResTypePop2Palette4bits: */ - case eResTypePalettePop2_NColors: + case eResTypePalettePop2_NColors: case eResTypePalettePop1_16: { /* save and remember palette file */ /*tPaletteListItem e; * deprecated */ - o=getObject(&res,&ok); + o=objectCreate(&res,&ok); printf("new palette object: o=%p type=%d\n",o.obj,o.type); if (!ok) { /* if SUCCESS remember the palette, otherwise keep using the default one */ @@ -134,7 +134,7 @@ printf("new palette object: o=%p type=%d\n",o.obj,o.type); /* Read the palette and load it into memory */ if (resourceListCompareId(res.paletteId,nullPalette) /* add &&!paletteCheckCompatibility(currentPalette,image) */) { /* The palette isn't in the buffer */ if (mReadFileInDatFileId(&otherPalette)==PR_RESULT_SUCCESS) { - o=getObject(&otherPalette,&ok); + o=objectCreate(&otherPalette,&ok); printf("adding "); showobj(o); pl_add(&palettes,o,res.paletteId,highPriority); @@ -142,7 +142,7 @@ showobj(o); /*tPaletteListItem e; resourceListAddInfo(r,&otherPalette);*/ /* All right, it's not so bad, I can handle it! I'll buffer the new palette */ - /*e.pal=currentPalette=getObject(&otherPalette,&ok); + /*e.pal=currentPalette=objectCreate(&otherPalette,&ok); e.id=res.id;*/ /*list_insert(&paletteBuffer,(void*)&e);*/ } else { /*, that's bad, I'll have to use the previous palette, even if it is the default */ @@ -150,8 +150,8 @@ showobj(o); } } /*res.palette=currentPalette;*/ - o=getObject(&res,&ok); -printf("getting the palette for the %d colours object ",paletteGetColors(o)); + o=objectCreate(&res,&ok); +printf("getting the palette for the %d colours object ",paletteGetColors(o)); showobj(o); pal=pl_get(&palettes,&priorityRight,paletteGetColors(o)); printf("palette "); @@ -163,13 +163,13 @@ showobj(pal); break; } default: - o=getObject(&res,&ok); + o=objectCreate(&res,&ok); break; } - /* TODO: warning counting here */ + /* TODO: warning counting here */ /* if (!fatal(ok)) */ if (ok==PR_RESULT_SUCCESS) - ok=writeObject(o,file,optionflag,backupExtension); + ok=objectWrite(o,file,optionflag,backupExtension); else /* printf("not ok. result=%d for %s\n",ok,file);*/ diff --git a/PR/src/lib/layers/autodetect.c b/PR/src/lib/layers/autodetect.c index efeb160..c5c29c4 100644 --- a/PR/src/lib/layers/autodetect.c +++ b/PR/src/lib/layers/autodetect.c @@ -133,7 +133,7 @@ tResourceType verifyHeader(tBinary c) { /* TODO: add the pop version as another if (verifyPaletteHeaderPop1 (c)) return eResTypePalettePop1_16; if (verifyPaletteHeaderPop2 (c)) return eResTypePalettePop2_NColors; if (verifyWaveHeader (c)) return eResTypeSoundWave; - if (verifySpeakerHeader (c)) return eResTypePcspeaker; + if (verifySpeakerHeader (c)) return eResTypeSoundPcspeaker; return eResTypeOtherBinary; } diff --git a/PR/src/lib/layers/pallist.c b/PR/src/lib/layers/pallist.c index feb9dcd..bc3c3e1 100644 --- a/PR/src/lib/layers/pallist.c +++ b/PR/src/lib/layers/pallist.c @@ -151,7 +151,7 @@ showobj(pl->list_first->object); while (node && colors>paletteGetColors(node->object)) { node=node->next; printf("next %p\n",(void*)node); } - return node?node->object:getObject(NULL,&junk); + return node?node->object:objectCreate(NULL,&junk); } #ifdef DEBUG_TEST_PALLST diff --git a/PR/src/lib/object/image/image16.c b/PR/src/lib/object/image/image16.c index 1b6fae2..b2f67fb 100644 --- a/PR/src/lib/object/image/image16.c +++ b/PR/src/lib/object/image/image16.c @@ -94,7 +94,7 @@ image.c: Princed Resources : Image Compression Library | I M P L E M E N T A T I O N | \***************************************************************/ -int pop2decompress(const unsigned char* input, int inputSize, int verify, unsigned char** output,int* outputSize); +int pop2decompress(const unsigned char* input, int inputSize, int verify, unsigned char** output,int* outputSize); /***************************************************************\ | Compression Level Manager | @@ -158,7 +158,7 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) int imageSizeInBytes=0; int result; - + image->height=array2short(data); data+=2; image->width =array2short(data); @@ -171,7 +171,7 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) case 8: image->widthInBytes=(image->width); break; - case 4: + case 4: image->widthInBytes=(image->width+1)/2; break; case 1: @@ -351,7 +351,7 @@ tColor* objPalette_16() { return c; } -void* objImage16Create(tBinary cont, int *error) { /* use get like main.c */ +void* objectImage16Create(tBinary cont, int *error) { /* use get like main.c */ /* * This function will expand the data into an image structure, @@ -378,9 +378,9 @@ void* objImage16Create(tBinary cont, int *error) { /* use get like main.c */ bits=paletteGetBits(image->pal); if (bits && bits!=getCarry(image->type)) printf("error, palette mismatch (pal=%d bits=%d)\n",bits,getCarry(image->type)); image->bits=getCarry(image->type);*/ - + image->colorCount=2; - + return (void*)image; } @@ -400,7 +400,7 @@ int objImage16Write(void* img,const char* file,int optionflag,const char* backup colors=16; colorArray=objPalette_16(); } - + /* Write bitmap */ return mWriteBmp(file,i->pix,i->width,i->height,bits,colors,colorArray,i->widthInBytes,optionflag,backupExtension); } @@ -426,7 +426,7 @@ void* objImage16Read(const char* file,tObject palette, int *result) { } /* check the palette information */ - + image->pal=palette; bits=paletteGetBits(image->pal); if (bits && bits!=image->bits) { /* bits=0 means all palettes allowed or ignore palette check */ @@ -436,7 +436,7 @@ void* objImage16Read(const char* file,tObject palette, int *result) { free(image); return NULL; } - + /* TODO: palette content checks */ free(colorArray); @@ -452,7 +452,7 @@ int objImage16Set(void* o,tResource* res) { decompressed.data=img->pix; decompressed.size=img->widthInBytes*img->height; - + algorithm=mCompressGraphic(&decompressed,&compressed,6,img->widthInBytes,img->height); /* @@ -469,7 +469,7 @@ int objImage16Set(void* o,tResource* res) { compressed.data[4]=0; compressed.data[5]=0xb0|algorithm; - res->content=compressed; + res->content=compressed; mWriteFileInDatFile(res); return PR_RESULT_SUCCESS; } diff --git a/PR/src/lib/object/image/image2.c b/PR/src/lib/object/image/image2.c index 7f6cad0..6b38221 100644 --- a/PR/src/lib/object/image/image2.c +++ b/PR/src/lib/object/image/image2.c @@ -101,7 +101,7 @@ tColor* objPalette_pop1_monoGetColors() { extern FILE* outputStream; -void* objImage2Create(tBinary cont, int *error) { /* use get like main.c */ +void* objectImage2Create(tBinary cont, int *error) { /* use get like main.c */ /* * This function will expand the data into an image structure, @@ -124,7 +124,7 @@ void* objImage2Create(tBinary cont, int *error) { /* use get like main.c */ } if (getCarry(image->type) != 1 ) printf("error, monochrome palette fromat wrong\n"); - + return (void*)image; } @@ -148,11 +148,11 @@ void* objImage2Read(const char* file,tObject palette, int *result) { free(image); return NULL; } - + free(colorArray); /* check the palette information */ - + bits=paletteGetBits(image->pal); if (image->bits!=1) { *result=PR_RESULT_ERR_BMP_BITRATE_DIFFERS; @@ -161,7 +161,7 @@ void* objImage2Read(const char* file,tObject palette, int *result) { return NULL; } image->colorCount=2; - + return (void*)image; } @@ -172,7 +172,7 @@ int objImage2Set(void* o,tResource* res) { decompressed.data=img->pix; decompressed.size=img->widthInBytes*img->height; - + algorithm=mCompressGraphic(&decompressed,&compressed,6,img->widthInBytes,img->height); /* @@ -189,7 +189,7 @@ int objImage2Set(void* o,tResource* res) { compressed.data[4]=0; compressed.data[5]=algorithm; - res->content=compressed; + res->content=compressed; mWriteFileInDatFile(res); return PR_RESULT_SUCCESS; } diff --git a/PR/src/lib/object/image/image256.c b/PR/src/lib/object/image/image256.c index fa8e18a..c858fcc 100644 --- a/PR/src/lib/object/image/image256.c +++ b/PR/src/lib/object/image/image256.c @@ -94,7 +94,7 @@ image.c: Princed Resources : Image Compression Library | I M P L E M E N T A T I O N | \***************************************************************/ -int pop2decompress(const unsigned char* input, int inputSize, int verify, unsigned char** output,int* outputSize); +int pop2decompress(const unsigned char* input, int inputSize, int verify, unsigned char** output,int* outputSize); /***************************************************************\ | Main compress and expand graphics | @@ -131,7 +131,7 @@ int mExpandGraphic256(const unsigned char* data,tImage *image, int dataSizeInByt image->widthInBytes=(image->width); imageSizeInBytes=image->widthInBytes*image->height; break; - case 4: + case 4: image->widthInBytes=(image->width+1)/2; break; case 1: @@ -198,7 +198,7 @@ int mCompressGraphic256(tBinary* input, tBinary* output, int ignoreFirstBytes, i return algorithm; } -int pop2decompress(const unsigned char* input, int inputSize, int verify, unsigned char** output,int* outputSize) { +int pop2decompress(const unsigned char* input, int inputSize, int verify, unsigned char** output,int* outputSize) { /* This function is in an experimental state and hasn't yet been linked to the program */ unsigned char* tempOutput; unsigned char* lineI; /* chunk */ @@ -249,7 +249,7 @@ int pop2decompress(const unsigned char* input, int inputSize, int verify, unsign /*printf("Remaining tailing data: size=%d first=%02x %02x\n", remaining,start[0],start[1]);*/ tempOutputSize=0; remaining=expandLzg(start,remaining,&tempOutput,&tempOutputSize); - + lineI=tempOutput; while (lineSize==verify && tempOutputSize>0) { @@ -295,7 +295,7 @@ int pop2decompress(const unsigned char* input, int inputSize, int verify, unsign extern FILE* outputStream; -void* objImage256Create(tBinary cont, int *error) { /* use get like main.c */ +void* objectImage256Create(tBinary cont, int *error) { /* use get like main.c */ /* * This function will expand the data into an image structure, @@ -331,7 +331,7 @@ void* objImage256Create(tBinary cont, int *error) { /* use get like main.c */ bits=paletteGetBits(image->pal); if (bits && bits!=getCarry(image->type)) printf("error, palette mismatch (pal=%d bits=%d)\n",bits,getCarry(image->type));*/ image->bits=getCarry(image->type); - + return (void*)image; } @@ -352,7 +352,7 @@ int objImage256Write(void* img,const char* file,int optionflag,const char* backu int bits; int colors; tColor* colorArray; - + if (i->pal.type!=eResTypeNone) { bits=paletteGetBits(i->pal); colors=i->colorCount; /*paletteGetColors(i->pal);*/ @@ -362,7 +362,7 @@ int objImage256Write(void* img,const char* file,int optionflag,const char* backu colors=256; /*1<<bits;*/ colorArray=objPalette_256(); } - + /* Write bitmap */ return mWriteBmp(file,i->pix,i->width,i->height,bits,colors,colorArray,i->widthInBytes,optionflag,backupExtension); } @@ -388,7 +388,7 @@ void* objImage256Read(const char* file,tObject palette, int *result) { } /* check the palette information */ - + image->pal=palette; bits=paletteGetBits(image->pal); if (bits && bits!=image->bits) { /* bits=0 means all palettes allowed or ignore palette check */ @@ -398,7 +398,7 @@ void* objImage256Read(const char* file,tObject palette, int *result) { free(image); return NULL; } - + /* TODO: palette content checks */ free(colorArray); @@ -413,7 +413,7 @@ int objImage256Set(void* o,tResource* res) { decompressed.data=img->pix; decompressed.size=img->widthInBytes*img->height; - + mCompressGraphic256(&decompressed,&compressed,6,img->widthInBytes,img->height); /* @@ -430,7 +430,7 @@ int objImage256Set(void* o,tResource* res) { compressed.data[4]=0; compressed.data[5]=0xf3; - res->content=compressed; + res->content=compressed; mWriteFileInDatFile(res); return PR_RESULT_SUCCESS; } diff --git a/PR/src/lib/object/image/image_common.c b/PR/src/lib/object/image/image_common.c index 1b6fae2..b2f67fb 100644 --- a/PR/src/lib/object/image/image_common.c +++ b/PR/src/lib/object/image/image_common.c @@ -94,7 +94,7 @@ image.c: Princed Resources : Image Compression Library | I M P L E M E N T A T I O N | \***************************************************************/ -int pop2decompress(const unsigned char* input, int inputSize, int verify, unsigned char** output,int* outputSize); +int pop2decompress(const unsigned char* input, int inputSize, int verify, unsigned char** output,int* outputSize); /***************************************************************\ | Compression Level Manager | @@ -158,7 +158,7 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) int imageSizeInBytes=0; int result; - + image->height=array2short(data); data+=2; image->width =array2short(data); @@ -171,7 +171,7 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) case 8: image->widthInBytes=(image->width); break; - case 4: + case 4: image->widthInBytes=(image->width+1)/2; break; case 1: @@ -351,7 +351,7 @@ tColor* objPalette_16() { return c; } -void* objImage16Create(tBinary cont, int *error) { /* use get like main.c */ +void* objectImage16Create(tBinary cont, int *error) { /* use get like main.c */ /* * This function will expand the data into an image structure, @@ -378,9 +378,9 @@ void* objImage16Create(tBinary cont, int *error) { /* use get like main.c */ bits=paletteGetBits(image->pal); if (bits && bits!=getCarry(image->type)) printf("error, palette mismatch (pal=%d bits=%d)\n",bits,getCarry(image->type)); image->bits=getCarry(image->type);*/ - + image->colorCount=2; - + return (void*)image; } @@ -400,7 +400,7 @@ int objImage16Write(void* img,const char* file,int optionflag,const char* backup colors=16; colorArray=objPalette_16(); } - + /* Write bitmap */ return mWriteBmp(file,i->pix,i->width,i->height,bits,colors,colorArray,i->widthInBytes,optionflag,backupExtension); } @@ -426,7 +426,7 @@ void* objImage16Read(const char* file,tObject palette, int *result) { } /* check the palette information */ - + image->pal=palette; bits=paletteGetBits(image->pal); if (bits && bits!=image->bits) { /* bits=0 means all palettes allowed or ignore palette check */ @@ -436,7 +436,7 @@ void* objImage16Read(const char* file,tObject palette, int *result) { free(image); return NULL; } - + /* TODO: palette content checks */ free(colorArray); @@ -452,7 +452,7 @@ int objImage16Set(void* o,tResource* res) { decompressed.data=img->pix; decompressed.size=img->widthInBytes*img->height; - + algorithm=mCompressGraphic(&decompressed,&compressed,6,img->widthInBytes,img->height); /* @@ -469,7 +469,7 @@ int objImage16Set(void* o,tResource* res) { compressed.data[4]=0; compressed.data[5]=0xb0|algorithm; - res->content=compressed; + res->content=compressed; mWriteFileInDatFile(res); return PR_RESULT_SUCCESS; } diff --git a/PR/src/lib/object/level/level_common.c b/PR/src/lib/object/level/level_common.c index 6077d7d..78b1895 100644 --- a/PR/src/lib/object/level/level_common.c +++ b/PR/src/lib/object/level/level_common.c @@ -19,7 +19,7 @@ */ /* -.c: Princed Resources : +.c: Princed Resources : \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2006 Princed Development Team Created: 5 Mar 2006 @@ -55,8 +55,8 @@ typedef struct { const char* datAuthor; }tPop1Level; -void* objLevelCreate(tBinary content,int number,const char* datfile,const char* name,const char* desc,const char* datAuthor,int *error) { - tPop1Level* r; +void* objectLevelPop1Create(tBinary content,int number,const char* datfile,const char* name,const char* desc,const char* datAuthor,int *error) { + tPop1Level* r; *error=PR_RESULT_SUCCESS; /*TODO: fix the original file name path (lala///lele/demo.plv--> demo.plv) */ @@ -70,7 +70,7 @@ void* objLevelCreate(tBinary content,int number,const char* datfile,const char* return (void*)r; } -int objLevelWrite(void* o, const char* file, int optionflag, const char* backupExtension) { +int objectLevelPop1Write(void* o, const char* file, int optionflag, const char* backupExtension) { tPop1Level* b=o; return writePlv(file,b->content,b->content.size==12025?2:1,b->datfile,b->number,file,b->desc,b->name,b->datAuthor,optionflag,backupExtension); } @@ -82,7 +82,7 @@ void* objLevelRead(const char* file,int *result) { *result=o.size; return NULL; } - return objLevelCreate(o,result); + return objectLevelPop1Create(o,result); } int objLevelSet(void* o,tResource* res) { diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c index 479cd0f..91da3c9 100644 --- a/PR/src/lib/object/object.c +++ b/PR/src/lib/object/object.c @@ -41,7 +41,7 @@ main.c: Princed Resources : Main item class implementation /* Object polimorphism hook layer */ -tObject getObject(tResource* r, int* error) { +tObject objectCreate(tResource* r, int* error) { tObject o; if (!r) { *error=PR_RESULT_SUCCESS; @@ -53,36 +53,36 @@ tObject getObject(tResource* r, int* error) { o.type=r->type; switch (o.type) { case eResTypeLevelPop1: - o.obj=objLevelCreate(r->content,r->number,r->datfile,r->name,r->desc,r->datAuthor,error); + o.obj=objectLevelPop1Create(r->content,r->number,r->datfile,r->name,r->desc,r->datAuthor,error); break; case eResTypeOtherBinary: /* Binary files */ case eResTypeOtherText: /* Text files */ case eResTypeOtherRaw: /* Raw files */ - o.obj=objBinaryCreate(r->content,error); + o.obj=objectBinaryCreate(r->content,error); break; case eResTypePalettePop1_16: /* save and remember palette file */ - o.obj=objPalette_pop1_4bitsCreate(r->content,error); + o.obj=objectPalettePop1_16Create(r->content,error); break; case eResTypePalettePop2_NColors: /* save and remember palette file */ - o.obj=objPop2PaletteNColorsCreate(r->content,error); + o.obj=objectPalettePop2_NColorsCreate(r->content,error); break; - case eResTypePcspeaker: /* save pcs file */ - o.obj=objPcspeakerCreate(r->content,error); + case eResTypeSoundPcspeaker: /* save pcs file */ + o.obj=objectSoundPcspeakerCreate(r->content,error); break; case eResTypeSoundMidi: /* save midi file */ - o.obj=objMidiCreate(r->content,error); + o.obj=objectSoundMidiCreate(r->content,error); break; case eResTypeSoundWave: /* save wav file */ - o.obj=objWaveCreate(r->content,error); + o.obj=objectSoundWaveCreate(r->content,error); break; case eResTypeImage2: /* save image */ - o.obj=objImage2Create(r->content,error); + o.obj=objectImage2Create(r->content,error); break; case eResTypeImage16: /* save image */ - o.obj=objImage16Create(r->content,error); + o.obj=objectImage16Create(r->content,error); break; case eResTypeImage256: /* save image */ - o.obj=objImage256Create(r->content,error); + o.obj=objectImage256Create(r->content,error); break; default: printf("Exception: Unhooked type %d\n",o.type); @@ -90,20 +90,20 @@ printf("Exception: Unhooked type %d\n",o.type); o.obj=NULL; break; } - + return o; } -int writeObject(tObject o, const char* file, int optionflag, const char* backupExtension) { +int objectWrite(tObject o, const char* file, int optionflag, const char* backupExtension) { int error; switch (o.type) { case eResTypeLevelPop1: - error=objLevelWrite(o.obj,file,optionflag,backupExtension); + error=objectLevelPop1Write(o.obj,file,optionflag,backupExtension); break; case eResTypeOtherBinary: /* Binary files */ case eResTypeOtherText: /* Text files */ case eResTypeOtherRaw: /* Raw/autodetect files */ - error=objBinaryWrite(o.obj,file,optionflag,backupExtension); + error=objectBinaryWrite(o.obj,file,optionflag,backupExtension); break; case eResTypePalettePop1_16: /* save and remember palette file */ error=objPalette_pop1_4bitsWrite(o.obj,file,optionflag,backupExtension); @@ -111,7 +111,7 @@ int writeObject(tObject o, const char* file, int optionflag, const char* backupE case eResTypePalettePop2_NColors: /* save and remember palette file */ error=objPop2PaletteNColorsWrite(o.obj,file,optionflag,backupExtension); break; - case eResTypePcspeaker: /* save pcs file */ + case eResTypeSoundPcspeaker: /* save pcs file */ error=objPcspeakerWrite(o.obj,file,optionflag,backupExtension); break; case eResTypeSoundMidi: /* save midi file */ @@ -135,7 +135,7 @@ printf("Warning: Couldn't write unhooked type %d\n",o.type); } return error; -} +} /* Palette class methods */ @@ -143,25 +143,25 @@ int paletteGetBits(tObject pal) { switch (pal.type) { case eResTypePalettePop2_NColors: return 8; - case eResTypePalettePop1_16: + case eResTypePalettePop1_16: return 4; - case eResTypePalettePop1_Mono: + case eResTypePalettePop1_Mono: return 1; default: return 0; } } - + int paletteGetColors(tObject object) { /* TODO: rename to objectGetColors */ switch (object.type) { case eResTypePalettePop2_NColors: return PAL_COLORS_eResTypePalettePop2_NColors; /*256;*/ - case eResTypePalettePop1_16: + case eResTypePalettePop1_16: return PAL_COLORS_eResTypePalettePop1_16; /*16;*/ - case eResTypePalettePop1_Mono: + case eResTypePalettePop1_Mono: return PAL_COLORS_eResTypePalettePop1_Mono; /*2;*/ - case eResTypeNone: - return 256; + case eResTypeNone: + return 256; case eResTypeImage16: case eResTypeImage2: case eResTypeImage256: @@ -214,7 +214,7 @@ void setObject(tObject o,int *result,tResource* res) { case eResTypeSoundMidi: *result=objMidiSet(o.obj,res); break; - case eResTypePcspeaker: + case eResTypeSoundPcspeaker: *result=objPcspeakerSet(o.obj,res); break; case eResTypePalettePop1_16: @@ -225,7 +225,7 @@ void setObject(tObject o,int *result,tResource* res) { *result=objBinarySet(o.obj,res); break; } - + } /* Format detection function (private function, not in header file) */ @@ -245,7 +245,7 @@ tObject readObject(const char* file,tResource* res,int *result) { case eResTypeSoundMidi: o.obj=objMidiRead(file,result); break; - case eResTypePcspeaker: + case eResTypeSoundPcspeaker: o.obj=objPcspeakerRead(file,result); break; case eResTypePalettePop1_16: diff --git a/PR/src/lib/object/other/binary.c b/PR/src/lib/object/other/binary.c index 9bc9859..b8b4375 100644 --- a/PR/src/lib/object/other/binary.c +++ b/PR/src/lib/object/other/binary.c @@ -19,7 +19,7 @@ */ /* -.c: Princed Resources : +.c: Princed Resources : \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2006 Princed Development Team Created: 17 Feb 2006 @@ -46,17 +46,17 @@ | Binary Object | \***************************************************************/ -void* objBinaryCreate(tBinary cont, int *error) { /* use get like main.c */ +void* objectBinaryCreate(tBinary cont, int *error) { /* use get like main.c */ tBinary* r; *error=PR_RESULT_SUCCESS; - + r=(tBinary*)malloc(sizeof(tBinary)); *r=cont; r->isCopy=1; return (void*)r; } -int objBinaryWrite(void* o, const char* file, int optionflag, const char* backupExtension) { +int objectBinaryWrite(void* o, const char* file, int optionflag, const char* backupExtension) { tBinary* b=o; return writeData(b->data,0,file,b->size,optionflag,backupExtension)?PR_RESULT_SUCCESS:PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS; } @@ -67,7 +67,7 @@ void* objBinaryRead(const char* file,int *result) { *result=o.size; return NULL; } - return objBinaryCreate(o,result); /* TODO: isCopy=0 */ + return objectBinaryCreate(o,result); /* TODO: isCopy=0 */ } int objBinarySet(void* o,tResource* res) { diff --git a/PR/src/lib/object/palette/pop1_16c.c b/PR/src/lib/object/palette/pop1_16c.c index e102ac9..3b2a29b 100644 --- a/PR/src/lib/object/palette/pop1_16c.c +++ b/PR/src/lib/object/palette/pop1_16c.c @@ -145,7 +145,7 @@ int readPalette(tPalette* p, unsigned char* data, int dataSize) { bits=8; break; } - + if (bits) setPalette(p,bits,c); return bits; } @@ -163,22 +163,22 @@ void addPop1Raw(tPalette* p,unsigned char* data, int dataSize) { */ #endif -typedef struct { +typedef struct { tColor c[16]; unsigned char raw[100]; }tPop1_4bitsPalette; -void* objPalette_pop1_4bitsCreate(tBinary cont, int *error) { +void* objectPalettePop1_16Create(tBinary cont, int *error) { int i; tPop1_4bitsPalette* pal; - + if (cont.size!=100) { *error=PR_RESULT_XML_AND_DAT_FORMAT_DO_NOT_MATCH; return NULL; } pal=(tPop1_4bitsPalette*)malloc(sizeof(tPop1_4bitsPalette)); - + for (i=0;i<16;i++) { pal->c[i].r=cont.data[(i*3)+4]<<2; pal->c[i].g=cont.data[(i*3)+5]<<2; @@ -188,7 +188,7 @@ void* objPalette_pop1_4bitsCreate(tBinary cont, int *error) { memcpy(pal->raw,cont.data,100); *error=PR_RESULT_SUCCESS; - + return (void*)pal; } @@ -264,7 +264,7 @@ void* objPop1Palette4bitsRead(const char* file,int *result) { } memcpy(pal->c,colorArray,sizeof(tColor)*16); free(colorArray); - + return (void*)pal; } diff --git a/PR/src/lib/object/palette/pop2_256c.c b/PR/src/lib/object/palette/pop2_256c.c index 7058d38..5f8bd48 100644 --- a/PR/src/lib/object/palette/pop2_256c.c +++ b/PR/src/lib/object/palette/pop2_256c.c @@ -46,22 +46,22 @@ palette.c: Princed Resources : The palette object implementation #include "pal.h" -typedef struct { +typedef struct { tColor* colorArray; int size; }tGenericPalette; -void* objPop2PaletteNColorsCreate(tBinary cont, int *error) { +void* objectPalettePop2_NColorsCreate(tBinary cont, int *error) { tGenericPalette* r; int i,j; - + *error=PR_RESULT_SUCCESS; if (!isA64kPalette(cont)) { /* TODO: use autodetect function to verify */ *error=-14; /* TODO FIX or assign error code */ return NULL; } - + r=(tGenericPalette*)malloc(sizeof(tGenericPalette)); r->colorArray=(tColor*)malloc(sizeof(tColor)*((cont.size+2)/3)); for (i=0,j=0;i<cont.size;i+=3,j++) { @@ -72,7 +72,7 @@ void* objPop2PaletteNColorsCreate(tBinary cont, int *error) { /*if (j!=256 && j!=320) return NULL; *TODO: add free */ r->size=j; printf("created a palette with %d colors. cs=%ld\n",j,cont.size); - + return (void*)r; } @@ -94,9 +94,9 @@ int objPop2PaletteNColorsWrite(void* o, const char* file, int optionflag, const void* objPop2PaletteNColorsRead(const char* file,int *result) { tGenericPalette *r; - + r=(tGenericPalette*)malloc(sizeof(tGenericPalette)); - + *result=readPal(file,&r->colorArray,&r->size); if (*result==PR_RESULT_SUCCESS && !(r->size==256 || r->size==320)) { @@ -105,7 +105,7 @@ void* objPop2PaletteNColorsRead(const char* file,int *result) { free(r); return NULL; } - + return (void*)r; } diff --git a/PR/src/ports/winfiles/pr.dev b/PR/src/ports/winfiles/pr.dev index 3474dfd..c18f12f 100644 --- a/PR/src/ports/winfiles/pr.dev +++ b/PR/src/ports/winfiles/pr.dev @@ -1,7 +1,7 @@ [Project] FileName=pr.dev Name=pr -UnitCount=95 +UnitCount=94 Type=1 Ver=1 ObjFiles= @@ -830,17 +830,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit82] -FileName=..\..\lib\object\palette\pop1_4bit.c -CompileCpp=0 -Folder=src/lib/object/palette -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit83] -FileName=..\..\lib\object\palette\pop2_4bit.c +FileName=..\..\lib\object\palette\pop1_16c.c CompileCpp=0 Folder=src/lib/object/palette Compile=1 @@ -850,9 +840,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit84] -FileName=..\..\lib\object\palette\pop2_256c.c +FileName=..\..\lib\object\sound\sounds.c CompileCpp=0 -Folder=src/lib/object/palette +Folder=src/lib/object/sound Compile=1 Link=1 Priority=1000 @@ -860,9 +850,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit85] -FileName=..\..\lib\object\sound\sounds.c +FileName=..\..\lib\xml\parse.c CompileCpp=0 -Folder=src/lib/object/sound +Folder=src/lib/xml Compile=1 Link=1 Priority=1000 @@ -870,7 +860,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit86] -FileName=..\..\lib\xml\parse.c +FileName=..\..\lib\xml\search.c CompileCpp=0 Folder=src/lib/xml Compile=1 @@ -880,7 +870,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit87] -FileName=..\..\lib\xml\search.c +FileName=..\..\lib\xml\translate.c CompileCpp=0 Folder=src/lib/xml Compile=1 @@ -890,7 +880,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit88] -FileName=..\..\lib\xml\translate.c +FileName=..\..\lib\xml\tree.c CompileCpp=0 Folder=src/lib/xml Compile=1 @@ -900,7 +890,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit89] -FileName=..\..\lib\xml\tree.c +FileName=..\..\lib\xml\unknown.c CompileCpp=0 Folder=src/lib/xml Compile=1 @@ -910,9 +900,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit90] -FileName=..\..\lib\xml\unknown.c +FileName=..\..\lib\pr.c CompileCpp=0 -Folder=src/lib/xml +Folder=src/lib Compile=1 Link=1 Priority=1000 @@ -920,17 +910,17 @@ OverrideBuildCmd=0 BuildCmd= [Unit91] -FileName=..\..\lib\pr.c +FileName=..\..\..\doc\readme.coders.txt CompileCpp=0 -Folder=src/lib -Compile=1 -Link=1 +Folder=doc +Compile=0 +Link=0 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit92] -FileName=..\..\..\doc\readme.coders.txt +FileName=..\..\..\doc\readme.txt CompileCpp=0 Folder=doc Compile=0 @@ -943,7 +933,7 @@ BuildCmd= Major=1 Minor=3 Release=0 -Build=15 +Build=27 LanguageID=2057 CharsetID=1252 CompanyName=Princed development team @@ -958,7 +948,7 @@ ProductVersion= AutoIncBuildNr=1 [Unit93] -FileName=..\..\..\doc\readme.txt +FileName=..\..\..\doc\changelog.txt Folder=doc Compile=0 Link=0 @@ -967,13 +957,14 @@ OverrideBuildCmd=0 BuildCmd= [Unit94] -FileName=..\..\..\doc\changelog.txt -Folder=doc -Compile=0 -Link=0 +FileName=..\..\lib\object\object.c +Folder=src/lib/object +Compile=1 +Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= +CompileCpp=0 [Unit95] FileName=..\..\lib\object\object.c @@ -995,3 +986,13 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= +[Unit83] +FileName=..\..\lib\object\palette\pop2_256c.c +CompileCpp=0 +Folder=src/lib/object/palette +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +