Thread Tools
Old May 1, 2002, 10:20   #1
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 20:54
Local Date: October 31, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Anyone who knows C++
I am trying to add some modifications in the UI.
I want to decrease the population per pop number from 10,000 to 1,000.
So i heard Locutus saying that the UI is based on C++. Then i looked for the integer to this number in the UI and I found out it is PopulationValue.
So in C++ I want to write something like
Code:
PopulationValue = PopulationValue/10
It is possible to write such C++ code that would work in the UI files?
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old May 1, 2002, 10:22   #2
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 01:54
Local Date: November 1, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
Add a ';' to that and it's good C code alright. But where did you want to insert it so that it works? AFAIK you need the source code for that...
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery
Locutus is offline  
Old May 1, 2002, 12:30   #3
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 20:54
Local Date: October 31, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Actually this was going to be the question after i had the code. Still I was think in insert inside the file i want to change.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old May 1, 2002, 12:46   #4
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
Anyone who knows C++...

want to write a program to decode sprites?
__________________
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
Immortal Wombat is offline  
Old May 1, 2002, 18:24   #5
Harovan
staff
PtWDG Gathering StormPtWDG2 Monty PythonC4DG Gathering Storm
Civ4: Colonization Content Editor
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2001
Posts: 11,117
Re: Anyone who knows C++
Quote:
Originally posted by Pedrunn
PopulationValue = PopulationValue/10
I'm making my living with C++. As Locutus said, if you add a ; it will be correct. A shorter form would be:

Code:
PopulationValue /= 10;
Harovan is offline  
Old May 1, 2002, 18:25   #6
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 01:54
Local Date: November 1, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
Sir Ralph, don't confuse these poor old kids any more than they already are
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery
Locutus is offline  
Old May 1, 2002, 19:20   #7
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 23:54
Local Date: October 31, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
Maybe that's why the SLIC documentation is so cryptic: it was written by programmers.
Peter Triggs is offline  
Old May 1, 2002, 19:28   #8
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 01:54
Local Date: November 1, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
I could have told you that years ago (in fact, I think I did)...
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery
Locutus is offline  
Old May 2, 2002, 05:27   #9
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 23:54
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
just don’t go to activsion for the source code you’ll get some bloke on the end of an email going I think you may have to look at one of the patches for that and he gets pretty upset with you on the next e-mail after you tell him Satan him self is more help full when you want to sell your soul.
__________________
"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
The Big Mc is offline  
Old May 2, 2002, 08:30   #10
Harovan
staff
PtWDG Gathering StormPtWDG2 Monty PythonC4DG Gathering Storm
Civ4: Colonization Content Editor
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2001
Posts: 11,117
Now if you add commas and periods, that would be wonderful and it could be possible to figure, what your point is...
Harovan is offline  
Old May 2, 2002, 08:40   #11
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 23:54
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
it is in the style of the bloke from activsion
__________________
"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
The Big Mc is offline  
Old May 2, 2002, 09:39   #12
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
Sir Ralph, would you consider attempting to decode the sprite files for the greater good?
__________________
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
Immortal Wombat is offline  
Old May 2, 2002, 09:49   #13
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 23:54
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
wombat i am looking into that for you if you want to help mail me
__________________
"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
The Big Mc is offline  
Old May 2, 2002, 11:48   #14
Harovan
staff
PtWDG Gathering StormPtWDG2 Monty PythonC4DG Gathering Storm
Civ4: Colonization Content Editor
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2001
Posts: 11,117
Quote:
Originally posted by Immortal Wombat
Sir Ralph, would you consider attempting to decode the sprite files for the greater good?
If it fits in my abilities and (more important) time frame, why not. Although I still don't understand what you want .
Harovan is offline  
Old May 2, 2002, 11:51   #15
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 23:54
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
he wants a sprite decompiler
__________________
"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
The Big Mc is offline  
Old May 2, 2002, 12:22   #16
Martin Gühmann
staff
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Super Moderator
 
Martin Gühmann's Avatar
 
Local Time: 01:54
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
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!"
Martin Gühmann is offline  
Old May 2, 2002, 23:44   #17
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 20:54
Local Date: October 31, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
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
Pedrunn is offline  
Old May 3, 2002, 03:54   #18
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 23:54
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
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
The Big Mc is offline  
Old May 3, 2002, 05:32   #19
Harovan
staff
PtWDG Gathering StormPtWDG2 Monty PythonC4DG Gathering Storm
Civ4: Colonization Content Editor
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2001
Posts: 11,117
Quote:
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.
Harovan is offline  
Old May 3, 2002, 06:32   #20
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
http://www.apolyton.net/cgi-bin/ctp2...iew.cgi?ID=566

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
Immortal Wombat is offline  
Old May 3, 2002, 08:27   #21
Harovan
staff
PtWDG Gathering StormPtWDG2 Monty PythonC4DG Gathering Storm
Civ4: Colonization Content Editor
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2001
Posts: 11,117
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?

Last edited by Harovan; May 3, 2002 at 10:23.
Harovan is offline  
Old May 3, 2002, 10:46   #22
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
Quote:
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
Immortal Wombat is offline  
Old May 3, 2002, 10:49   #23
Martin Gühmann
staff
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Super Moderator
 
Martin Gühmann's Avatar
 
Local Time: 01:54
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
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!"
Martin Gühmann is offline  
Old May 3, 2002, 11:46   #24
Harovan
staff
PtWDG Gathering StormPtWDG2 Monty PythonC4DG Gathering Storm
Civ4: Colonization Content Editor
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2001
Posts: 11,117
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.
Harovan is offline  
Old May 3, 2002, 12:06   #25
child of Thor
Call to Power II Democracy GameCTP2 Source Code Project
Emperor
 
child of Thor's Avatar
 
Local Time: 23:54
Local Date: October 31, 2010
Join Date: Jan 2002
Location: UK
Posts: 3,272
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.
child of Thor is offline  
Old May 3, 2002, 13:48   #26
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
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

Quote:
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
Immortal Wombat is offline  
Old May 3, 2002, 14:14   #27
Harovan
staff
PtWDG Gathering StormPtWDG2 Monty PythonC4DG Gathering Storm
Civ4: Colonization Content Editor
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2001
Posts: 11,117
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.

Last edited by Harovan; May 3, 2002 at 17:46.
Harovan is offline  
Old May 7, 2002, 03:50   #28
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 23:54
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
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
The Big Mc is offline  
Old May 7, 2002, 08:13   #29
Harovan
staff
PtWDG Gathering StormPtWDG2 Monty PythonC4DG Gathering Storm
Civ4: Colonization Content Editor
 
Local Time: 00:54
Local Date: November 1, 2010
Join Date: Dec 2001
Posts: 11,117
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.
Harovan is offline  
Old May 7, 2002, 08:26   #30
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 23:54
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
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
The Big Mc is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 19:54.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team