Skip to content

Commit

Permalink
Merge branch 'Development' of github.com:DayZMod/DayZ into Development
Browse files Browse the repository at this point in the history
  • Loading branch information
R4Z0R49 committed Nov 29, 2015
2 parents 54437fb + b54b0ad commit 06f563f
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 10 deletions.
4 changes: 2 additions & 2 deletions SQF/dayz_code/Configs/CfgLoot/Buildings/Military.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Military : Default
"z_new_worker3",
"z_new_worker4"
};
lootChance = 0.2;
lootChance = 0.4;
lootGroup = Military;
};

Expand All @@ -26,7 +26,7 @@ class MilitarySpecial : Military
"z_new_worker3",
"z_new_worker4"
};
lootChance = 0.1;
lootChance = 0.4;
lootGroup = MilitarySpecial;
};

Expand Down
4 changes: 2 additions & 2 deletions SQF/dayz_code/Configs/CfgVehicles/CrashSite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CrashSite_RU : CrashSite
{
scope = public;
model = "\z\addons\dayz_communityassets\crashsite\mi8\mi8_ru.p3d";
lootParams[] = {{0.6, -4.5, 0}, -7, 2.5, 5, 7};
lootParams[] = {{0.6, -4.5, 0}, 7, 2.5, 5, 7};
};

class CrashSite_UN : CrashSite_RU
Expand All @@ -46,5 +46,5 @@ class CrashSite_EU : CrashSite
{
scope = public;
model = "\z\addons\dayz_communityassets\crashsite\hc3\hc3.p3d";
lootParams[] = {{-0.4, -0.5, 0}, -4, 2.5, 7.5, 7};
lootParams[] = {{-0.4, -0.5, 0}, 4, 2.5, 7.5, 7};
};
2 changes: 1 addition & 1 deletion SQF/dayz_code/loot/spawn.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ switch (_lootInfo select 0) do
_b = boundingBox _vehicle;
_b = ((_b select 1) select 1) - ((_b select 0) select 1);

_d = Vector_Rotate(Vector_NORTH, random 360);
_d = Vector_Rotate2D(Vector_NORTH, random 360);

_p = Vector_Subtract(_this select 1, Vector_Multiply_Fast(_d, _b));
_p = Vector_SetZ(_p, Vector_Z(_p) + Vector_Z(getPosATL _vehicle));
Expand Down
10 changes: 7 additions & 3 deletions SQF/dayz_code/util/Vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ Author: Foxy
#define Vector_FromDir(deg) ((deg) call dz_fn_vector_fromDir)
#define Vector_FromDir_Fast(deg) [sin (deg), cos (deg), 0]

//Rotates the vector horizontally by the specified angle in degrees
#define Vector_Rotate(v, deg) ([v, deg] call dz_fn_vector_rotate)
#define Vector_Rotate_Fast(v, deg) [Vector_X(v) * cos (deg) - Vector_Y(v) * sin (deg), Vector_X(v) * sin (deg) + Vector_Y(v) * cos (deg), Vector_Z(v)]
//Rotates the vector around the global Z (up) axis by the specified angle in degrees
#define Vector_Rotate2D(v, deg) ([v, deg] call dz_fn_vector_rotate2d)
#define Vector_Rotate2D_Fast(v, deg) [Vector_X(v) * cos -(deg) - Vector_Y(v) * sin -(deg), Vector_X(v) * sin -(deg) + Vector_Y(v) * cos -(deg), Vector_Z(v)]

//Rotates the vector around the specified axis by the specified angle in degrees, in three dimensions.
#define Vector_Rotate3D(v, u, deg) ([v, u, deg] call dz_fn_vector_rotate3d)
#define Vector_Rotate3D_Fast(v, u, deg) [((v)select0)*(((u)select0)^2*(1-cos(deg))+cos(deg))+((v)select1)*(((u)select0)*((u)select1)*(1-cos(deg))-((u)select2)*sin(deg))+((v)select2)*(((u)select0)*((u)select2)*(1-cos(deg))+((u)select1)*sin(deg)),((v)select0)*(((u)select1)*((u)select0)*(1-cos(deg))+((u)select2)*sin(deg))+((v)select1)*(((u)select1)^2*(1-cos(deg))+cos(deg))+((v)select2)*(((u)select1)*((u)select2)*(1-cos(deg))-((u)select0)*sin(deg)),((v)select0)*(((u)select2)*((u)select0)*(1-cos(deg))-((u)select1)*sin(deg))+((v)select1)*(((u)select2)*((u)select1)*(1-cos(deg))+((u)select0)*sin(deg))+((v)select2)*(((u)select2)^2*(1-cos(deg))+cos(deg))]

#endif
38 changes: 37 additions & 1 deletion SQF/dayz_code/util/vector.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,40 @@ dz_fn_vector_divide = { Vector_Divide_Fast(P0, P1); };
dz_fn_vector_angle = { Vector_Angle_Fast(P0, P1); };
dz_fn_vector_normalize = { Vector_Normalize_Fast(_this); };
dz_fn_vector_fromDir = { Vector_FromDir_Fast(_this); };
dz_fn_vector_rotate = { Vector_Rotate_Fast(P0, P1); };
dz_fn_vector_rotate2d = { Vector_Rotate2D_Fast(P0, P1); };

dz_fn_vector_rotate3d =
{
#define VX (_this select 0 select 0)
#define VY (_this select 0 select 1)
#define VZ (_this select 0 select 2)
#define UX (_this select 1 select 0)
#define UY (_this select 1 select 1)
#define UZ (_this select 1 select 2)

private ["_sin", "_cos", "_icos"];
_sin = sin (_this select 2);
_cos = cos (_this select 2);
_icos = 1 - _cos;

[
VX * ( UX ^ 2 * _icos + _cos ) +
VY * ( UX * UY * _icos - UZ * _sin ) +
VZ * ( UX * UZ * _icos + UY * _sin )
,
VX * ( UY * UX * _icos + UZ * _sin ) +
VY * ( UY ^ 2 * _icos + _cos ) +
VZ * ( UY * UZ * _icos - UX * _sin )
,
VX * ( UZ * UX * _icos - UY * _sin ) +
VY * ( UZ * UY * _icos + UX * _sin ) +
VZ * ( UZ ^ 2 * _icos + _cos )
]

#undef VX
#undef VY
#undef VZ
#undef UX
#undef UY
#undef UZ
};
2 changes: 1 addition & 1 deletion SQF/dayz_server/compile/server_spawnCrashSites.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ _spawnCrashSite =
_mag = random (_lootParams select 4);
_lootPos = [((_lootParams select 2) + _mag) * sin _dir, ((_lootParams select 3) + _mag) * cos _dir, 0];
_lootPos = Vector_Add(_lootPos, _lootParams select 0);
_lootPos = Vector_Rotate(_lootPos, _lootParams select 1);
_lootPos = Vector_Rotate2D(_lootPos, _lootParams select 1);
_lootPos = _vehicle modelToWorld _lootPos;
_lootPos set [2, 0];

Expand Down

0 comments on commit 06f563f

Please sign in to comment.