Advertisement
ipsBruno

(Pawn) MapAndreas pawn cache

Aug 4th, 2014
679
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.10 KB | None | 0 0
  1. /****
  2. *
  3. *   MapAndreas Cached in Pawn
  4. *   Version 0.1
  5. *   Made by ipsBruno, thanks to RyDeR and KyeMaN
  6. *
  7. ***/
  8.  
  9.  
  10. new Float: propertyNames [6001][6001];
  11.  
  12. stock InitMapAndreas(m = 0) {
  13.  
  14.     print("Carregando MapAndreas! Aguarde.");
  15.  
  16.     new File: s_hMap = fopen("SAfull.hmap", io_read);
  17.  
  18.     for(new Float:fX = -3000.0; fX < 3000.0; fX += 1.0) {
  19.         for(new Float: fY = -3000.0; fY < 3000.0; fY += 1.0) {
  20.  
  21.            
  22.             new
  23.                 afZ[1]
  24.             ;
  25.             fseek(s_hMap, ((6000 * (-floatround(fY, floatround_tozero) + 3000) + (floatround(fX, floatround_tozero) + 3000)) << 1));
  26.             fblockread(s_hMap, afZ);
  27.  
  28.             propertyNames[floatround(fX+3000.0)][floatround(fY+3000.0)] = Float:((((afZ[0] >>> 16) * 0.01)));
  29.        
  30.         }
  31.     }
  32.     fclose(s_hMap);
  33.  
  34.     print("SAfull.hmap carregado na memória com sucesso!");
  35.  
  36.  
  37.     #if defined HooK_OnGameModeInit
  38.             return HooK_OnGameModeInit();
  39.     #endif
  40.  
  41.     #pragma unused m
  42.  
  43. }
  44.  
  45. #define MapAndreas_FindZ_For2DCoord MapFindZ
  46. #define MapAndreas_Init InitMapAndreas
  47.  
  48. stock Float: MapFindZ(Float: x,Float: y, &Float:z) {
  49.  
  50.     return z = propertyNames[floatround(x+3000.0)][floatround(y+3000.0)];
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement