mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
initial commit.
This commit is contained in:
parent
6b9c4d1700
commit
cca61e95f8
1
addons/wind_deflection/$PBOPREFIX$
Normal file
1
addons/wind_deflection/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\wind_deflection
|
19
addons/wind_deflection/CfgEventhandlers.hpp
Normal file
19
addons/wind_deflection/CfgEventhandlers.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE(call COMPILE_FILE(XEH_preClientInit));
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
serverInit = QUOTE(call COMPILE_FILE(XEH_PostServerInit));
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
class Man {
|
||||
class ADDON {
|
||||
clientFiredBisPlayer = "if (!isNull (_this select 6) && {((_this select 6) isKindOf 'bulletBase')}) then {_this call ace_sys_wind_deflection_fnc_fired_man}";
|
||||
};
|
||||
};
|
||||
};
|
35
addons/wind_deflection/RscTitles.hpp
Normal file
35
addons/wind_deflection/RscTitles.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
class RscTitles {
|
||||
class ACE_RscWindIntuitive {
|
||||
idd = -1;
|
||||
onLoad ="with uiNameSpace do { ACE_RscWindIntuitive = _this select 0 };";
|
||||
movingEnable = 0;
|
||||
duration = 10;
|
||||
fadeIn = false;
|
||||
fadeOut = false;
|
||||
controls[] = { "ACE_RscWindIntuitive_BG", "ACE_RscWindIntuitive_1" };
|
||||
class ACE_RscWindIntuitive_BG {
|
||||
idc = -1;
|
||||
type = 0;
|
||||
style = 128;
|
||||
font = "TahomaB";
|
||||
colorBackground[] = {0,0,0,0};
|
||||
colorText[] = { 0,0,0,0};
|
||||
text = "";
|
||||
sizeEx = 0.027;
|
||||
x = "SafeZoneX + 0.001";
|
||||
y = "SafeZoneY + 0.04";
|
||||
w = 0.3;
|
||||
h = 0.3;
|
||||
size = 0.034;
|
||||
};
|
||||
class ACE_RscWindIntuitive_1: ACE_RscWindIntuitive_BG {
|
||||
// TITS = 1591514
|
||||
idc = 1591514;
|
||||
style = 48;
|
||||
colorText[] = {0,0,0,0.1};
|
||||
font ="Bitstream";
|
||||
sizeEx = 0.03;
|
||||
text = ""; // text = "x\ace\addons\sys_wind_deflection\data\windxx.paa";
|
||||
};
|
||||
};
|
||||
};
|
33
addons/wind_deflection/XEH_postInit.sqf
Normal file
33
addons/wind_deflection/XEH_postInit.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
//XEH_postInit.sqf
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
"ACE_WIND_PARAMS" addPublicVariableEventHandler { ace_wind_period_start_time = time; };
|
||||
"ACE_RAIN_PARAMS" addPublicVariableEventHandler { ace_wind_rain_period_start_time = time; };
|
||||
|
||||
_func = {
|
||||
_wind = ([] call FUNC(getWind));
|
||||
setWind [_wind select 0, _wind select 1, true];
|
||||
// _nWind = wind;
|
||||
// _pW = [_nWind select 0, _nWind select 1, 0] call CBA_fnc_vect2polar;
|
||||
// _pAW = [_wind select 0, _wind select 1, 0] call CBA_fnc_vect2polar;
|
||||
// hint format["w: %1 %2\na: %3 %4", _pW select 1, _pw select 0, _pAW select 1, _pAW select 0];
|
||||
// diag_log text format["ACE_WIND,%1,%2,%3,%4,%5", time, _pW select 1, _pw select 0, _pAW select 1, _pAW select 0];
|
||||
};
|
||||
|
||||
[_func, 1, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
_rainFunc = {
|
||||
if(GVAR(enableRain)) then {
|
||||
if(!isNil "ACE_RAIN_PARAMS" && {!isNil "ace_wind_rain_period_start_time"}) then {
|
||||
_oldStrength = ACE_RAIN_PARAMS select 0;
|
||||
_rainStrength = ACE_RAIN_PARAMS select 1;
|
||||
_transitionTime = ACE_RAIN_PARAMS select 2;
|
||||
_periodPosition = (time - ace_wind_rain_period_start_time) min _transitionTime;
|
||||
_periodPercent = (_periodPosition/_transitionTime) min 1;
|
||||
|
||||
0 setRain ((_periodPercent*(_rainStrength-_oldStrength))+_oldStrength);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
[_rainFunc, 0, []] call CBA_fnc_addPerFrameHandler;
|
3
addons/wind_deflection/XEH_postServerInit.sqf
Normal file
3
addons/wind_deflection/XEH_postServerInit.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
[FUNC(serverController), 60] call cba_fnc_addPerFrameHandler;
|
34
addons/wind_deflection/XEH_preClientInit.sqf
Normal file
34
addons/wind_deflection/XEH_preClientInit.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
#include "script_component.hpp"
|
||||
#include "\ca\editor\Data\Scripts\dikCodes.h"
|
||||
|
||||
PREP(bulletflight);
|
||||
PREP(fired_man);
|
||||
PREP(clockwind);
|
||||
PREP(wind_intuitive);
|
||||
PREP(keypressed);
|
||||
|
||||
GVAR(running) = false;
|
||||
// Settings for MP missions. in SP clientside config takes priority
|
||||
GVAR(force_drift_on) = true; //true: drift always on, don't allow client to turn it off
|
||||
//false: client setting will determine whether he has drift
|
||||
GVAR(force_drift_off) = false; //true: drift always off, don't allow client to turn it on
|
||||
//false: client setting will determine whether he has drift
|
||||
|
||||
GVAR(presstime) = 0;
|
||||
FUNC(KEEPTIME) = {
|
||||
if((count GVAR(WINDSPEED)) > 0) then {
|
||||
private ["_wind", "_p", "_str"];
|
||||
_wind = ACE_wind;
|
||||
|
||||
_p = _wind call CBA_fnc_vect2polar;
|
||||
_str = format["Wind: %1 at %2m/s (%3MPH)\n%4", floor(_p select 1), floor(_p select 0), floor((_p select 0)*2.23693629), GVAR(WINDSPEED)];
|
||||
TRACE_2("Wind",_wind,_str);
|
||||
};
|
||||
};
|
||||
|
||||
[QUOTE(ADDON), "Toggle_Wind_Info", { [_this] call FUNC(keypressed) }] call CBA_fnc_addKeyHandlerFromConfig; // sys_eject: Uses same keypress to show Altimeter while in a parachute or skydiving
|
||||
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
[FUNC(KEEPTIME), 0.0, []] call CBA_fnc_addPerFrameHandler;
|
||||
#endif
|
55
addons/wind_deflection/XEH_preInit.sqf
Normal file
55
addons/wind_deflection/XEH_preInit.sqf
Normal file
@ -0,0 +1,55 @@
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
LOG(MSG_INIT);
|
||||
|
||||
GVAR(enableRain) = false;
|
||||
|
||||
ace_wind_initial_dir = (random 360);
|
||||
|
||||
ace_wind_initial_speed = (overcast*15)+(random (overcast*5)) max 1;
|
||||
|
||||
ace_wind_overcast_multiplier = 1;
|
||||
|
||||
ace_wind_mean_speed = ace_wind_initial_speed;
|
||||
|
||||
ace_wind_mean_dir = ace_wind_initial_dir;
|
||||
|
||||
ace_wind_current_speed = ace_wind_initial_speed;
|
||||
|
||||
ace_wind_current_dir = ace_wind_initial_dir;
|
||||
|
||||
ace_wind_current_range_speed = -1+(random 2);
|
||||
|
||||
ace_wind_current_range_dir = -1+(random 2);
|
||||
|
||||
ace_wind_next_period = -1; //ceil((2+random(5))/(ace_wind_overcast_multiplier/10));
|
||||
|
||||
ace_wind_next_major_period = -1;
|
||||
|
||||
ace_wind_period_count = 0;
|
||||
|
||||
ace_wind_major_period_count = 0;
|
||||
|
||||
ace_wind_total_time = 0;
|
||||
|
||||
ace_wind_period_start_time = time;
|
||||
|
||||
ace_wind_rain_next_period = -1;
|
||||
|
||||
ace_wind_rain_period_count = 0;
|
||||
|
||||
ace_wind_rain_initial_rain = 0;
|
||||
if(overcast >= 0.7) then {
|
||||
ace_wind_rain_initial_rain = (random ((overcast-0.7)/0.3));
|
||||
};
|
||||
|
||||
ace_wind_current_rain = ace_wind_rain_initial_rain;
|
||||
|
||||
ace_wind_rain_current_range = -1+(random 2);
|
||||
|
||||
PREP(serverController);
|
||||
PREP(getWind);
|
||||
|
||||
ADDON = true;
|
45
addons/wind_deflection/cfgAmmo.hpp
Normal file
45
addons/wind_deflection/cfgAmmo.hpp
Normal file
@ -0,0 +1,45 @@
|
||||
class cfgAmmo {
|
||||
class BulletCore;
|
||||
class BulletBase: BulletCore {
|
||||
ace_windcoef = 0.4;
|
||||
};
|
||||
class B_545x39_Ball: BulletBase {
|
||||
ace_windcoef = 0.55;
|
||||
//ace_drift[] = {{0,0},{100,0.03},{200,0.07},{300,0.25},{400,0.42},{500,0.79},{600,1.27},{700,2},{800,2.98},{900,4.35},{1000,6.2}};
|
||||
};
|
||||
class B_556x45_Ball: BulletBase {
|
||||
ace_windcoef = 0.55;
|
||||
//ace_drift[] = {{0,0},{100,0.03},{200,0.07},{300,0.17},{400,0.37},{500,0.71},{600,1.2},{700,1.81},{800,2.75},{900,4},{1000,6.2}};
|
||||
};
|
||||
class B_762x39_Ball: BulletBase {
|
||||
ace_windcoef = 0.59;
|
||||
//ace_drift[] = {{0,0},{100,0.05},{200,0.1},{300,0.38},{400,0.75},{500,1.37}};
|
||||
};
|
||||
class B_9x39_SP5: BulletBase {
|
||||
ace_windcoef = 0.2;
|
||||
//ace_drift[] = {{0,0},{100,0.06},{200,0.25},{300,0.6},{400,1.1}};
|
||||
};
|
||||
class B_762x51_Ball: BulletBase {
|
||||
ace_windcoef = 0.4;
|
||||
//ace_drift[] = {{0,0},{100,0.03},{200,0.08},{300,0.18},{400,0.305},{500,0.57},{600,0.92},{700,1.3},{800,1.85},{900,2.5},{1000,3.3}};
|
||||
};
|
||||
class B_762x54_Ball: BulletBase {
|
||||
ace_windcoef = 0.45;
|
||||
//ace_drift[] = {{0,0},{100,0.025},{200,0.085},{300,0.19},{400,0.36},{500,0.6},{600,0.98},{700,1.45},{800,2.1},{900,2.9},{1000,4.15}};
|
||||
};
|
||||
class B_127x99_Ball: BulletBase {
|
||||
ace_windcoef = 0.24;
|
||||
//ace_drift[] = {{0,0},{100,0.013},{200,0.03},{300,0.07},{400,0.139},{500,0.211},{600,0.41},{700,0.46},{800,0.7},{900,0.93},{1000,1.24},{1100,1.6},{1200,2},{1300,2.42},{1400,3},{1500,3.66},{1600,4.35},{1700,5.2},{1800,6.1},{1900,7.2},{2000,8.4}};
|
||||
};
|
||||
class B_127x108_Ball: BulletBase {
|
||||
ace_windcoef = 0.24;
|
||||
//ace_drift[] = {{0,0},{100,0.013},{200,0.03},{300,0.07},{400,0.139},{500,0.211},{600,0.41},{700,0.46},{800,0.8},{900,1.1},{1000,1.5},{1100,1.9},{1200,2.3},{1300,2.87},{1400,3.5},{1500,4.25},{1600,5.05},{1700,6.1},{1800,7.25},{1900,8.55},{2000,11.2}};
|
||||
};
|
||||
class B_127x107_Ball: BulletBase {
|
||||
ace_windcoef = 0.24;
|
||||
//ace_drift[] = {{0,0},{100,0.013},{200,0.03},{300,0.07},{400,0.139},{500,0.211},{600,0.337},{700,0.46},{800,0.64},{900,0.85},{1000,1.15},{1100,1.45},{1200,1.9},{1300,2.3},{1400,2.9},{1500,3.53},{1600,4.35},{1700,5.2},{1800,6.3},{1900,7.4},{2000,9.7}};
|
||||
};
|
||||
class B_86x70_Ball_noTracer: BulletBase {
|
||||
ace_windcoef = 0.25;
|
||||
};
|
||||
};
|
28
addons/wind_deflection/config.cpp
Normal file
28
addons/wind_deflection/config.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
//weapons[] = { "ACE_Kestrel4500" };
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {
|
||||
"ace_common"
|
||||
};
|
||||
version = VERSION;
|
||||
author[] = {"q1184", "Rocko"};
|
||||
/*
|
||||
class ACE_Options { // ACE Options
|
||||
group = "INTERACTION";
|
||||
title = " "; // Empty (WITH A SPACE IN BETWEEN!!!!!) if no CAPTION TEXT is wanted
|
||||
class Toggle_Wind_Info { // Points to CBA Events, e.g for the keypress registered within CBA
|
||||
title = $STR_ACE_MENU_MEASUREWIND;
|
||||
};
|
||||
};
|
||||
*/
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventhandlers.hpp"
|
||||
#include "CfgAmmo.hpp"
|
||||
//#include "RscTitles.hpp"
|
BIN
addons/wind_deflection/data/icon/icon_ace_wind_ca.paa
Normal file
BIN
addons/wind_deflection/data/icon/icon_ace_wind_ca.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind0.paa
Normal file
BIN
addons/wind_deflection/data/wind0.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind1.paa
Normal file
BIN
addons/wind_deflection/data/wind1.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind10.paa
Normal file
BIN
addons/wind_deflection/data/wind10.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind11.paa
Normal file
BIN
addons/wind_deflection/data/wind11.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind12.paa
Normal file
BIN
addons/wind_deflection/data/wind12.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind2.paa
Normal file
BIN
addons/wind_deflection/data/wind2.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind3.paa
Normal file
BIN
addons/wind_deflection/data/wind3.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind4.paa
Normal file
BIN
addons/wind_deflection/data/wind4.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind5.paa
Normal file
BIN
addons/wind_deflection/data/wind5.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind6.paa
Normal file
BIN
addons/wind_deflection/data/wind6.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind7.paa
Normal file
BIN
addons/wind_deflection/data/wind7.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind8.paa
Normal file
BIN
addons/wind_deflection/data/wind8.paa
Normal file
Binary file not shown.
BIN
addons/wind_deflection/data/wind9.paa
Normal file
BIN
addons/wind_deflection/data/wind9.paa
Normal file
Binary file not shown.
31
addons/wind_deflection/functions/fnc_bulletflight.sqf
Normal file
31
addons/wind_deflection/functions/fnc_bulletflight.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
#include "script_component.hpp"
|
||||
//#define DEBUG_MODE_FULL
|
||||
#define __cfg configFile >> "CfgAmmo" >> _ammo
|
||||
private ["_unit","_t","_vel","_timeprev","_coef","_ammo","_c","_dt","_bullet"];
|
||||
_bullet = _this select 0;
|
||||
_unit = _this select 2;
|
||||
_ammo = _this select 3;
|
||||
_c = 1.42 * getNumber(__cfg >> "ace_windcoef");
|
||||
_timeprev = time;
|
||||
|
||||
//_wind = ACE_wind; //constant wind cheat
|
||||
_bulletFunc = {
|
||||
_bullet = (_this select 0) select 0;
|
||||
if (alive _bullet) then {
|
||||
_coef = ((_this select 0) select 1)*accTime;
|
||||
_vel = velocity _bullet;
|
||||
_wind = ACE_wind;
|
||||
_vel set [0, (_vel select 0) + (_wind select 0)*_coef];
|
||||
_vel set [1, (_vel select 1) + (_wind select 1)*_coef];
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
drop ["\Ca\Data\Cl_basic","","Billboard",1,30,getPos _bullet,[0,0,0],1,1.275,1.0,0.0,[0.125],[[1,0,0,0.5]],[0],0.0,2.0,"","",""];
|
||||
#endif
|
||||
_bullet setvelocity _vel;
|
||||
//TRACE_1("",_wind);
|
||||
} else {
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
};
|
||||
_time = 0.075;
|
||||
|
||||
_h1 = [_bulletFunc, _time, [_bullet, _c*_time]] call cba_fnc_addPerFrameHandler;
|
26
addons/wind_deflection/functions/fnc_clockwind.sqf
Normal file
26
addons/wind_deflection/functions/fnc_clockwind.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
#include "script_component.hpp"
|
||||
private ["_pd","_wd","_a","_ws"];
|
||||
|
||||
_pd = getdir player; //player dir
|
||||
_wind = ACE_wind;
|
||||
_wd = (_wind select 0) atan2 (_wind select 1); //wind dir
|
||||
if (_wd < 0) then {_wd = _wd + 360};
|
||||
|
||||
//_ws = _wd + 180; //angle to wind source
|
||||
//if (_ws > 360) then {_ws = _ws - 360};
|
||||
|
||||
_a = _wd - _pd; //angle from player dir to wind source
|
||||
if (_a < 0) then {_a = 360 + _a};
|
||||
|
||||
if (_a >= 345 || {_a <= 15}) exitwith {12};
|
||||
if (_a > 15 && {_a <= 45}) exitwith {1};
|
||||
if (_a > 45 && {_a <= 75}) exitwith {2};
|
||||
if (_a > 75 && {_a <= 105}) exitwith {3};
|
||||
if (_a > 105 && {_a <= 135}) exitwith {4};
|
||||
if (_a > 135 && {_a <= 165}) exitwith {5};
|
||||
if (_a > 165 && {_a <= 195}) exitwith {6};
|
||||
if (_a > 195 && {_a <= 225}) exitwith {7};
|
||||
if (_a > 225 && {_a <= 255}) exitwith {8};
|
||||
if (_a > 255 && {_a <= 285}) exitwith {9};
|
||||
if (_a > 285 && {_a <= 315}) exitwith {10};
|
||||
if (_a > 315 && {_a < 345}) exitwith {11};
|
43
addons/wind_deflection/functions/fnc_fired_driftchart.sqf
Normal file
43
addons/wind_deflection/functions/fnc_fired_driftchart.sqf
Normal file
@ -0,0 +1,43 @@
|
||||
//dumps distance-side drift data for each frame into the rpt
|
||||
|
||||
#include "script_component.hpp"
|
||||
//PARAMS_3(_u,_w,_magazine);
|
||||
#define __cfg configFile >> "CfgAmmo" >> _ammo
|
||||
|
||||
if (isNil QUOTE(FUNC(supah_funwind))) then {
|
||||
FUNC(supah_funwind) = {
|
||||
private ["_defl","_pos0","_pos","_dist","_cos","_dir0","_dir","_d","_b"];
|
||||
PARAMS_3(_pos,_pos0,_dir0); //cur bullet pos, init bullet position, init bullet direction
|
||||
|
||||
_d = _pos distance _pos0;
|
||||
_dir = [(_pos select 0)-(_pos0 select 0),(_pos select 1)-(_pos0 select 1)];
|
||||
_cos = (_dir select 0)*(_dir0 select 0) + (_dir select 1)*(_dir0 select 1);
|
||||
_b = sqrt( ((_dir select 0)^2 + (_dir select 1)^2)*((_dir0 select 0)^2 + (_dir0 select 1)^2) );
|
||||
_cos = if (_b == 0) then {0} else {_cos/_b};
|
||||
_defl = _d*sqrt(1 - _cos^2);
|
||||
TRACE_2("",_d*_cos,_defl);
|
||||
};
|
||||
};
|
||||
|
||||
private ["_unit","_weapon","_ammo","_bullet","_veh","_vel"];
|
||||
|
||||
_bullet = _this select 5;
|
||||
if (isNull _bullet) exitwith {};
|
||||
|
||||
_unit = _this select 0;
|
||||
_weapon = _this select 1;
|
||||
_ammo = _this select 4;
|
||||
_veh = vehicle player;
|
||||
|
||||
if (_bullet isKindOf "bulletBase") then {
|
||||
[_bullet, velocity _bullet, getpos _bullet] spawn {
|
||||
private ["_pos0"];
|
||||
PARAMS_2(_bullet,_vel0);
|
||||
_pos0 = [(_this select 2) select 0,(_this select 2) select 1];
|
||||
|
||||
while {alive _bullet} do {
|
||||
[[(getpos _bullet) select 0,(getpos _bullet) select 1],_pos0,_vel0] call FUNC(supah_funwind);
|
||||
sleep 0.001;
|
||||
};
|
||||
};
|
||||
};
|
14
addons/wind_deflection/functions/fnc_fired_man.sqf
Normal file
14
addons/wind_deflection/functions/fnc_fired_man.sqf
Normal file
@ -0,0 +1,14 @@
|
||||
#include "script_component.hpp"
|
||||
#define __enableWindClient (["ACE", "ACE_WIND_CONFIG", "enable_drift"] call ace_settings_fnc_getNumber)
|
||||
|
||||
private ["_unit","_weapon","_ammo","_bullet","_go"];
|
||||
|
||||
// mission global variables (force_drift_on/off) override clientside drift setting
|
||||
_go = __enableWindClient;
|
||||
if (isMultiplayer) then {
|
||||
if (GVAR(force_drift_off)) exitwith {_go = 0};
|
||||
if (GVAR(force_drift_on)) exitwith {_go = 1};
|
||||
};
|
||||
if (_go == 0) exitwith {};
|
||||
|
||||
[_this select 6,_this select 1,_this select 0,_this select 4] call FUNC(bulletflight);
|
20
addons/wind_deflection/functions/fnc_getWind.sqf
Normal file
20
addons/wind_deflection/functions/fnc_getWind.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
_return = [0,0,0];
|
||||
if(!isNil "ACE_WIND_PARAMS") then {
|
||||
_dir = ACE_WIND_PARAMS select 0;
|
||||
_dirRange = (ACE_WIND_PARAMS select 1)-(ACE_WIND_PARAMS select 0);
|
||||
_spd = ACE_WIND_PARAMS select 2;
|
||||
_spdRange = (ACE_WIND_PARAMS select 3)-(ACE_WIND_PARAMS select 2);
|
||||
_period = ACE_WIND_PARAMS select 4;
|
||||
|
||||
_periodPosition = (time - ace_wind_period_start_time) min _period;
|
||||
_periodPercent = _periodPosition/_period;
|
||||
_spdInc = _spdRange*_periodPercent;
|
||||
_dirInc = _dirRange*_periodPercent;
|
||||
_spd = (_spd + _spdInc);
|
||||
_dir = _dir + _dirInc;
|
||||
if (_dir > 360) then {_dir = _dir - 360};
|
||||
if (_dir < 0) then {_dir = _dir + 360};
|
||||
|
||||
_return = [_spd*sin _dir, _spd*cos _dir, 0];
|
||||
};
|
||||
_return;
|
35
addons/wind_deflection/functions/fnc_keypressed.sqf
Normal file
35
addons/wind_deflection/functions/fnc_keypressed.sqf
Normal file
@ -0,0 +1,35 @@
|
||||
#include "script_component.hpp"
|
||||
#define __dsp (uiNamespace getVariable "ACE_RscWindIntuitive")
|
||||
#define __ctrl (__dsp displayCtrl 1591514)
|
||||
|
||||
private["_class","_wpn","_s"];
|
||||
PARAMS_1(_keyData);
|
||||
|
||||
//a 'valve' to cut off multiple key press events within 1 frame
|
||||
if (GVAR(presstime) == time) exitwith {false};
|
||||
GVAR(presstime) = time;
|
||||
if (GVAR(running)) exitwith { GVAR(running) = false; false }; //switch info off
|
||||
GVAR(running) = true;
|
||||
|
||||
if ((player getVariable ["ace_sys_eject_skydiving",false]) || {((vehicle player) iskindof "BIS_Steerable_Parachute" || {(vehicle player) iskindof "ParachuteBase"})}) then {
|
||||
[] spawn ace_sys_eject_fnc_showAltimeter;
|
||||
} else {
|
||||
if (player != vehicle player && {!(vehicle player iskindof "StaticWeapon")}) exitwith { GVAR(running) = false; false }; // Allow checking wind in Static Laserdesignator and Spottingscope
|
||||
0 spawn {
|
||||
private ["_unit","_str","_clock","_cookie"];
|
||||
_unit = player;
|
||||
13523 cutRsc ["ACE_RscWindIntuitive", "PLAIN"];
|
||||
__ctrl ctrlsetscale 0.75;
|
||||
__ctrl ctrlcommit 0;
|
||||
while { GVAR(running) && {player == _unit} && {!(isNull __dsp)} } do {
|
||||
_str = ACE_wind call ACE_fnc_magnitude;
|
||||
_clock = call FUNC(clockwind);
|
||||
_cookie = [_clock,_str] call FUNC(wind_intuitive);
|
||||
//hint format["dir %1 str %2",_clock,_str];
|
||||
sleep 0.5;
|
||||
};
|
||||
GVAR(running) = false;
|
||||
if (!isNull __dsp) then { 13523 cutRsc ["Default", "PLAIN",3] };
|
||||
};
|
||||
};
|
||||
true;
|
82
addons/wind_deflection/functions/fnc_serverController.sqf
Normal file
82
addons/wind_deflection/functions/fnc_serverController.sqf
Normal file
@ -0,0 +1,82 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
//player sideChat format["overcast: %1", overcast];
|
||||
if(ace_wind_rain_period_count > ace_wind_rain_next_period) then {
|
||||
if(overcast >= 0.7) then {
|
||||
_lastRain = ace_wind_current_rain;
|
||||
_rainOverCast = ((overcast-0.7)/0.3);
|
||||
ace_wind_rain_next_period = ceil((1+random(10))/(ace_wind_overcast_multiplier));
|
||||
ace_wind_current_rain = (ace_wind_current_rain+(((ace_wind_current_rain))*((_rainOverCast*(ace_wind_overcast_multiplier))/8)*ace_wind_rain_current_range));
|
||||
ace_wind_current_rain = (ace_wind_current_rain max 0.01) min 1;
|
||||
_transitionTime = (_rainOverCast*5)+(random (_rainOverCast*20));
|
||||
ace_wind_rain_current_range = -1+(random 2);
|
||||
|
||||
|
||||
// player sideChat format["lastRain: %1 currentRain: %2", _lastRain, ace_wind_current_rain];
|
||||
// player sideChat format["_transitionTime: %1", _transitionTime];
|
||||
|
||||
|
||||
|
||||
ACE_RAIN_PARAMS = [_lastRain, ace_wind_current_rain, _transitionTime];
|
||||
} else {
|
||||
ace_wind_current_rain = 0;
|
||||
_lastRain = ace_wind_current_rain;
|
||||
_rainOverCast = 1;
|
||||
_transitionTime = (_rainOverCast*5)+(random (_rainOverCast*20));
|
||||
ACE_RAIN_PARAMS = [_lastRain, ace_wind_current_rain, _transitionTime];
|
||||
TRACE_4("",_lastRain,_rainOverCast,_transitionTime, overcast);
|
||||
};
|
||||
ace_wind_rain_period_start_time = time;
|
||||
publicVariable "ACE_RAIN_PARAMS";
|
||||
};
|
||||
|
||||
if(ace_wind_period_count > ace_wind_next_period) then {
|
||||
_startDir = ace_wind_current_dir;
|
||||
_startSpeed = ace_wind_current_speed;
|
||||
ace_wind_current_dir = (ace_wind_current_dir+(((ace_wind_current_dir))*((overcast*(ace_wind_overcast_multiplier))/8)*ace_wind_current_range_dir));
|
||||
ace_wind_current_speed = (ace_wind_current_speed+(((ace_wind_current_speed))*(overcast*(ace_wind_overcast_multiplier)/12)*ace_wind_current_range_speed));
|
||||
|
||||
ace_wind_current_speed = ace_wind_current_speed max 0.01;
|
||||
|
||||
if(ace_wind_current_dir < 0) then {
|
||||
ace_wind_current_dir = ace_wind_current_dir+360;
|
||||
};
|
||||
ace_wind_current_dir = ace_wind_current_dir % 360;
|
||||
|
||||
ace_wind_current_range_speed = (-1)+(random 2);
|
||||
|
||||
ace_wind_current_range_dir = (-1)+(random 2);
|
||||
|
||||
ace_wind_next_period = ceil((2+random(5))/(ace_wind_overcast_multiplier));
|
||||
ace_wind_period_count = 0;
|
||||
|
||||
_gustCount = floor(random(ace_wind_next_period*(overcast*((ace_wind_overcast_multiplier^3)))));
|
||||
|
||||
_time = ace_wind_next_period*60;
|
||||
_gusts = [];
|
||||
if(_gustCount > 0) then {
|
||||
_maxInterval = _time/_gustCount;
|
||||
for "_i" from 0 to _gustCount-1 do {
|
||||
_gustTime = (random (3 min _maxInterval));
|
||||
_timeTillGust = (_maxInterval*_i)+(random (_maxInterval - _gustTime));
|
||||
_gustSpeed = (random 1);
|
||||
_gustDir = (ace_wind_current_dir+(ace_wind_current_dir*(-1+(random 2))))*(overcast*(ace_wind_overcast_multiplier));
|
||||
_gusts set[(count _gusts), [_timeTillGust, _gustTime, _gustSpeed, _gustDir]];
|
||||
};
|
||||
};
|
||||
// diag_log text "-------";
|
||||
// diag_log text format["startDir: %1 endDir: %2", _startDir, ace_wind_current_dir];
|
||||
// diag_log text format["startSpeed: %1 endSpeed: %2", _startSpeed, ace_wind_current_speed];
|
||||
// diag_log text format["ace_wind_current_range_speed: %1", ace_wind_current_range_speed];
|
||||
// diag_log text format["ace_wind_current_range_dir: %1", ace_wind_current_range_dir];
|
||||
// diag_log text format["gusts: %1", _gusts];
|
||||
// diag_log text format["next period: %1", ace_wind_next_period];
|
||||
ace_wind_total_time = ace_wind_total_time + ace_wind_next_period;
|
||||
// diag_log text format["%1,%2,%3,%4", ace_wind_total_time, ace_wind_current_dir, ace_wind_current_speed, _gustCount];
|
||||
|
||||
ACE_WIND_PARAMS = [_startDir, ace_wind_current_dir, _startSpeed, ace_wind_current_speed, _time, _gusts];
|
||||
ace_wind_period_start_time = time;
|
||||
publicVariable "ACE_WIND_PARAMS";
|
||||
};
|
||||
ace_wind_rain_period_count = ace_wind_rain_period_count + 1;
|
||||
ace_wind_period_count = ace_wind_period_count + 1;
|
30
addons/wind_deflection/functions/fnc_wind_intuitive.sqf
Normal file
30
addons/wind_deflection/functions/fnc_wind_intuitive.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/* fnc_wind_intuitive.sqf | (c) 2009 by rocko */
|
||||
|
||||
// [5,4] spawn ace_sys_wind_deflection_fnc_wind_intuitive
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define __dsp (uiNamespace getVariable "ACE_RscWindIntuitive")
|
||||
#define __ctrl (__dsp displayCtrl 1591514)
|
||||
|
||||
#define __path "\x\ace\addons\sys_wind_deflection\data\"
|
||||
|
||||
private["_ar","_str","_str_tmp"];
|
||||
PARAMS_2(_ar_number,_str_number);
|
||||
|
||||
// Using Beaufort scale values - assuming wind in ACE is done m/s - otherwise fuck it and make better :)
|
||||
_nowind = false;
|
||||
if (_str_number >= 0 && {_str_number < 0.3}) then { _str = [1,1,1,0.5], _nowind = true; }; //Calm / probably never happens in arma (even vanilla has always light wind)
|
||||
if (_str_number >= 0.3 && {_str_number < 2}) then { _str = [1,1,1,0.5]}; //Light air - white
|
||||
if (_str_number >= 2 && {_str_number < 3}) then { _str = [0.56,0.93,0.56,0.5]}; //Light breeze - light green
|
||||
if (_str_number >= 3 && {_str_number < 5}) then { _str = [0.53,1,0.18,0.5]}; //Gentle breeze - green yellow
|
||||
if (_str_number >= 5 && {_str_number < 8}) then { _str = [1,1,0,0.5]}; //Moderate breeze - yellow
|
||||
if (_str_number >= 8 && {_str_number < 11}) then { _str = [0.85,0.65,0.1,0.5]}; //Fresh breeze - dark yellow
|
||||
if (_str_number >= 11 && {_str_number < 14}) then { _str = [1,0.65,0,0.5]}; //Strong breeze - orange
|
||||
if (_str_number >= 14 && {_str_number < 17}) then { _str = [0.93,0.25,0,0.5]}; //High wind,moderate gale, near gale - red orange
|
||||
if (_str_number >= 17) then { _str = [1,0,0,0.5]}; //Gale,fresh gale - red
|
||||
|
||||
_ar = if (!_nowind) then { format[__path+"wind"+"%1"+".paa", _ar_number] } else { __path+"wind0.paa" };
|
||||
|
||||
__ctrl ctrlSetText _ar;
|
||||
__ctrl ctrlSetTextColor _str;
|
1
addons/wind_deflection/functions/script_component.hpp
Normal file
1
addons/wind_deflection/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\wind_deflection\script_component.hpp"
|
12
addons/wind_deflection/script_component.hpp
Normal file
12
addons/wind_deflection/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#define COMPONENT wind_deflection
|
||||
#include "\x\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_WIND_DEFLECTION
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_WIND_DEFLECTION
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_WIND_DEFLECTION
|
||||
#endif
|
||||
|
||||
#include "\x\ace\addons\main\script_macros.hpp"
|
18
addons/wind_deflection/stringtable.xml
Normal file
18
addons/wind_deflection/stringtable.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project name="ACE">
|
||||
<Package name="sys_wind_deflection">
|
||||
<Container name="STR_ACE_MENU">
|
||||
<Key ID="STR_ACE_MENU_MEASUREWIND">
|
||||
<German>Wind schätzen</German>
|
||||
<English>Measure wind</English>
|
||||
<Italian>Measure wind</Italian>
|
||||
<Spanish>Measure wind</Spanish>
|
||||
<French>Mesurer vent</French>
|
||||
<Czech>Změřit sílu větru</Czech>
|
||||
<Russian>Измерить ветер</Russian>
|
||||
<Polish>Pomiar wiatru</Polish>
|
||||
<Hungarian>Szél mérés</Hungarian>
|
||||
</Key>
|
||||
</Container>
|
||||
</Package>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user