[Include] All GTA SA Object Array
#1

A few days ago I was thinking if it would be possible to create an in game RemoveBuildingForPlayer() for my map editor. I knew I would need a list of all the objects in GTA SA and their positions to make it happen so I went ahead extracting all the object data from all the .IPL's processed them into an array.

ENUM

Code:
enum SearchInfo { 
Search_Model, 
Search_LODModel, 
Search_Model_Name[64], 
Float:SearchX, 
Float:SearchY,
Float:SearchZ, 
Float:SearchRX, 
Float:SearchRY, 
Float:SearchRZ 
}
Test position when using test array since it takes a few minutes to compile with the full array list this will help out.

Code:
CMD:testpos(playerid, arg[])
{
	SetPlayerPos(playerid, 3.6618,-2594.0713,39.7159);
	return 1;
}
There are no LOD objects in the list the object positions have their LODModel counterpart listed so using RemoveBuildingForPlayer() for both model and LODmodel should remove the building.

Known issues:
There are a few objects that might not actually have a LODModel associated but is listed anyways although not very many and really should be so much an issue as these objects are often small components of a house for example that has the same position as house object.

The rotation values may not be 100 percent precise for all objects.

File:

https://www.mediafire.com/?2c8ywc3h1veza4p
Reply
#2

I put this in the wrong section by accident please move to includes thanks.
Reply
#3

Moved.

Good job - I can think of quite a few uses for this for in game map editing.
Reply
#4

Omg, I totally needed this! Thank you!
Reply
#5

Very useful, arigatou gozaimasu.
Reply
#6

This takes soooooooooooooo long to compile D: (like 3 minutes!).
Reply
#7

Quote:
Originally Posted by MP2
View Post
This takes soooooooooooooo long to compile D: (like 3 minutes!).
That is why is there is a test array there, I wish there was a way to compile it quicker I guess it's just the one real con with the array.
Reply
#8

Very useful job!
Reply
#9

Quote:
Originally Posted by [uL]Pottus
View Post
That is why is there is a test array there, I wish there was a way to compile it quicker I guess it's just the one real con with the array.
Do ANY of the objects actually USE the rx/ry rotation? NONE of them seem to. I guess you could remove them?

EDIT: Hmm, a few (less than 1 percent) use x and y rotation :/

Perhaps it may be an idea to store them in files? Eh idk.
Reply
#10

Hint: use const and stock modifiers.
Reply
#11

Compiler gets stuck -.-
I never did anything just included it and created a function getobjinfo which prints(the print() thing :P ) the information.
Reply
#12

It takes a long time to compile but it should finish.
Reply
#13

Anyway how did you convert the rotation values from quaternion to euler angles?
Reply
#14

Quote:
Originally Posted by kurta999
Посмотреть сообщение
Anyway how did you convert the rotation values from quaternion to euler angles?
Pretty sure this was it

pawn Код:
QuatToEulerZXY(Float:quat_x, Float:quat_y, Float:quat_z, Float:quat_w, &Float:x, &Float:y, &Float:z)
{
    x = -asin(2 * ((quat_x * quat_z) + (quat_w * quat_y)));
    y = atan2(2 * ((quat_y * quat_z) + (quat_w * quat_x)), (quat_w * quat_w) - (quat_x * quat_x) - (quat_y * quat_y) + (quat_z * quat_z));
    z = -atan2(2 * ((quat_x * quat_y) + (quat_w * quat_z)), (quat_w * quat_w) + (quat_x * quat_x) - (quat_y * quat_y) - (quat_z * quat_z));
    return 1;
}
Reply
#15

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Pretty sure this was it

pawn Код:
QuatToEulerZXY(Float:quat_x, Float:quat_y, Float:quat_z, Float:quat_w, &Float:x, &Float:y, &Float:z)
{
    x = -asin(2 * ((quat_x * quat_z) + (quat_w * quat_y)));
    y = atan2(2 * ((quat_y * quat_z) + (quat_w * quat_x)), (quat_w * quat_w) - (quat_x * quat_x) - (quat_y * quat_y) + (quat_z * quat_z));
    z = -atan2(2 * ((quat_x * quat_y) + (quat_w * quat_z)), (quat_w * quat_w) + (quat_x * quat_x) - (quat_y * quat_y) - (quat_z * quat_z));
    return 1;
}
I have used this and 70-80% of the rotations was incorrect.
Reply
#16

Is there a way to get Quaternion to Euler angles more correctly? The function you showed above was only correct on a few, which was mostly the angles less than 180^o...
Reply
#17

I'd have to ask Stylock for the correct function yes I was mistaken that one is incorrect.
Reply
#18

Good Work, to userfull
Reply
#19

You could just pre-compute and store all map objects into a file or a database, so the script can gather object information at runtime, by calculating the position of the data inside the file or send a query to a database engine. If you rather want the information to be accessed faster at runtime, but you don't want to wait minutes to compile your script, you could store the data into dynamicly allocated memory at runtime from a file or database while intializing the script.
Reply
#20

how can i use this ?
can i add this to texture studio and remove any object's ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)