Chicken Invaders Universe: TGA files

Textures, recreate headers, conversions, algorithms and parsing of image files
Francis
Posts: 5
Joined: Wed Jul 01, 2020 9:00 am

Chicken Invaders Universe: TGA files

Post by Francis »

In this topic, a script to make the .tga files in Chicken Invaders Universe readable in editing software was created, and it's really useful, but would it be possible to have a script that does the exact opposite? (That makes the readable .tga files unreadable so that new tga files can be added to the game)

How it should work=

This is an example header of one of the game's TGA files after it's made readable=

Code: Select all

00 00 02 00 00 00 00 00 00 00 00 00 00 01 00 01 20 00


And this is the result after making it unreadable and fitting into the game.

Code: Select all

00 01 00 00 00 01 00 00 20 00 00 00


To convert it making it unreadable, you need to remove the first 12 bytes of the header

Code: Select all

'00 00 02 00 00 00 00 00 00 00 00 00' 00 01 00 01 20 00


That will leave you with 6 bytes=

Code: Select all

00 01 00 01 20 00


Now, you need to add after the second byte, the fourth byte, and the sixth byte (in this case) the 00 byte=

Code: Select all

00 01 '00 00' 00 01 '00 00' 20 00 '00 00'


To get a tga file to try the script on, click here.

Basically, the script I need should do the exact opposite of the one created on this topic. so, if you're struggling in making this, just check that script and make its opposite.

I'd like to leave a side note and thank @EmeraldPlay for designing the .tga script and @Acewell for actually making it.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Chicken Invaders Universe: TGA files

Post by aluigi »

Code: Select all

# Chicken Invaders Universe TGA encoder

getdstring DUMMY 12
get WIDTH short
get HEIGHT short
get TYPE byte
get DUMMY byte
savepos OFFSET
get SIZE asize
math SIZE - OFFSET
get NAME basename
string NAME + "_new.tga"

log MEMORY_FILE 0 0
put WIDTH long MEMORY_FILE
put HEIGHT long MEMORY_FILE
put TYPE long MEMORY_FILE
log NAME 0 12 MEMORY_FILE
append
log NAME OFFSET SIZE
append
Francis
Posts: 5
Joined: Wed Jul 01, 2020 9:00 am

Re: Chicken Invaders Universe: TGA files

Post by Francis »

Thank you.
mohammad as
Posts: 5
Joined: Thu Aug 06, 2020 6:11 am

Re: Chicken Invaders Universe: TGA files

Post by mohammad as »

How do I use that codes?