rofl0r / agsutils

contains utils for AGS: game extractor, repacker, disassembler and assembler
44 stars 14 forks source link

[Feature request]Palette issue with agsprite #28

Closed abohl69 closed 2 years ago

abohl69 commented 2 years ago

Hello, I have found that agsprite when extracting files from 'acsprset.spr' changes the palette of the sprites or even creates a new palette. My purpose was to mix the original sprites of a game with sprites from a language pack. It worked pretty well but in the result the new sprites have palette issues in the game. The game was working but the colors were wrong. To solved this issue I modified you program in order not to modify/create the palette of the sprites. And now, the game colors are ok. My suggestion is the following : is it possible to create an option when launching agsprite to preserve le original state of the palette of the sprites ? This is the case for bpp==1 and others. The repacking does not change. It is a suggestion for future use of packing/re-packing... personaly my problem is solved. Thanks for maintaining these tools.

rofl0r commented 2 years ago

the colors were wrong. To solved this issue I modified you program in order not to modify/create the palette of the sprites.

i have no idea how the palette was changed. would you mind showing your change to fix it ?

git diff can tell, if you're using a git clone

abohl69 commented 2 years ago

I have done lots of modifications in order to compile and run it in debug mode step by step with break points. I am using Pelles C 10 and its IDE. I have seen version 8 of Pelles C was able to compile you project so I tried Pelles C 10. For instance I cut the targa.c file in targa.h and targa.c (it is better for running step by step). But in fine the modifications implied by the palette are all marked by the macro OLD_CODE in the source.

ifdef OLD_CODE

//your code

endif

so I was able to compile your version and mine. The other modifications were necessary for compiling. agsprite.zip

abohl69 commented 2 years ago

I am not sure that my modifications work with all sprite... I think that works particularly with the spr file I was modifying. I think that my modification is not "universal" that is works with all kind of spr files.

abohl69 commented 2 years ago

Here are two screen captures :
Capture d’écran 2022-07-04 174524 Capture d’écran 2022-07-04 174816

rofl0r commented 2 years ago

did you modify/replace the orange sprite that's displayed wrongly in the second screenshot ? if so, can you show the original tga agsprite extracted vs the one it extracted/inserted after your changes ? i'm trying to figure out what exactly went wrong here.

abohl69 commented 2 years ago

I have not edited any tga file before repacking it into the acsprset.spr. What I did is simple : I have two acsprset.spr files : one which is the new English version and the other which is an old French version. This French version has been created by a French game translator. What I have understood is that the translator has only changed the tga files containing text (for translation). They have done a very great and complex job. The issue is that the game evolved (principally the option menu changed) and the old French version makes the game crashing. What I have done is to mix both acsprset.spr files. And it works... acsprset.7z.zip there are three new tga files in the English version... I have added them to the new spr file. The propellor orange sprite is the same in both acsprset files. I send you the old French spr file.

rofl0r commented 2 years ago

i think all your hacks to get the project to compile with pelles C are unnecessary if you toggle the right flags in project settings that result in these flags getting added to the compiler command: "/Zd", "/Ze", "/Go" - these turn pellesc in to posix compatibility mode. unfortunately i forgot how the according checkboxes are labeled in the IDE.

apart from that, if you take a clean copy of agsutils, and just add as first line in Targa.h after

 static int ImageData_create_palette_pic(const ImageData* d, unsigned *palette, unsigned char **data)
 {

return -1;

as diff:

@@ -282,6 +282,7 @@ static int lookup_palette(unsigned color, unsigned *palette, int ncols)

 static int ImageData_create_palette_pic(const ImageData* d, unsigned *palette, unsigned char **data)
 {
+   return -1;
    int ret = 0;
    unsigned char *p = d->data, *q = p + d->data_size;
    *data = malloc(d->width * d->height);

does this fix the issue for you ? if so this must be related to the alpha channels used in the picture (174 here for the orange rotor in your screenshot).

rofl0r commented 2 years ago

@abohl69 would you mind confirming whether the issue is fixed for you in master ?

abohl69 commented 2 years ago

Hello !

yes ! it's fixed ! I have seen you have closed the case on github. So I haven't answered you...

Thank you

abohl


De : rofl0r @.> Envoyé : samedi 9 juillet 2022 21:39 À : rofl0r/agsutils @.> Cc : abohl69 @.>; Mention @.> Objet : Re: [rofl0r/agsutils] [Feature request]Palette issue with agsprite (Issue #28)

@abohl69https://github.com/abohl69 would you mind confirming whether the issue is fixed for you in master ?

— Reply to this email directly, view it on GitHubhttps://github.com/rofl0r/agsutils/issues/28#issuecomment-1179610413, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZP2EKLUSCRFETBT4RDJG2DVTHWP3ANCNFSM52RP233A. You are receiving this because you were mentioned.Message ID: @.***>