Skip to content

Commit 50ee202

Browse files
committed
refactor: update marker accuracy
I'm starting to hate this project. The markers are now even more accurate but, they're still not 100%. I'm starting to think that it's beyond my capabilities.
1 parent 2910f2a commit 50ee202

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

dist/first-bundle.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/src/socket.1.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ function doPlayerUpdate(players) {
347347
});
348348

349349
var opacity = 1.0;
350-
if (window.Filter){
350+
if (window.Filter != undefined){
351351
if (plr[window.Filter.on] == undefined) {
352352
opacity = 0.0;
353353
}else{

js/src/utils.1.js

+29-5
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,42 @@ function normalize(value, min, max) {
2323
return Math.abs((value - min) / (max - min));
2424
}
2525

26-
var game_1_x = -4300.00;
27-
var game_1_y = 8660.00;
2826

29-
var game_2_x = 5000.0;
30-
var game_2_y = -5700.0;
27+
// :thinking: This seems to improve the accuracy. I think what the problem is, if that the images I'm using doesn't correlate 1:1 to the map I'm using as a reference
28+
// Reference image (for those who care): https://drive.google.com/file/d/0B-zvE86DVcv2MXhVSHZnc01QWm8/view
29+
// I'm pretty sure that the + and -'s account for the differences. So, maybe fine-tuning them will increase accuracy of the map.
30+
31+
// Top left corner of the GTA Map
32+
var game_1_x = -4000.00 - 230;
33+
var game_1_y = 8000.00 + 420;
34+
35+
// Around this location: https://tgrhavoc.me/fuck_you/retard/MGoWO6nCymLmFC3M98bXbXL7C.png.
36+
37+
// It's the middle of the map and one tile up (in leaflet). You can find it's location on leaflet by running the line below in console
38+
// var m = new L.Marker(Map.unproject([1024,1024*2],0)); m.addTo(Map);
39+
var game_2_x = 400.00 - 30;
40+
var game_2_y = -300.0 - 340.00;
41+
42+
// Some information. I've spent too long looking at this to clearly see a patten
43+
// 0 0 for leaflet = -4000 8000 for GTA
44+
// mapWidth mapHeight for leaflet = 7000 -4000 for GTA
45+
// 2048 3072 = 7000 -4000
46+
// 4096 6144 = 7000 -4000
47+
48+
// Leaflet assumes tileSize = 1024
49+
//
50+
// tile 1 in game = tile 1 in leaflet: gta delta leaflet delta:
51+
// p1: -4000, 8000 (top left) 0,0 y: 4200 y: 1024 (tilesize)
52+
// p2: -4000, 3800 (bottom left) 0,1024 x: 4400 x: 1024 (tilesize)
53+
// p3: 400, 8000 (top right) 1024,0
54+
// p4: 400, 3800 (bottom rigt) 1024,1024
3155

3256
function convertToMap(x, y) {
3357
var h = CurrentLayer.options.tileSize * 3,
3458
w = CurrentLayer.options.tileSize * 2;
3559

3660
var latLng1 = Map.unproject([0, 0], 0);
37-
var latLng2 = Map.unproject([w+20, h+30], 0);
61+
var latLng2 = Map.unproject([w / 2, (h - CurrentLayer.options.tileSize)], 0);
3862

3963
var rLng = latLng1.lng + (x - game_1_x) * (latLng1.lng - latLng2.lng) / (game_1_x - game_2_x);
4064
var rLat = latLng1.lat + (y - game_1_y) * (latLng1.lat - latLng2.lat) / (game_1_y - game_2_y);

0 commit comments

Comments
 (0)