snv
Member LVL 1
Posts: 10
|
Post by snv on Aug 15, 2011 17:54:52 GMT -6
To whom it may concern, here is the structure of IMP files and decoding algorithm (variation of ILBM RLE). Have a nice day. --- SNV
IMP_File { u2 Type; // 8=uncompressed, 9=RLE u2 Unknown1; u2 Width; // virtual Width u2 Height; // virtual Height u4 PaletteOffset;
u4 Unknown2; // checksum or id? u4 Unknown3; u4 Unknown4; u2 Unknown5;
u2 NumSequences; u4 SequencesOffset;
//Sequence Sequences[NumSequences]; // Sequence represents specific animation (like movement or spellcasting), // together with facings
//Facing Facings[]; // directions, sprite can face (some are mirrored) //Facing Frames[]; // frame headers
//u1 Palette[256*4]; // RGBA palette: // index 0 used for transparency, // index 1 is shadow // index 0xff is RLE special value
//Data[] // all frames compressed or uncompressed data
// hotspot (selection) at the end of the file //u1 HotSpot[]; }
Sequence { u4 Unknown1; u4 Unknown2; u1 Unknown3; u2 Unknown4; u1 Size; // length of sequence u4 Offset; // offset of facing groups (directions) }
// Facings go clockwise Facing { u2 Unknown1; u2 Size; u4 Offset; }
Frame { u1 Type; // 0=normal, 8=duplicate-back-reference u1 Unknown1; // delay? u2 Width; u2 Height; u2 Size; // compressed size, or uncompressed, if Type=8 or IMP_File->Type==9 // should be aligned to 4-bytes
u4 Unknown2; // checksum? u4 Offset; // offset or number of duplicating frame // Note: duplicates used for animation delay. Don't simply strip them. }
for (L = 0; L < H->Width*H->Height; ) { int C = (char)*I++; if (C<0) { C = -C; while(C--) O[L++] = *I++; } else { C = C + 3; while(C--) O[L++] = *I; P++; } }
|
|
|
Post by Boaster on Aug 15, 2011 18:07:21 GMT -6
Hmmm, not sure what to make of it. I'm familiar with GameScript, but not IMP coding.
Can anyone make anything out of this? I understand it a little but, I'm curious as to how you came across this information.
|
|
snv
Member LVL 1
Posts: 10
|
Post by snv on Aug 15, 2011 20:36:56 GMT -6
I'm curious as to how you came across this information. IMPs are the sprites from imp.mpq and special.mpq. They represent creatures, map objects and user interface.
|
|
|
Post by Boaster on Aug 15, 2011 22:19:19 GMT -6
I know that the IMP files are the sprites in the game.
Do you know how to extract the images and re-compile them???
If so, this could be one of the two final break throughs in modding LOMSE.
And actually, the Special MPQ doesn't contain any IMP files within it.
|
|
snv
Member LVL 1
Posts: 10
|
Post by snv on Aug 16, 2011 20:55:05 GMT -6
Do you know how to extract the images and re-compile them??? See 1st post. I know that the IMP files are the sprites in the game. Cool. Do you have interpreter for GS files? It's the first time I see Forth-like language used for game scripting. Very unique. If so, this could be one of the two final break throughs in modding LOMSE. What is the second one? And actually, the Special MPQ doesn't contain any IMP files within it. Dunno. Just unpacked them all.
|
|
|
Post by Boaster on Aug 16, 2011 22:37:49 GMT -6
The last would be decompiling the EXE, editing it (add new variables or change things) and being able to recompile. This is the final frontier as far as I'm concerned.
GS files are openable with notepad.
So you can recompile images back into IMP files??!? Hmmm, if so a big window of opportunity just opened up!
|
|
snv
Member LVL 1
Posts: 10
|
Post by snv on Aug 18, 2011 12:35:42 GMT -6
The last would be decompiling the EXE, editing it (add new variables or change things) and being able to recompile. This is the final frontier as far as I'm concerned. It would be easier to reimplement the game engine from scratch, as the game logic is already open source. Engine does mostly house-keeping and sprite drawing work. GS files are openable with notepad. I thought they reused already available language. Maybe a part of university project of one of the programmers. So you can recompile images back into IMP files??!? Yes. Hmmm, if so a big window of opportunity just opened up! Have you seen these *.h files in imps.mpq? They mean, that all sprites are hardcoded to the game engine. I'm not sure, if you can add new sprites, without hacking lomse.exe.
|
|
|
Post by Boaster on Aug 18, 2011 12:39:31 GMT -6
I think it's quite possible to add new sprites, or even modified sprites.
For example: Water Warlord's roster sprite and model looks exactly the same a the Water Warrior. No yellow coloring that would be expected as part of the unit.
As far as hard coding goes, there have been quite a bit of things in the past that I thought were hard coded that I eventually found a work around or a way of redesigning how some things functioned (portraits, roster sprites, and special building effects come to mind).
|
|
snv
Member LVL 1
Posts: 10
|
Post by snv on Aug 20, 2011 8:31:32 GMT -6
I think it's quite possible to add new sprites, or even modified sprites. Okay. I have a little CLI utility that does everything, but no way to compile it for your platform. Still can upload C source code. Here is what it does... Usage: lomut <Input.imp> <OutputDirectory> ; extract all frames lomut <InputDirectory> <Output.imp> ; compile IMP from frames lomut <Input.lbm> <Output.pcx> ; convert LBM to PCX lomut <Input.pcx> <Output.lbm> ; create LBM lomut <Input.mpq> <OutputDirectory> ; extract all files lomut <InputDirectory> <Output.mpq> ; create MPQ Note1: IMP frames are expected to be 512x512 8-bit images Note2: Only PBMs LBM are supported Note3: use unix-style path separators '/', not '\' Example: for i in data/portrait/*.lbm; do ./lomut $i out/$i.pcx; done
|
|
|
Post by Boaster on Aug 20, 2011 9:12:45 GMT -6
Hmmm. Would that be able to be made as an EXE?
|
|
snv
Member LVL 1
Posts: 10
|
Post by snv on Aug 20, 2011 23:39:39 GMT -6
Hmmm. Would that be able to be made as an EXE? I have no C/C++ compiler for Windows nor Windows itself.
|
|
orzie
Official
Posts: 365
|
Post by orzie on Nov 27, 2013 0:40:59 GMT -6
|
|
|
Post by Boaster on Nov 27, 2013 4:36:20 GMT -6
Explain this exe you've found. Does this do what SNV's stuff does?
|
|
orzie
Official
Posts: 365
|
Post by orzie on Nov 27, 2013 4:44:46 GMT -6
This file converter utility is intended to be launched from Command String. (compiled to Windows by Russian coders).
It will show you a full list of functions and supported formats of game data (there are many, including Diablo 1-2 data, for example).
This utility is made by Russian coders who used the source code provided once by snv. Not all the available formats are listed.
Sprite and Archive Utility v1.0 by SNV
Usage: sau <InputFormat>=<InputFile> <OutputFormat>=<OutputFile> sau <InputFile> <OutputFile> (guess format from extension) Example: sau dir=./Input mpq=Output.mpq sau ./Input Output.mpq
Formats Supported: adf: Amiga Disk File agg: Heroes of Might & Magic 1-2 bdx: Chronicles of Inotia: Legend of Feanor Graphics bmc: Black Moon Chronicles, Persian Wars (use on *.SPR files) bmp: BMP images (Microsoft Windows) bor: Beats of Rage archives (use on *.pak files) box: Beasts & Bumpkins archives brig: Brigandine btb: Beyond the Beyond (use on CHR/DAT/BIN files) bytes: treat input/output as a plain stream of bytes c2e: Chronicles of Inotia 2: Wanderer of Luone Sprites cam: Cyberlore Library Manager (Majesty, Playboy, etc..) cc: Kings Bounty and Might & Magic 3/4/5 archives cel: Diablo sprites cl2: Diablo sprites cmp: Divine Divinity Archive darkseal: Dark Seal 2: Wizard Fire (use on folder mas00-09 files) dat: Tibia.dat from Tibia MMORPG dc6: Diablo 2 sprites dcc: Diablo 2 sprites dds: Direct Draw Surface (many games) def: Heroes of Might & Magic 3 sprites df2: Heroes of Might & Magic 4 sprite archives dir: Specifies directory as input/output divinity: Divine Divinity sprite archive (use on CPackedi.*c files) dom: Dominus (use on *.rm, *anm, *.4pp, *.dat, files) dsa: Realms of Arkania 2 (use on *.DAT files) epf: East Point File System flx: Ultima 7, 8 and Crusader No Remorse archives fox: Furcadia Sprite frames: Specifies directory of PCX images as a sprite gif: Saves/Loads GIF files as sprites gor: Myth Fallen Lords Archives and Tagged Files group: Stonekeep groupXX archives grp: Starcraft sprites h: Convert <bytes> to a C/C++ header h4r: Heroes of Might & Magic 4 archives heimdall: Heimdall (use on *.bin and *.dat files) hrs: Faery Tale Adventure 2 and Dinotopia archives idx: Jinyong Qunxia Zhuan archives ilb: Age of Wonders 1-2 image archives imp: Lords of Magic sprites key: Infinity Engine Directory (Baldur's Gate, Icewind Dale) lbm: LBM/PBM images (Deluxe Paint) lbx: Master of Magic archives lg: Lunar: Genesis / Dragon Song (use on *.dat files) lib: Cyberlore Library (Al-Qadim, Entomorph) lod: LOD archives (Might & Magic 6-8, Heroes of Might & Magic 3) maj: Majesty for IPhone/IPad (use on *.group.bin files) mon: Stonekeep sprites (MON, MSP, POJ, WPN, GXX) mpq: Blizzard MPQ archives (Warcraft 2, Diablo, Starcraft, Lords of Magic) mqdb: Disciples: Sacred Lands (use on DBI, FF and WDB) mul: Ultima Online Archive nds: Nintendo Nitro Filesystem and Formats (use on NDS roms) obm: Myth of Soma images p10: Popolocrois Archive (use on p00/p10/p99 files) pak: Helbreath sprite archives pal: Loads/saves raw palettes pck: X-Com 1/2/3 sprites pcx: PCX images (ZSoft Paintbrush) png: PNG images pvr: PowerVR textures (many iOS games) pzx: Zenonia sprite raw: Saves image as a raw array of pixels remap: Remaps target image to palette of source. Both must be in PCX res: Rage of Mages 1-2 (Allods) archives rgmystus: Mystic Towers (rgmystus.dat) rnc: RNC/EPF/CRU files (also handle Darkmere sprites) scan: Scans any file for known format patterns snd: SND archives (Might & Magic 6-8, Heroes of Might & Magic 3) spl: Myth of Soma sprites spr: Magic & Mayhem sprites tga: TGA images (Truevision Graphic Array) tgw: Kohan: Immortal Sovereigns archives tim: Playstation Sprite tlb: SSI Tileset (Al-Qadim, Entomorph, Unlimited Adventures, Gold Box games) tm2: PSP Sprite uop: Ultima Online Mythic Package vh: Vandal Hearts (use on DAT files) vid: VID archives (Might & Magic 6-8, Heroes of Might & Magic 3) vsr: Lemmings Paintball war: Warcraft 1 and 2 archives whizz: Whizz tiles and sprites (use on DOSBox memory dumps) xua: Original Mulan archives (use on XUA/XUB/JUN/MAA/JUS/FAN files)
|
|
orzie
Official
Posts: 365
|
Post by orzie on Nov 27, 2013 4:47:52 GMT -6
According to the forum posts, this utility should be capable of packing new IMP and MPQ files (the topic author knows about Mantera's Mod and says that this function was requested by you from SNV).
|
|
|
Post by Boaster on Nov 27, 2013 4:53:00 GMT -6
According to the forum posts, this utility should be capable of packing new IMP and MPQ files (the topic author knows about Mantera's Mod and says that this function was requested by you from SNV). Well, I do know that SNV's utility could recompile the sprites, but there were the issues that I ran into... 1. sprites wouldn't mirror 2. selection area of new sprites included the transparent section. So... they know of the mod and they know I wanted to be able to recompile sprites for new units (albeit colorized versions of existing sprites)… and did they accomplish this to 100% accuracy??
|
|
orzie
Official
Posts: 365
|
Post by orzie on Nov 27, 2013 4:56:56 GMT -6
Never tried. Perhaps today's evening. I found it only today while I was at work. The posts are dating back to February, 2013.
I suggest you to try also with your Fire dwarf, because I have no experience with modding IMP.MPQ.
All I can say is that we don't yet know what kind of the files are those with *h extension.
Too bad we are not professional coders... I am starting to regret choosing Chemistry instead of C++ back in my youth.
|
|
|
Post by Boaster on Nov 27, 2013 4:58:44 GMT -6
Never tried. Perhaps today's evening. I found it only today while I was at work. The posts are dating back to February, 2013. I suggest you to try also with your Fire dwarf, because I have no experience with modding IMP.MPQ. All I can say is that we don't yet know what kind of the files are those with *h extension. The *h files are basically the instructions that tell the game how to handle the IMP file. You can view them with notepad to see the inside details. I will try to compile the Fire Dwarf today (after work and sleep) and see what happens.
|
|
orzie
Official
Posts: 365
|
Post by orzie on Nov 27, 2013 4:59:56 GMT -6
The *h files are basically the instructions that tell the game how to handle the IMP file. You can view them with notepad to see the inside details. I will try to compile the Fire Dwarf today (after work and sleep) and see what happens. Can't wait to check the results. Though, I suspect that the *h file is kinda responsible for that transparent selection area.
|
|
|
Post by Boaster on Nov 27, 2013 5:04:26 GMT -6
The *h files are basically the instructions that tell the game how to handle the IMP file. You can view them with notepad to see the inside details. I will try to compile the Fire Dwarf today (after work and sleep) and see what happens. Can't wait to check the results. Though, I suspect that the *h file is kinda responsible for that transparent selection area. That may be possible... however, I use the same H file from the Dwarven Warlord as the Fire Dwarf... so idk what changes. Also, the Level 3 Fire Mage Tower has an unusually large area of selection and this has always been this way.
|
|