01.08.2011, 00:50
(
Последний раз редактировалось RyDeR`; 06.04.2012 в 10:57.
)
Foreword
I love the MapAndreas plugin, but I find so unfortunate that it uses ~70 MB's of RAM memory, so I started browsing the topic and found out that you can actually get the same results using fseek by setting the position indicator of the file using a small calculation instead of allocating the whole map into the memory.
Features
This include has exactly the same features as the MapAndreas plugin and is as accurate - there's simply no difference in terms of functioning between them:
* Although every script needs some memory (depending what you're using and how much) to execute. I assume this will use a couple of hundred kilobytes.
Function(s)
We have only one function:
It returns the result and stores it in fZ (if variable defined).
Example(s)
Here are some basic examples:
Or you can just do it this way:
Results:
Notes
- Credits to Kalcor for his MapAndreas plugin.
- Credits to De[M]oN who posted a C++ fseek example in there.
Download
MapAndreas.inc
SAfull.hmap
I love the MapAndreas plugin, but I find so unfortunate that it uses ~70 MB's of RAM memory, so I started browsing the topic and found out that you can actually get the same results using fseek by setting the position indicator of the file using a small calculation instead of allocating the whole map into the memory.
Features
This include has exactly the same features as the MapAndreas plugin and is as accurate - there's simply no difference in terms of functioning between them:
MapAndreas Plugin | MapAndreas Include | |
Memory usage | ~70 MB RAM | Nothing* |
Accuracy | EXACTLY the same accuracy as the plugin | |
Performance | The plugin is really fast (because the data is allocated in the memory first and has the C++ performance advantage) | This include is slower than the plugin (obviously because we're using fseek and read all time again plus we don't have the C++ performance advantage in this case) |
Initialize time | Takes some time to allocate the memory (~5 seconds) | No waiting needed - immediately ready for use |
Function(s)
We have only one function:
pawn Код:
stock Float: GetPointZPos(const Float: fX, const Float: fY, &Float: fZ = 0.0);
Example(s)
Here are some basic examples:
pawn Код:
printf("The Z-coordinate of X = 2033.55 | Y = 1007.73 is Z = %.02f", GetPointZPos(2033.55, 1007.73));
pawn Код:
new
Float: fZ
;
GetPointZPos(1254.65, -554.55, fZ);
printf("The Z-coordinate of X = 1254.65 | Y = -554.55 is Z = %.02f", fZ);
Код:
The Z-coordinate of X = 2033.55 | Y = 1007.73 is Z = 9.81 The Z-coordinate of X = 1254.65 | Y = -554.55 is Z = 67.48
- Credits to Kalcor for his MapAndreas plugin.
- Credits to De[M]oN who posted a C++ fseek example in there.
Download
MapAndreas.inc
SAfull.hmap