GTA2 Tile Selektor

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
User avatar
Sektor
Boss
Boss
Posts: 1369
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

GTA2 Tile Selektor

Post by Sektor » 22 May 2011, 14:09

DO NOT RUN THIS ON AN SSD! IT WRITES THOUSANDS OF IMAGES TO THE HARD DRIVE EVERYTIME YOU RUN IT.

Download:
tile-selektor-setup.zip
(563.32 KiB) Downloaded 1785 times
VB6 source code:
2011-11-02-tsbm.zip
(94.8 KiB) Downloaded 835 times
This is a modified version of GTA2 File Editor. GTA2 File Editor was created by Stephen Dawkins, Exc0r5 and Gavin Rudd.

The tile selector in the official map editor has a bug that displays most tiles as white until you click on them. This program works around that issue by using its own tile viewer and syncing it with the map editor when you click on a tile.

Sektor added the map editor listbox/window controlling code. Ben Millard fixed some bugs, made various changes to the GUI, made the window always on top and modified the tile viewer to adjust the number of columns and rows displayed when you resize.
ts02.jpg
ts02.jpg (39.35 KiB) Viewed 31974 times

User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: GTA2 Tile Selektor

Post by elypter » 22 May 2011, 15:41

if you add scroll wheel support 2 way support, so you can use the pick tool without displaying the left panel it would be perfect.
yur sa'nok ngeyä

User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: GTA2 Tile Selektor

Post by Gustavob » 22 May 2011, 16:17

Very nice, but could be made better with scroll wheel support, like elypter said
You just lost the game.

User avatar
B-$hep
Immortal
Posts: 531
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: Estonia - Finland

Re: GTA2 Tile Selektor

Post by B-$hep » 22 May 2011, 17:28

Nice work Sektor and Ben.

Maybe this helps adding wheel support:

http://vb.mvps.org/samples/HookXP/

http://visualstudiomagazine.com/article ... wheel.aspx
Always wear safety glasses while programming.

BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: GTA2 Tile Selektor

Post by BenMillard » 28 May 2011, 17:39

Changelog for the version I just sent privately to Sektor:
  1. Window size, position and state are now remembered by using Windows registry.
  2. Re-arranged the GUI so tabs are on the right, merged with scrollbar and Refresh button.
  3. Renamed some tabs to be shorter, giving more space for scrollbar in new GUI.
  4. F5 is now a shortcut for Refresh.
  5. Up and Down scroll by 1 row.
  6. PageUp and PageDown scroll by nearly one page: the first (or last) fully visible row will remain fully visible, so you can keep track of context.
  7. Fixed a bug where there was sometimes an empty row after all the tiles.
  8. Fixed a bug at startup, when only the tiles in the initially visible area were visible. (Might still see this when going from a short .sty to a long one.)
Ran out of time to add scrollwheel support, sorry. Now off for a night out but will return somewhen tomorrow.

Ideas
  1. Tabs might just be removed so this project can be focus entirely on selecting tiles.
  2. The project it was based on is available online...somewhere? Maybe add it to GTA2 Tools page?
  3. Just realised that Ctrl+R should be a shortcut for Refresh. Easily added but can't right now.
  4. Using a small icon instead of the letter "R" might be better for the Refresh button. It has a tooltip to help explain, for now.
Last edited by BenMillard on 29 May 2011, 16:54, edited 1 time in total.

User avatar
Sektor
Boss
Boss
Posts: 1369
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Tile Selektor

Post by Sektor » 28 May 2011, 20:43

Thanks for the updates. I added Tile Selektor and GTA2 File Editor to the tools page.

I attached the Nullsoft installer script and icon (just if someone wants to improve the installer or package it themselves).
Attachments
installer.7z
(1.97 KiB) Downloaded 661 times

User avatar
Pyro
Immortal
Posts: 414
Joined: 17 Mar 2010, 04:07
GH nick: Pyro
Location: Wales, UK

Re: GTA2 Tile Selektor

Post by Pyro » 28 May 2011, 20:56

Looks good :)

Hopefully the scroll-wheel support will be added in future, make it a lot easier!

As you mentioned, only the tile selector is useful in the map editor since we already have STY editors out there for the sprites/fonts etc. If the other tabs can be removed that'd be good.

Also, with the refresh shortcut, F5 seems the more common than Ctrl+R so perhaps keep it as F5? Also, you could change the button caption from saying "Refresh" to a little refresh icon with a tooltip saying refresh also.

8-)

BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: GTA2 Tile Selektor

Post by BenMillard » 29 May 2011, 16:47

Just sent an updated version to Sektor with these changes:
  1. Basic scrollwheel support. One unit of scroll equals one row in the list.
  2. Scrollwheel support ignores "smooth scrolling" magnitudes and the Windows "scroll by this many lines" multiplier.
  3. Simply pressing R will Refresh the view. Ctrl+R and F5 also work.
  4. Tabs are now covered up by the scrollbar.
Sektor will probably upload the new version once he has checked my changes, if he approves them.

A couple of loose ends which I keep forgetting about:
  1. Scrollwheel should work in Tile Selektor even when it doesn't have focus. (Is that possible in VB6?)
  2. Update the Tile Selektor if DMA Editor has picked a different tile. (Avoiding fights and race conditions between them.)
  3. Give focus to DMA Editor when any tile is clicked in Tile Selektor.
  4. Remove all redundant controls and code.

User avatar
B-$hep
Immortal
Posts: 531
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: Estonia - Finland

Re: GTA2 Tile Selektor

Post by B-$hep » 29 May 2011, 17:32

I wonder is the installer really needed?
Always wear safety glasses while programming.

User avatar
Sektor
Boss
Boss
Posts: 1369
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Tile Selektor

