GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
User avatar
B-$hep
Immortal
Posts: 572
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 Font Topic - txt2gta2 released!

Post by B-$hep »

Nice work.
I found a bug in user prompt.

For example your app waits for user to press: y or n.
If he get's big Y or N then it doesn't care.

If you are reading input from user then use this: _strlwr_s to convert the input string to lowercase.
That way it will work for both small and capital letters / chars and it will not care about if the input is in uppercase or lowercase.

You must:

Code: Select all

#include <string.h>
More about _strlwr_s.

http://msdn.microsoft.com/en-us/library ... 80%29.aspx
http://java.functionx.com/cppbcb/Lesson19.htm


Also one recommendation:
When creating new images, your app should detect if there is already result.png in folder.
If there is, it should add one nr to new image filename each time user creates a new image.
For example: result1.png, result2.png etc.

So it doesn't rewrite the old image. It would be really good feature.
And it's very easy to implement.


And if i were you: i would pack each exe and dll in imagemagick folder with UPX.
You can decrease the archive size pretty alot with that.
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - txt2gta2 released!

Post by Cuban-Pete »

Nice suggestions, but I cannot get them working.... :(

First the, result01.png, result02.png, etc. This requires a lot of more code, because now I'm working like this:

Code: Select all

string theMessage; //this goes to system(), or the .exe
theMessage = "imagemagick\\convert.exe ";
theMessage += theAdding;
theMessage +=" +append result.png";
const char *realMessage = theMessage.c_str(); // get const char * representation for stupid system() to work
system(realMessage);
In Python you can do this:

Code: Select all

>>> print '%(language)s has %(#)03d quote types.' % \
...       {'language': "Python", "#": 2}
Python has 002 quote types.
I don't know how you do that in C++.
I also don't know how to read in a folder if there is a file with a certain name...
String/char* functions don't like each other...


----
The Y and N bug, requires something like this and still gives me an error.

Code: Select all

int autoAdjust = 0;
	cout << "Do you want background to auto adjust to text size? Enter y/n: ";
	cin.clear();
	string autoStringTemp;
	getline(cin, autoStringTemp);

	const char *autoString = autoStringTemp.c_str();
	char *autoStringFin = strlwr(autoString);

	if (autoStringFin == "y") autoAdjust = 1;
getline() only accepts a string, strlwr() only accepts char* (no strings), so I convert it, but it only converts it into const char*.... not working and weird stuff compared to Python...

I will take a look at UPX.
Thanks for testing and help. :)

edit: I should do some more C++ learning anyway, because I still don't know that much about class/array (string/char).
"Mmmm, your eyes are so beautiful."
User avatar
B-$hep
Immortal
Posts: 572
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 Font Topic - txt2gta2 released!

Post by B-$hep »

Because i corrupted 3 of my core partitions by fckng up partition tables and lost all the data that im trying to restore at the moment, i can't immediately help you.

Knowing that all that hard work i have done (my map editor src, SCR tool src etc) is gone somewhere and may never get back to me, really hurts.

Im on my old XP PC atm. I will try to setup the VC++ on it and will get back here.


Pray for me, lol.
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - txt2gta2 released!

Post by Cuban-Pete »

I have prayed for you. :)
"Mmmm, your eyes are so beautiful."
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: GTA2 Font Topic - txt2gta2 released!

Post by BenMillard »

Take it somewhere professional. The data will still be on the disk surface. You might end up making things worse.
User avatar
B-$hep
Immortal
Posts: 572
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 Font Topic - txt2gta2 released!

Post by B-$hep »

To professional? Hell no. I don't need this. I have done it alot by myself and always getting successful result. I have experience with this stuff.

Everything is restored now. Including my XP partition thankfully. I don't have to reinstall everything. As always thanks goes to Power Data Recovery.
I love this tool. He helped me once again and got everything back. I have used it also earlier and it helped me also without any problems. Just let it to scan for 60 min and when i came back, everything was back where it should be.
This software really should get award (even now when it already has many of them).

