Announcement

Collapse
No announcement yet.

Anyone who knows C++

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    For some help in the readme for the sprite maker the last cheapter is made for programer who whish to write a program that can interpret, draw, or export sprites. This chapter also contains some fractments of C++ code, I guess it is code ripped of the sprite maker source code, to help programers to creater a sprite viewer/editor.

    -Martin
    Civ2 military advisor: "No complaints, Sir!"

    Comment


    • #17
      Originally posted by Locutus
      Sir Ralph, don't confuse these poor old kids any more than they already are
      Dont worry it happened exacly what i thougt it would... It did not work .
      It worthed the try anyway.
      "Kill a man and you are a murder.
      Kill thousands and you are a conquer.
      Kill all and you are a God!"
      -Jean Rostand

      Comment


      • #18
        Yes martin I have been looking at that for some time ( a few days) and one thing strikes me the product of the program would be forced to have the shadow merged with the unit pic, on the other hand I am very close to being able to write some pseudo code to de compile it ones I get a c++ de compile to see the rest of this program.
        "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
        The BIG MC making ctp2 a much unsafer place.
        Visit the big mc’s website

        Comment


        • #19
          Originally posted by Martin Gühmann
          For some help in the readme for the sprite maker the last cheapter is made for programer who whish to write a program that can interpret, draw, or export sprites. This chapter also contains some fractments of C++ code, I guess it is code ripped of the sprite maker source code, to help programers to creater a sprite viewer/editor.
          Where can I find this program/description? Do you have a link for me? Sorry if this question is dumb, but consider that I didn't take a single look for all this modding stuff yet.

          Comment


          • #20


            I thought the code was pasted into a thread somewhere, but I can't find it
            Concrete, Abstract, or Squoingy?
            "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

            Comment


            • #21
              Thanks IW. That's indeed valid C code, obviously for Microsoft Visual C++. It doesn't compile yet, because it has six undefined symbols (in fact it has much more, but the rest I could easily figure):

              Pixel32 - a data type (may be unsigned integer 32 bit?)
              Pixel16 - a data type (may be unsigned integer 16 bit?)
              g_is565Format - a boolean variable (true or false)
              spriteutils_AveragePixel32() - a function
              RGB32Info() - a function
              RGB32Components() - a function

              I will look into it, when I get the time, but it may last a while.

              Edit: spriteutils_AveragePixel32() can also easily been figured, given it appears in a function named spriteutils_CreateQuarterSize(). Pixel32 is definitely a 32 bit integer, and Pixel16 a 16 bit integer. The rest remains a mystery so far... now back to the coding for what I'm paid.

              Edit2: RGB32Components() was also not so hard to guess. Now, what shall the program do? Reverse the sprite building (make a bunch of pictures out of a sprite)? Or what?

              Comment


              • #22
                Now, what shall the program do? Reverse the sprite building (make a bunch of pictures out of a sprite)? Or what?
                Ideally, it should do something like TileEdit does. Decompile a sprite into its component pictures, and a script file, build so that it is possible for the user to export pictures from, import pictures to, and alter pictures in the sprite file and resave.
                Concrete, Abstract, or Squoingy?
                "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                Comment


                • #23
                  Of course a sprite editor/builder would be much more comfortable, but it is enough to have a sprite viewer with the ability to save every frame in the sprite as single picture. Or at least to say it in your words: A program that makes a bunch of pictures out of a sprite. Maybe the script rebuilding of the sprite would be also usefull, but not necessary if you just want to have the graphics.
                  Civ2 military advisor: "No complaints, Sir!"

                  Comment


                  • #24
                    There's no such a thing like a script encoder in the published C code, so I probably won't be able to extract it. It's all about graphics only. Also, the quality of the extracted pictures will be worse than their originals were, because as far as I can see their quality (color width) is vastly reduced during the sprite building. So it surely won't be beneficial if you extract/reinsert them several times.

                    I will try the decoding in "a bunch of pictures" first, as step one. I'm not much of a Windows programmer, may be somebody writes a GUI and an editor in Visual Basic, or if not, I might do it later. Step by step.

                    Comment


                    • #25
                      Sir Ralph,
                      You know this the slippery slope right?
                      Good luck and if you can make this thing work then the CTP2 community will owe you big time, and the Civ3 one by the sounds of it too
                      'The very basis of the liberal idea – the belief of individual freedom is what causes the chaos' - William Kristol, son of the founder of neo-conservitivism, talking about neo-con ideology and its agenda for you.info here. prove me wrong.

                      Bush's Republican=Neo-con for all intent and purpose. be afraid.

                      Comment


                      • #26
                        Yeah, sorry, I was a little overambitious perhaps If you can just get some *.tif files out of the sprite, its as much as I dared hope for really. We will owe you big time. No more b!tching about Civ3

                        Also, the quality of the extracted pictures will be worse than their originals were, because as far as I can see their quality (color width) is vastly reduced during the sprite building
                        Yet they look ok in the game... Does the game uncompress the colours again?
                        Concrete, Abstract, or Squoingy?
                        "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                        Comment


                        • #27
                          We'll see. Still the function RGB32Info() is missing. And the code shows only the translation of one picture (and not even complete), but the *.spr file has also headers and probably a block structure, which are not yet described. And about the script I also didn't care yet. Well, you already have a compiler (this MakeSpr.exe), so if I succeed to decompile the sprite, you could edit the files in a traditional graphics program like PSP meanwhile, may be later I or somebody else can unify all 3 parts (decompiling, editing, recompiling) in one program.

                          As to the reduced quality: It's no criticism and the sprites look ok, but take the "cow" example: the size of all source pictures added is 8.3 MB, the resulting sprite has 240 KB, and there is no compression (like Huffman or so) in the algorithm. Also, one pixel of the source files is 32 Bit (red, green, yellow and alpha each 8 bit), a pixel of the sprite seems to have only 16 bit and I don't know yet how R/G/B/A are distributed, may be there's even a 256 color cap.

                          Edit: After I had a look in it's inner part, i'm sure now, the SPR file is not strong compressed. Ways too much FF's in it, that can't be the typical compression "randomness". Hence, the size reduction is achieved only with quality reduction. At the start of the file is a 512 bytes array that looks like a color table, but has only 128 elements.

                          About the file format: Seems it must be a TIF file. I already downloaded a format specification (heck, they are even four different, not much of a standard) and at the first view it's quite complicated. I hope I can get along with it. If not, I can save at least BMP files, but the conversion will have to be done manually.

                          Comment


                          • #28
                            You lot are going to love me then I just started a vb project to do just that once we get the basic c++ de compiler I am working on a project which will let you adjust the colours and then save the file back as a sprite

                            Sir Ralph I have also been looking at the de compiler for sprites and there seams to be loads of stuff missing . from the sounds of it you know a lot more about c++ then me or any of my friends.
                            "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
                            The BIG MC making ctp2 a much unsafer place.
                            Visit the big mc’s website

                            Comment


                            • #29
                              Thank you, guess there must be something my company pays me for .

                              The RGB32Info() function is crucial for the compiler and is still missing. I try to complete the compiler (with a dummy RGB32Info) and comparing the output and the *.spr structure I try to guess what this function does. It's not a one-weekend-shot anyway. Once I completed a working compiler, I can reverse the process, thus making a decompiler. If I succeed with it, I put it in a DLL and you can use it with VB at will.

                              Comment


                              • #30
                                if I get the vb to open the tiff I am having some big problems with that
                                "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
                                The BIG MC making ctp2 a much unsafer place.
                                Visit the big mc’s website

                                Comment

                                Working...
                                X