Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Archive > CtP2-Creation/AI/Mods/Scenarios-Archive > Anyone who knows C++
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread   
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
Pedrunn is offline Pedrunn
King
of Natal, Brazil
Jul 2001
time: 02:13
  Old Post 01-05-2002 19:20
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Anyone who knows C++ Put an end to popups!

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?

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
  Old Post 01-05-2002 19:22 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

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...

Pedrunn is offline Pedrunn
King
of Natal, Brazil
Jul 2001
time: 02:13
  Old Post 01-05-2002 21:30
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Enter the AD-FREE zone

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.

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:13
  Old Post 01-05-2002 21:46 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton

Anyone who knows C++...

want to write a program to decode sprites?

Sir Ralph is offline Sir Ralph
Emperor
Long live teh Schwampel!
Dec 2001
time: 06:13
  Old Post 02-05-2002 03:24
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Re: Anyone who knows C++ Enter the AD-FREE zone

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;

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
  Old Post 02-05-2002 03:25 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Inflate your Upload Space

Sir Ralph, don't confuse these poor old kids any more than they already are

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:13
  Old Post 02-05-2002 04:20
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Tired of ads?

Maybe that's why the SLIC documentation is so cryptic: it was written by programmers.

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:13
  Old Post 02-05-2002 04:28 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Get a bigger avatar today!

I could have told you that years ago (in fact, I think I did)...

The Big Mc is offline The Big Mc
King
Of the universe / England
Oct 2001
time: 05:13
  Old Post 02-05-2002 14:27 Visit The Big Mc's homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton or Terrorists Win

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.

Sir Ralph is offline Sir Ralph
Emperor
Long live teh Schwampel!
Dec 2001
time: 06:13
  Old Post 02-05-2002 17:30
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Put an end to popups!

Now if you add commas and periods, that would be wonderful and it could be possible to figure, what your point is...

The Big Mc is offline The Big Mc
King
Of the universe / England
Oct 2001
time: 05:13
  Old Post 02-05-2002 17:40 Visit The Big Mc's homepage!
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Inflate your Upload Space

it is in the style of the bloke from activsion

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:13
  Old Post 02-05-2002 18:39 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Full PM-box? Change here!

Sir Ralph, would you consider attempting to decode the sprite files for the greater good?

The Big Mc is offline The Big Mc
King
Of the universe / England
Oct 2001
time: 05:13
  Old Post 02-05-2002 18:49 Visit The Big Mc's homepage!
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Get a bigger avatar today!

wombat i am looking into that for you if you want to help mail me

Sir Ralph is offline Sir Ralph
Emperor
Long live teh Schwampel!
Dec 2001
time: 06:13
  Old Post 02-05-2002 20:48
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Support Apolyton buy from Amazon

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 .

The Big Mc is offline The Big Mc
King
Of the universe / England
Oct 2001
time: 05:13
  Old Post 02-05-2002 20:51 Visit The Big Mc's homepage!
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Increase Your PM Length

he wants a sprite decompiler

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:13
  Old Post 02-05-2002 21:22 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

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

Pedrunn is offline Pedrunn
King
of Natal, Brazil
Jul 2001
time: 02:13
  Old Post 03-05-2002 08:44
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

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.

The Big Mc is offline The Big Mc
King
Of the universe / England
Oct 2001
time: 05:13
  Old Post 03-05-2002 12:54 Visit The Big Mc's homepage!
Edit/Delete Message Reply w/Quote
#18 Report this post to a moderator
Support Apolyton

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.

Sir Ralph is offline Sir Ralph
Emperor
Long live teh Schwampel!
Dec 2001
time: 06:13
  Old Post 03-05-2002 14:32
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

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.

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:13
  Old Post 03-05-2002 15:32 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

http://www.apolyton.net/cgi-bin/ctp...view.cgi?ID=566

I thought the code was pasted into a thread somewhere, but I can't find it

Sir Ralph is offline Sir Ralph
Emperor
Long live teh Schwampel!
Dec 2001
time: 06:13
  Old Post 03-05-2002 17:27
Edit/Delete Message Reply w/Quote
#21 Report this post to a moderator
Suffering from ads?

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 Sir Ralph on 03-05-2002 at 19:23

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:13
  Old Post 03-05-2002 19:46 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#22 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

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.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:13
Post  Old Post 03-05-2002 19:49 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#23 Report this post to a moderator
Support Apolyton buy from Amazon

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.

Sir Ralph is offline Sir Ralph
Emperor
Long live teh Schwampel!
Dec 2001
time: 06:13
  Old Post 03-05-2002 20:46
Edit/Delete Message Reply w/Quote
#24 Report this post to a moderator
Enter the AD-FREE zone

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.

child of Thor is offline child of Thor
Emperor
UK
Jan 2002
time: 05:13
  Old Post 03-05-2002 21:06
Edit/Delete Message Reply w/Quote
#25 Report this post to a moderator
Support Apolyton, buy Civilization 2

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

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:13
  Old Post 03-05-2002 22:48 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#26 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

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?

Sir Ralph is offline Sir Ralph
Emperor
Long live teh Schwampel!
Dec 2001
time: 06:13
  Old Post 03-05-2002 23:14
Edit/Delete Message Reply w/Quote
#27 Report this post to a moderator
Help yourself to an AD-FREE life

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 Sir Ralph on 04-05-2002 at 02:46

The Big Mc is offline The Big Mc
King
Of the universe / England
Oct 2001
time: 05:13
  Old Post 07-05-2002 12:50 Visit The Big Mc's homepage!
Edit/Delete Message Reply w/Quote
#28 Report this post to a moderator
Help yourself to an AD-FREE life

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.

Sir Ralph is offline Sir Ralph
Emperor
Long live teh Schwampel!
Dec 2001
time: 06:13
  Old Post 07-05-2002 17:13
Edit/Delete Message Reply w/Quote
#29 Report this post to a moderator
Avatar Enlargement: We've got the solution

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.

The Big Mc is offline The Big Mc
King
Of the universe / England
Oct 2001
time: 05:13
  Old Post 07-05-2002 17:26 Visit The Big Mc's homepage!
Edit/Delete Message Reply w/Quote
#30 Report this post to a moderator
Support Apolyton buy from Amazon

if I get the vb to open the tiff I am having some big problems with that

 
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:13.
Apolyton Time is 00:13.
    top of page
Rate This Thread:
archivepost
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0667 seconds (93.40% PHP - 6.60% MySQL) with 31 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net