So: Cuban-Pete, i can offer some help soon. Maybe i will even code some examples for you.
If you have any other problems with this, post them here.
User avatar
B-$hep
Immortal
Posts: 572
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 Font Topic - txt2gta2 released!

Post by B-$hep »

Cuban-Pete.

Are you using these:

Code: Select all

const char *autoString = autoStringTemp.c_str();
   char *autoStringFin = strlwr(autoString);
for something else also? Other than putting "y" and "n" into them?
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - txt2gta2 released!

Post by Cuban-Pete »

Great that you got everything back. :) Perhaps now that it's working again, also make a backup of your important files on an external HDD?
B-$hep wrote:Cuban-Pete.

Are you using these:

Code: Select all

const char *autoString = autoStringTemp.c_str();
   char *autoStringFin = strlwr(autoString);
for something else also? Other than putting "y" and "n" into them?
Only for y/n. Or more correct, what the user puts in.

You know what, perhaps it helps if I give you the code. I think I do certain things not 'clean' or write them unclear. Perhaps if you like you, you can give information and I can adjust it to better code. It are only 300 lines (and that is with comment junk and "GUI" text)
main.zip
***You may not release a new version without my written permission!***
(3.07 KiB) Downloaded 574 times
(if something is unclear, I can add more information) (do you work in visual studio 2008?, else I can give whole project - but I don't know which files are needed exactly)
"Mmmm, your eyes are so beautiful."
User avatar
B-$hep
Immortal
Posts: 572
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 Font Topic - txt2gta2 released!

Post by B-$hep »

Yes i use Visual Studio. Including 2008.
Project is not needed, i can create my own to compile it.

I will take a look.
Razor
Lunatic
Lunatic
Posts: 456
Joined: 19 Jul 2008, 14:14
GH nick: Razor, R
Location: Poland / Szczecin
Contact:

Re: GTA2 Font Topic - txt2gta2 released!

Post by Razor »

Image

Created by Kamil ofc :)
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - txt2gta2 released!

Post by Cuban-Pete »

Thank you for the polish font and thanks Kamil (does Kamil not have forum account?).

I don't think I can add support to this version because DOS only supports ASCII letters (unless B-$shep knows a way). But, I will make version 3 with a real windows GUI and then I will be able add polish support (finally). :D
"Mmmm, your eyes are so beautiful."
Razor
Lunatic
Lunatic
Posts: 456
Joined: 19 Jul 2008, 14:14
GH nick: Razor, R
Location: Poland / Szczecin
Contact:

Re: GTA2 Font Topic - txt2gta2 released!

Post by Razor »

sweet add cool gta2 layout and some sweet options like coloring words/letters (i mean not all txt in one color) like in this topic (first post): http://www.gtatwo.fora.pl/konstruktorzy ... ,3553.html
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - txt2gta2 released!

Post by Cuban-Pete »

Razor wrote:sweet add cool gta2 layout and some sweet options like coloring words/letters (i mean not all txt in one color) like in this topic (first post): http://www.gtatwo.fora.pl/konstruktorzy ... ,3553.html
yes, I was planning to do that, but I am not yet sure how to do it exactly. Perhaps something like with this website:

TXT2GTA2

is this in code

Code: Select all

