[Include] MapAndreas Include
#1

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:

MapAndreas PluginMapAndreas Include
Memory usage~70 MB RAMNothing*
AccuracyEXACTLY the same accuracy as the plugin
PerformanceThe 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 timeTakes some time to allocate the memory (~5 seconds)No waiting needed - immediately ready for use
* 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:
pawn Код:
stock Float: GetPointZPos(const Float: fX, const Float: fY, &Float: fZ = 0.0);
It returns the result and stores it in fZ (if variable defined).

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));
Or you can just do it this way:
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);
Results:
Код:
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
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
Reply


Messages In This Thread
MapAndreas Include - by RyDeR` - 01.08.2011, 00:50
Re: MapAndreas Include - by iPLEOMAX - 01.08.2011, 00:54
Re: MapAndreas Include - by MrDeath537 - 01.08.2011, 01:00
Re: MapAndreas Include - by Donya - 01.08.2011, 01:06
Re: MapAndreas Include - by Toni - 01.08.2011, 01:27
Re: MapAndreas Include - by SlashPT - 01.08.2011, 01:30
Respuesta: MapAndreas Include - by D3IMON - 01.08.2011, 01:53
Re: MapAndreas Include - by [LoD]Hauke - 01.08.2011, 02:06
Re: MapAndreas Include - by RyDeR` - 01.08.2011, 08:07
Re: MapAndreas Include - by wups - 01.08.2011, 09:01
Re: MapAndreas Include - by QuaTTrO - 01.08.2011, 09:16
Re: MapAndreas Include - by RyDeR` - 01.08.2011, 09:28
Re: MapAndreas Include - by HyperZ - 01.08.2011, 09:34
Re: MapAndreas Include - by vyper - 01.08.2011, 10:55
Re: MapAndreas Include - by Zh3r0 - 01.08.2011, 11:28
Re: MapAndreas Include - by Lorenc_ - 01.08.2011, 11:53
Re: MapAndreas Include - by Hiddos - 01.08.2011, 12:10
Re: MapAndreas Include - by Lorenc_ - 01.08.2011, 12:13
Re: MapAndreas Include - by CoaPsyFactor - 01.08.2011, 12:31
Re: MapAndreas Include - by RyDeR` - 01.08.2011, 12:40
Re: MapAndreas Include - by JackBauer. - 01.08.2011, 13:24
Re: MapAndreas Include - by RyDeR` - 01.08.2011, 13:34
Re: MapAndreas Include - by TheArcher - 01.08.2011, 14:03
AW: MapAndreas Include - by Drebin - 01.08.2011, 15:07
Re: MapAndreas Include - by RyDeR` - 01.08.2011, 22:06
Re: MapAndreas Include - by Lorenc_ - 02.08.2011, 09:36
Re: MapAndreas Include - by RyDeR` - 02.08.2011, 09:55
Re: MapAndreas Include - by Lorenc_ - 02.08.2011, 10:07
Re: MapAndreas Include - by TheArcher - 02.08.2011, 10:35
Re : Re: MapAndreas Include - by Naruto_Emilio - 20.08.2011, 01:49
AW: MapAndreas Include - by -Viper- - 31.03.2012, 21:11
Re: MapAndreas Include - by Hiddos - 06.04.2012, 09:20
Re: MapAndreas Include - by RyDeR` - 06.04.2012, 10:58
Re: MapAndreas Include - by SublimESmokeR420 - 12.04.2012, 00:56
Re: MapAndreas Include - by SublimESmokeR420 - 14.04.2012, 02:41
Re: MapAndreas Include - by RyDeR` - 21.04.2012, 10:21
Re: MapAndreas Include - by xMaGmOtAnEtHx - 18.08.2012, 01:17
Re: MapAndreas Include - by FUNExtreme - 18.08.2012, 01:30
Re: MapAndreas Include - by PowerPC603 - 29.12.2013, 23:00
Re: MapAndreas Include - by Alphlax - 29.12.2013, 23:23

Forum Jump:


Users browsing this thread: 7 Guest(s)