Post by Sektor » 29 May 2011, 17:36

The installer is required because this VB6 program needs OCX files registered and users should never have to do that manually.

I attached Ben Millard's updated version to the first post.

User avatar
JohnTooray
Mugger
Mugger
Posts: 19
Joined: 06 May 2011, 11:43
Location: Munster, Germany

Re: GTA2 Tile Selektor

Post by JohnTooray » 03 Jun 2011, 09:53

Is it possible to remove the window decorations? So you only have the window itself without borders and a title bar...

That would make this quite handy tool even a bit handier :)

cheers,
2Ray

User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: GTA2 Tile Selektor

Post by elypter » 03 Jun 2011, 10:00

afaik it is possible to do this in autoit. it would also be possible to position the window inside the editor automatically
yur sa'nok ngeyä

User avatar
JernejL
Psycho
Psycho
Posts: 94
Joined: 21 Feb 2010, 22:03
GH nick: RedShirt

Re: GTA2 Tile Selektor

Post by JernejL » 04 Jun 2011, 17:02

You could use this to put the list into gta2 map editor itself, making it appear as part of gta2 editor:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Also nice to see someone actually using Gavin's code after all this time, this was his late version SRC i released?
To people who don't know about it, it is this:
http://www.mathpudding.com/temp/gta2fesrc.zip (Gavin Rudd's nearly complete sty editor written in VB around year 2002, parts of it were used to help me make my sty editor (delta stream decoder) )

User avatar
Sektor
Boss
Boss
Posts: 1369
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Tile Selektor

Post by Sektor » 04 Jun 2011, 18:15

It looks like the same code. There's a lot of room for optimisation. When it opens a STY file, it goes through each tile, writes it to disk as temp.bmp and then reads it from disk. There is really no good reason for writing to disk, it could all be done in RAM.

The code is still much better than most of my code and I'm impressed he was able to create it in 2002.

User avatar
Sektor
Boss
Boss
Posts: 1369
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Tile Selektor

Post by Sektor » 08 Jun 2011, 08:17

I found a post of mine from 2007 about a tile selector:
Posted 22/06/07 at 18:20:54
I'm sure Delfi has the skills to take over the interface for the GTA2 map editor and add his own style viewer. It could select the same tile in the real interface but hide it from view. He was able to change the GTA2 network screen completely but that is a much more basic interface. He's a busy man though and this would take some effort.
I thought it was amusing, especially since 4 years later, I ended up doing it myself*.

* With lots of help

User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Tile Selektor

Post by Cuban-Pete » 08 Jun 2011, 11:24

the internet makes time seem squashed...
"Mmmm, your eyes are so beautiful."

User avatar
B-$hep
Immortal
Posts: 531
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: Estonia - Finland

Re: GTA2 Tile Selektor

Post by B-$hep » 13 Jun 2011, 01:01

Here is my version, with plenty of bugs, but it integrates automatically to DMA window and moves his own ass to correct position when you move DMA window.

Thousands of thanks and credits go to: Ben Millard, Sektor, JernejL.

I must go to sleep now, i will return and will tell you more guys.
I have many ideas, how to make it better.

And i will post the source (Delphi).

Code is yours guys, but i just basically translated it to Delphi and added some nice things to it.
Always wear safety glasses while programming.

User avatar
Sektor
Boss
Boss
Posts: 1369
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Tile Selektor

Post by Sektor » 13 Jun 2011, 01:08

Cool. This does deserve to be done properly or at least better than my attempt. I'd rather work on GH ;)

Translating my window controlling code to Delphi might have been harder than just going to MSDN :lol: (not really they both would use same API calls).

Now where is the download?

User avatar
B-$hep
Immortal
Posts: 531
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: Estonia - Finland

Re: GTA2 Tile Selektor

Post by B-$hep » 13 Jun 2011, 09:25

Hi Sektor.

Well you always could do the same things in VB i guess.
I dunno.


I just translated the most important stuff, finding gta2 editor handle, clicking on listbox etc.
But it's not complete yet, because tiles drawing order is not same as in DMA editor and it clicks on wrong tiles in DMA.
Also, it loads sty from my temp folder, instead of locating it in registry.

I just wanted to test it guickly.


And there is some more stuff to be done, i could upload the messy incomplete source if you want? Or the exe. It atleast shows how it looks like.

I will improve it of course and the final source will be available anyway.
I have plan to rewrite it in assembler, to make it as fast as possible.

I didn't bother to mess with SetParent anymore.
I tried it and didn't get good results. So just decided to remove all the unneeded borders, make it topmost, position to DMA gta2 tiles tab and move it, whenever dma editor moves.

More checks are needed for that thing, for ex: if DMA editor is active (has focus) or not, is it minimized or not.
And hide the selector accordingly.


Also hide it from windows taskbar, etc small things.


EDIT:

I attached simple demo.
Just run DMA editor first and then this tool.
If you close DMA editor, then tool closes also.


STE.STY must be in C:\TEMP\ !!!

ie:
c:\temp\ste.sty


EXE is clean, don't worry. I checked it.
Always wear safety glasses while programming.

User avatar
Sektor
Boss
Boss
Posts: 1369
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Tile Selektor

Post by Sektor » 13 Jun 2011, 14:27

Nice it loads the tiles nearly instantly. As you said, the tile order isn't exactly the same, so it gets it wrong sometimes. It follows the map editor window around (you can see it catching up but it's good enough). ASM isn't needed since it's speedy already but if that's what you want to do, it would be cool.

Will you add the option to resize the window so you can see many tiles without scrolling? After you fix the bugs of course.

If you undock the map editor's tile selector before starting your program then it doesn't follow properly. It does follow if I undock (drag it off the map editor) after running your program.

Post Reply