1 #using scripts\codescripts\struct;
3 #insert scripts\shared\shared.gsh;
10 requiredMapAspectRatio = GetDvarfloat(
"scr_requiredMapAspectRatio");
12 corners = getentarray(
"minimap_corner",
"targetname");
13 if (corners.size != 2)
15 /# println(
"^1Error: There are not exactly two \"minimap_corner\" entities in the map. Could not set up minimap."); #/
19 corner0 = (corners[0].origin[0], corners[0].origin[1], 0);
20 corner1 = (corners[1].origin[0], corners[1].origin[1], 0);
22 cornerdiff = corner1 - corner0;
24 north = (cos(getnorthyaw()), sin(getnorthyaw()), 0);
25 west = (0 - north[1], north[0], 0);
28 if (vectordot(cornerdiff, west) > 0) {
30 if (vectordot(cornerdiff, north) > 0) {
37 side =
vecscale(north, vectordot(cornerdiff, north));
38 northwest = corner1 - side;
39 southeast = corner0 + side;
44 if (vectordot(cornerdiff, north) > 0) {
46 side =
vecscale(north, vectordot(cornerdiff, north));
47 northwest = corner0 + side;
48 southeast = corner1 - side;
58 if ( requiredMapAspectRatio > 0 )
60 northportion = vectordot(northwest - southeast, north);
61 westportion = vectordot(northwest - southeast, west);
62 mapAspectRatio = westportion / northportion;
63 if ( mapAspectRatio < requiredMapAspectRatio )
65 incr = requiredMapAspectRatio / mapAspectRatio;
66 addvec =
vecscale( west, westportion * (incr - 1) * 0.5 );
70 incr = mapAspectRatio / requiredMapAspectRatio;
71 addvec =
vecscale( north, northportion * (incr - 1) * 0.5 );
77 setMiniMap(material, northwest[0], northwest[1], southeast[0], southeast[1]);
82 return (vec[0]*scalar, vec[1]*scalar, vec[2]*scalar);