[color=#4000FF]TXT2[/color][color=#FF0000]GTA2[/color]
but it is not very clear, so I need to think of better solution, you got idea?
"Mmmm, your eyes are so beautiful."
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - txt2gta2 released!

Post by Cuban-Pete »

I made some huge progress with a real GUI. I now know how to add functions and use them. In fact, I already got a textbox with button working that can generate GTA2 text. :D
"Mmmm, your eyes are so beautiful."
User avatar
B-$hep
Immortal
Posts: 572
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 Font Topic - txt2gta2 released!

Post by B-$hep »

So there is no point anymore mess with that console app code ??
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - txt2gta2 released!

Post by Cuban-Pete »

B-$hep wrote:So there is no point anymore mess with that console app code ??
No point in fix y/n, but the result.png to result01, result02 still is. I don't know how to do that... I need to check if there is already a result file in the folder, and also if there is already a result01 or result 02 etc....

edit: I use a lot of console app code in this version 3.
the include <iostream> makes .exe very big, while I only need system(). Is there a way to import/include only the system() part?
"Mmmm, your eyes are so beautiful."
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - txt2gta2 released!

Post by Cuban-Pete »

Polish letters will work in version 3 (thanks to kamil en razor). See here my proof:
result.png
result.png (673 Bytes) Viewed 40400 times
There is still a long way to go... (new color system, good GUI, rename all letters to latin (argh, just renamed to ascii, but GUI works with latin))
"Mmmm, your eyes are so beautiful."
Razor
Lunatic
Lunatic
Posts: 456
Joined: 19 Jul 2008, 14:14
GH nick: Razor, R
Location: Poland / Szczecin
Contact:

Re: GTA2 Font Topic - txt2gta2 released!

Post by Razor »

najs :) cant wait :P
User avatar
B-$hep
Immortal
Posts: 572
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 Font Topic - txt2gta2 released!

Post by B-$hep »

Cuban-Pete.

Sorry for delay. I was busy messing with my PC here. Now it's fine.


Did you really tested that <iostream> makes exe alot bigger?
How much bigger?

I compiled your code in Visual C++ Express and my EXE is 21KB in release mode.
Yours 51.5KB. I think if something makes your exe big then it's your icon.

Im modifying your code at the moment to include this check for Result1, Result2 etc.
I will mark all the changes i made or code that i have added and then will give it to you.
So you can see how it's done. And hopefully you can integrate this to your GUI version.

EDIT: btw, are you using the image generation code in same way in your GUI app?
I mean, if you rewrote something in imagemagik code or something in there that generates that result.png then you must probably modify my written code also a bit.
But i don't know yet.

Anyway...
I will complete this and then we will see how the integration goes.
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - txt2gta2 released!

Post by Cuban-Pete »

B-$hep wrote: Did you really tested that <iostream> makes exe alot bigger?
How much bigger?

I compiled your code in Visual C++ Express and my EXE is 21KB in release mode.
Yours 51.5KB. I think if something makes your exe big then it's your icon.

Im modifying your code at the moment to include this check for Result1, Result2 etc.
I will mark all the changes i made or code that i have added and then will give it to you.
So you can see how it's done. And hopefully you can integrate this to your GUI version.

EDIT: btw, are you using the image generation code in same way in your GUI app?
I mean, if you rewrote something in imagemagik code or something in there that generates that result.png then you must probably modify my written code also a bit.
But i don't know yet.

Anyway...
I will complete this and then we will see how the integration goes.
I thought the <iostream> makes version 3 (GUI in visual basic 2008, .net it's called??) bigger, but I tested it again and perhaps it was something else (image I think). Or #include <string> ??

I'm using the same image generate code in GUI app. Small problem is that every time you use system() you get a dos (black box) popping up for half a second. I call system() once for append all text images together, once for coloring, once for adding background. If I want to add better color system, there will be more calls. I want to get that black box popping up gone. So I searched for alternative to call imagemagick.exe. I found CreateProcess(), got it working after lots of trying, but this also pops up a black box... :| So I'm not sure how to fix that... one option is to use source files of imagemagick (you can get them free from website), but I have no idea how it works and how to use it...


The code below you gave works nice. Why did you remove it from post?

Code: Select all

string IntToString(int intValue){
   char buffer[65];
   _itoa_s(intValue, buffer, 65, 10);
   return buffer;
}
"Mmmm, your eyes are so beautiful."
Post Reply