Results 1 to 10 of 121

Thread: G.T.A.2 Map Editor

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Ok, here is the image i use for testing.




    As you see it already as offset. But how GTA2 centers them anyway then?
    It must somehow compensate that offset.

    One idea i had is to go thru the image, ignore all black pixels and center rest of the image in new image. Black pixels in GTA2 are always used for transparency.
    So i can ignore them. But such image processing will slow things down i guess.
    I dont know.

    I want to rotate these things around, thats why it must be centered, if its not then it will look ugly when rotating and it will do it not correctly. For just moving around the offset doesnt matter for me.

    OK, very "hacky" solution is ignore all this and leave it as is and just rotate and move as needed. If rotation with offset moves sprite away from correct position on map then just move it back. Not very good but if i will give up i will do it.

    Seems the code im using is used widely:
    http://gitorious.org/racr/mainline/b...c/r_opengl.cpp

    So it's not the code but actual GTA2 sprites that are done in so stupid way.


    I have a c++ code from friend who created texture atlas with all sprites packed together in 2048x2048 sheet. Just like you suggested.
    All the odd sizes of sprites in it, directly from GTA2 files and he uses them with no problems.
    Automatic uv coord generation etc. Dunno exactly what he does there.

    Have to ask or look at the source more closely. I could do this already but i thought i will get it work in simpler way. His code is not easy one.

    For some reason i don't like texture atlas things, i think its too complicated for me.


    EDIT


    Maybe instead of centering actual quad he centers the sprite itself?
    Sprite W, H, and offset thingy. Centering images is easy, at least in 2D.

    This would work in my case for map editor i think.

    But if we talk about game collision then he shoots a ray in 4 directions from ped center and tests for collisions with nearby obstacles / walls. So actual sprite quad is not used in collision testing.


    Dunno.
    Last edited by hwnd; 31-03-2013 at 03:32 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •