Localization / Headers

This commit is contained in:
PabstMirror 2015-04-06 01:05:28 -05:00
parent 2ada87e3ac
commit d295ee6980
15 changed files with 200 additions and 183 deletions

View File

@ -8,3 +8,10 @@ class Extended_PostInit_EventHandlers {
clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) );
}; };
}; };
class Extended_FiredBIS_EventHandlers {
class Mortar_01_base_F {
class ADDON {
firedBIS = QUOTE(_this call FUNC(handleFired));
};
};
};

View File

@ -4,11 +4,12 @@ class CfgVehicles {
class ACE_SelfActions { class ACE_SelfActions {
class ACE_Equipment { class ACE_Equipment {
class GVAR(rangetable) { class GVAR(rangetable) {
displayName = "Open 82mm Rangetable"; displayName = "$STR_ACE_MK6MORTAR_rangetable_action";
condition = QUOTE(_this call FUNC(rangeTableCanUse)); condition = QUOTE(_this call FUNC(rangeTableCanUse));
statement = QUOTE(_this call FUNC(rangeTableOpen)); statement = QUOTE(_this call FUNC(rangeTableOpen));
priority = 0; priority = 0;
icon = QUOTE(PATHTOF(UI\icon_rangeTable.paa)); icon = QUOTE(PATHTOF(UI\icon_rangeTable.paa));
exceptions[] = {"notOnMap", "isNotInside"};
}; };
}; };
}; };

View File

@ -5,8 +5,8 @@ class CfgWeapons {
class ACE_RangeTable_82mm: ACE_ItemCore { class ACE_RangeTable_82mm: ACE_ItemCore {
author = "$STR_ACE_Common_ACETeam"; author = "$STR_ACE_Common_ACETeam";
scope = 2; scope = 2;
displayName = "82mm Rangetable"; displayName = "$STR_ACE_MK6MORTAR_rangetable_name";
descriptionShort = "82mm Rangetable D"; descriptionShort = "$STR_ACE_MK6MORTAR_rangetable_description";
picture = QUOTE(PATHTOF(UI\icon_rangeTable.paa)); picture = QUOTE(PATHTOF(UI\icon_rangeTable.paa));
class ItemInfo: InventoryItem_Base_F { class ItemInfo: InventoryItem_Base_F {
mass = 0.5; mass = 0.5;

View File

@ -1,24 +1,23 @@
/* /*
Name: AGM_Artillery_fnc_dev_buildTable * Author: PabstMirror
* DEV function to build mortar tables, very cpu intensive (never used durring normal gameplay)
Author: Pabst Mirror *
* Arguments:
Description: * 0: Muzzle Velocity <NUMBER>
DEV function to build mortar tables, very cpu intensive (never used durring normal gameplay) * 1: Air Friction <NUMBER>
*
Parameters: (normal BIS "Fired" EH stuff) * Return Value:
0: NUMBER - Muzzle Velocity * <Data in clipboard>
1: NUMBER - Air Friction *
* Example:
Returns: * [100, -0.0001] spawn ace_mk6mortar_fnc_dev_buildTable; //spawn (scheduled) is slower
Data in clipboard * [100, -0.0001] call ace_mk6mortar_fnc_dev_buildTable; //faster, but will lock while processing
*
Example: * Public: No
[100, -0.0001] spawn AGM_Artillery_fnc_dev_buildTable; //spawn (scheduled) is slower
[100, -0.0001] call AGM_Artillery_fnc_dev_buildTable; //faster, but will lock while processing
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_muzzleVelocity", "_airFriction", "_stillInRange", "_currentRange", "_increasePerRow", "_outputArray", "_rangeToHit", "_lineElevation", "_lineHeightElevation", "_lineTimeOfFlight", "_lineCrosswindDeg", "_lineHeadwindMeters", "_lineTailWindMeters", "_lineTempDec", "_lineTempInc", "_lineAirDensDec", "_lineAirDensInc", "_result", "_outputString"]; private ["_muzzleVelocity", "_airFriction", "_stillInRange", "_currentRange", "_increasePerRow", "_outputArray", "_rangeToHit", "_lineElevation", "_lineHeightElevation", "_lineTimeOfFlight", "_lineCrosswindDeg", "_lineHeadwindMeters", "_lineTailWindMeters", "_lineTempDec", "_lineTempInc", "_lineAirDensDec", "_lineAirDensInc", "_result", "_outputString"];
_muzzleVelocity = _this select 0; _muzzleVelocity = _this select 0;
@ -53,7 +52,7 @@ while {_stillInRange} do {
}; };
_currentRange = _currentRange + _increasePerRow; _currentRange = _currentRange + _increasePerRow;
}; };
hint str _currentRange; hintSilent str _currentRange;
}; };
//handle floating point rounding errors //handle floating point rounding errors

View File

@ -1,26 +1,25 @@
/* /*
Name: FUNC(simulateFindSolution) * Author: PabstMirror
* DEV to find a firing solution for a given range
Author: Pabst Mirror *
* Arguments:
Description: * 0: Range to Hit (Meters)<NUMBER>
Converts numbers into nicely formated strings. * 1: Height To Hit (Meters)<NUMBER>
* 2: Muzzle Velocity (M/S)<NUMBER>
Parameters: * 3: Air Friction <NUMBER>
0: NUMBER - Range to Hit (Meters) * 4: Time Step (seconds) (eg 1/50 will simulate 50 cycles per second) <NUMBER>
1: NUMBER - Height To Hit (Meters) *
2: NUMBER - Muzzle Velocity (M/S) * Return Value:
3: NUMBER - Air Friction * ARRAY - [NUMBER - Elevation In Degrees, NUMBER - Shot Durration]
4: NUMBER - Time Step (seconds) (eg 1/50 will simulate 50 cycles per second) *
* Example:
Returns: * [_rangeToHit, _heightToHit, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(simulateFindSolution);
ARRAY - [NUMBER - Elevation In Degrees, NUMBER - Shot Durration] *
* Public: No
Example:
[_rangeToHit, _heightToHit, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(simulateFindSolution);
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_rangeToHit", "_heightToHit", "_muzzleVelocity", "_airFriction", "_maxElev", "_minElev", "_error", "_solutionElevation", "_lastTestResult", "_numberOfAttempts"]; private ["_rangeToHit", "_heightToHit", "_muzzleVelocity", "_airFriction", "_maxElev", "_minElev", "_error", "_solutionElevation", "_lastTestResult", "_numberOfAttempts"];
#define MAX_ATTEMPTS 22 #define MAX_ATTEMPTS 22

View File

@ -1,30 +1,25 @@
/* /*
Name: simulateShot * Author: PabstMirror
* DEV function to build mortar tables, very cpu intensive (never used durring normal gameplay)
Author: Pabst Mirror *
* Arguments:
Description: * 0: Shot Angle (degrees) <NUMBER>
Simulates the path of a fired shell. * 1: Muzzle Velocity (m/s) <NUMBER>
* 2: Air Friction <NUMBER>
Parameters: * 3: Tempeture (degres celcius) <NUMBER>
0: NUMBER - Shot Angle (degrees) * 4: Relative Air Denisty <NUMBER>
1: NUMBER - Muzzle Velocity (m/s) * 5: Tail Wind (m/s) <NUMBER>
2: NUMBER - Air Friction * 6: Cross Wind (m/s) <NUMBER>
3: NUMBER - Tempeture (degres celcius) * 7: Height Of Target (M) <NUMBER>
4: NUMBER - Relative Air Denisty * 8: Time Step (fraction of a second) <NUMBER>
5: NUMBER - Tail Wind (m/s) *
6: NUMBER - Cross Wind (m/s) * Return Value:
7: NUMBER - Height Of Target (M) * <ARRAY> [Distance Traveled<NUMBER>, Shot Time<NUMBER>, Offset (degrees)<NUMBER>]
8: NUMBER - Time Step (fraction of a second) *
* Example:
Returns: * [45, 180, -0.0001, 15, 1, 10, 0, 0, 1/50] call ace_mk6mortar_fnc_dev_simulateShot;
ARRAY - *
NUMBER - Distance Traveld * Public: No
NUMBER - Shot Time
NUMBER - Offset (degrees)
Example:
[45, 180, -0.0001, 15, 1, 10, 0, 0, 1/50] call simulateShot;
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -15,7 +15,7 @@
* Nothing * Nothing
* *
* Example: * Example:
* [clientFiredBIS-XEH] call ace_mk6mortars_fnc_handleFired * [clientFiredBIS-XEH] call ace_mk6mortar_fnc_handleFired
* *
* Public: No * Public: No
*/ */
@ -26,27 +26,29 @@ disableSerialization;
PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
if (!GVAR(airResistanceEnabled)) exitWith {}; if (!GVAR(airResistanceEnabled)) exitWith {};
// Large enough distance to not simulate any wind deflection
if (_unit distance ACE_player > 3000) exitWith {false}; // Large enough distance to not simulate any wind deflection. if (_unit distance ACE_player > 8000) exitWith {false};
//AI will have no clue how to use: //AI will have no clue how to use:
_shooterMan = gunner _vehicle; _shooterMan = gunner _vehicle;
if (!([_shooterMan] call EFUNC(common,isPlayer))) exitWith {false}; if (!([_shooterMan] call EFUNC(common,isPlayer))) exitWith {false};
//Should be zero, just make sure:
_bisAirFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction");
if (_bisAirFriction != 0) exitWith {ERROR("Non zero base airFriction");};
//Hack Until these are intergrated: //Hack Until these are intergrated:
if (isNil QEGVAR(weather,currentRelativeDensity)) then { if (isNil QEGVAR(weather,currentRelativeDensity)) then {
EGVAR(weather,currentRelativeDensity) = 1; EGVAR(weather,currentRelativeDensity) = 1;
}; };
if (isNil QEGVAR(weather,currentTemperature)) then { if (isNil QEGVAR(weather,currentTemperature)) then {
EGVAR(weather,currentTemperature) = 20; EGVAR(weather,currentTemperature) = 15;
}; };
//powder effects: //powder effects:
_temperature = EGVAR(weather,currentTemperature); _temperature = EGVAR(weather,currentTemperature);
_newMuzzleVelocityCoefficent = (((_temperature + 273.13) / 288.13 - 1) / 40 + 1); _newMuzzleVelocityCoefficent = (((_temperature + 273.13) / 288.13 - 1) / 40 + 1);
systemChat str _newMuzzleVelocityCoefficent;
if (_newMuzzleVelocityCoefficent != 1) then { if (_newMuzzleVelocityCoefficent != 1) then {
_bulletVelocity = velocity _projectile; _bulletVelocity = velocity _projectile;
_bulletSpeed = vectorMagnitude _bulletVelocity; _bulletSpeed = vectorMagnitude _bulletVelocity;
@ -55,8 +57,8 @@ if (_newMuzzleVelocityCoefficent != 1) then {
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
}; };
systemChat format ["PFEH for %1", _ammo];
// if (_bullet isKindOf "BulletBase") then {
[{ [{
private ["_deltaT", "_bulletVelocity", "_bulletSpeed", "_trueVelocity", "_trueSpeed", "_dragRef", "_accelRef", "_drag", "_accel"]; private ["_deltaT", "_bulletVelocity", "_bulletSpeed", "_trueVelocity", "_trueSpeed", "_dragRef", "_accelRef", "_drag", "_accel"];
PARAMS_2(_args,_pfID); PARAMS_2(_args,_pfID);
@ -72,17 +74,13 @@ if (_newMuzzleVelocityCoefficent != 1) then {
_bulletVelocity = velocity _shell; _bulletVelocity = velocity _shell;
_bulletSpeed = vectorMagnitude _bulletVelocity; _bulletSpeed = vectorMagnitude _bulletVelocity;
if (vectorMagnitude ACE_wind > 0) then {
_trueVelocity = _bulletVelocity vectorDiff ACE_wind; _trueVelocity = _bulletVelocity vectorDiff ACE_wind;
_trueSpeed = vectorMagnitude _trueVelocity; _trueSpeed = vectorMagnitude _trueVelocity;
_drag = _deltaT * _airFriction * _trueSpeed * EGVAR(weather,currentRelativeDensity); _drag = _deltaT * _airFriction * _trueSpeed * EGVAR(weather,currentRelativeDensity);
_accel = _trueVelocity vectorMultiply (_drag); _accel = _trueVelocity vectorMultiply (_drag);
_bulletVelocity = _bulletVelocity vectorAdd _accel; _bulletVelocity = _bulletVelocity vectorAdd _accel;
};
_shell setVelocity _bulletVelocity; _shell setVelocity _bulletVelocity;
}, 0, [_projectile, MK6_82mm_AIR_FRICTION, time]] call CBA_fnc_addPerFrameHandler; }, 0, [_projectile, MK6_82mm_AIR_FRICTION, time]] call CBA_fnc_addPerFrameHandler;
// };

View File

@ -10,6 +10,7 @@
* No * No
* *
* Example: * Example:
* [bob, mortar] call ace_mk6mortar_fnc_handlePlayerVehicleChanged;
* *
* Public: No * Public: No
*/ */
@ -48,7 +49,7 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
_currentFireMode = (weaponState [_mortarVeh, [0]]) select 2; _currentFireMode = (weaponState [_mortarVeh, [0]]) select 2;
_currentChargeMode = _fireModes find _currentFireMode; _currentChargeMode = _fireModes find _currentFireMode;
_text = format ["<t size='0.8'>%1: %2 <img image='%3'/></t>", "Charge", _currentChargeMode, QUOTE(PATHTOF(UI\ui_charges.paa))]; _text = format ["<t size='0.8'>%1: %2 <img image='%3'/></t>", (localize "STR_ACE_MK6MORTAR_rangetable_charge"), _currentChargeMode, QUOTE(PATHTOF(UI\ui_charges.paa))];
_chargeText ctrlSetStructuredText parseText _text; _chargeText ctrlSetStructuredText parseText _text;
if (shownArtilleryComputer && {!GVAR(allowComputerRangefinder)}) then { if (shownArtilleryComputer && {!GVAR(allowComputerRangefinder)}) then {
//Don't like this solution, but it works //Don't like this solution, but it works
@ -57,22 +58,29 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
}; };
_display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull]; _display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull];
if (isNull _display) exitWith {systemChat "null";}; if (isNull _display) exitWith {}; //It may be null for the first frame
//Hud should hidden in 3rd person
_notGunnerView = cameraView != "GUNNER";
//Update CurrentElevation Display: //Update CurrentElevation Display:
if (_notGunnerView) then {
(_display displayCtrl 80175) ctrlSetText "";
} else {
_elevDeg = parseNumber ctrlText (_display displayCtrl 175); _elevDeg = parseNumber ctrlText (_display displayCtrl 175);
if (_useMils) then { if (_useMils) then {
(_display displayCtrl 80175) ctrlSetText str round (_elevDeg * 6400 / 360); (_display displayCtrl 80175) ctrlSetText str round (_elevDeg * 6400 / 360);
} else { } else {
(_display displayCtrl 80175) ctrlSetText str _elevDeg; (_display displayCtrl 80175) ctrlSetText str _elevDeg;
}; };
};
//Update ElevationNeeded Display: //Update ElevationNeeded Display:
if (!GVAR(allowComputerRangefinder)) then { if (_notGunnerView || (!GVAR(allowComputerRangefinder))) then {
(_display displayCtrl 80176) ctrlSetText ""; (_display displayCtrl 80176) ctrlSetText "";
} else { } else {
_elevDeg = parseNumber ctrlText (_display displayCtrl 176); _elevDeg = parseNumber ctrlText (_display displayCtrl 176);
if (_elevDeg <= 0) then { if (_elevDeg <= 0) then { //Bad data means "----" out of range
(_display displayCtrl 80176) ctrlSetText (ctrlText (_display displayCtrl 176)); (_display displayCtrl 80176) ctrlSetText (ctrlText (_display displayCtrl 176));
} else { } else {
if (_useMils) then { if (_useMils) then {
@ -84,7 +92,7 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
}; };
//Update Heading Display: //Update Heading Display:
if (!GVAR(allowCompass)) then { if (_notGunnerView || (!GVAR(allowCompass))) then {
(_display displayCtrl 80156) ctrlSetText ""; (_display displayCtrl 80156) ctrlSetText "";
} else { } else {
_rotationDegrees = ((getDir _mortarVeh) + (((-180 / PI) * (_mortarVeh animationPhase "mainTurret")) + 360)) % 360; _rotationDegrees = ((getDir _mortarVeh) + (((-180 / PI) * (_mortarVeh animationPhase "mainTurret")) + 360)) % 360;

View File

@ -11,7 +11,7 @@
* None * None
* *
* Example: * Example:
* * [fromModule] call ace_mk6mortar_fnc_moduleInit
* *
* Public: No * Public: No
*/ */

View File

@ -9,7 +9,7 @@
* No * No
* *
* Example: * Example:
* * [] call ace_mk6mortar_fnc_rangeTableOpen
* *
* Public: No * Public: No
*/ */
@ -38,7 +38,7 @@ _muzzleVelocities = [];
_showToPlayer = getNumber (configFile >> "CfgWeapons" >> _weaponName >> _x >> "showToPlayer"); _showToPlayer = getNumber (configFile >> "CfgWeapons" >> _weaponName >> _x >> "showToPlayer");
if (_showToPlayer == 1) then { if (_showToPlayer == 1) then {
_artilleryCharge = getNumber (configFile >> "CfgWeapons" >> _weaponName >> _x >> "artilleryCharge"); _artilleryCharge = getNumber (configFile >> "CfgWeapons" >> _weaponName >> _x >> "artilleryCharge");
LIST_CHARGE lbAdd format ["%1: %2 [%3m/s]", "Charge", (count _muzzleVelocities), (_initSpeed * _artilleryCharge)]; LIST_CHARGE lbAdd format ["%1: %2", (localize "STR_ACE_MK6MORTAR_rangetable_charge"), (count _muzzleVelocities)];
LIST_CHARGE lbSetData [(count _muzzleVelocities), str (_artilleryCharge * _initSpeed)]; LIST_CHARGE lbSetData [(count _muzzleVelocities), str (_artilleryCharge * _initSpeed)];
_muzzleVelocities pushBack _artilleryCharge; _muzzleVelocities pushBack _artilleryCharge;
}; };

View File

@ -9,7 +9,7 @@
* No * No
* *
* Example: * Example:
* * [] call ace_mk6mortar_fnc_rangeTablePageChange
* *
* Public: No * Public: No
*/ */

View File

@ -11,7 +11,7 @@
* <ARRAY> * <ARRAY>
* *
* Example: * Example:
* * [200, 0] call ace_mk6mortar_fnc_rangeTablePreCalculatedValues
* *
* Public: No * Public: No
*/ */

View File

@ -9,6 +9,7 @@
* None * None
* *
* Example: * Example:
* [] call ace_mk6mortar_fnc_turretDisplayLoaded
* *
* Public: No * Public: No
*/ */
@ -28,9 +29,9 @@
#define CTRL_CA_ELEV (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV") #define CTRL_CA_ELEV (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV")
#define CTRL_CA_ELEV_NEED (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV_NEED") #define CTRL_CA_ELEV_NEED (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV_NEED")
disableSerialization; disableSerialization;
// PARAMS_1(_display);
_display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull]; _display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull];
if (isNull _display) exitWith {}; if (isNull _display) exitWith {};

View File

@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2015-04-05 --> <!-- Edited with tabler - 2015-04-06 -->
<Project name="ACE"> <Project name="ACE">
<Package name="mk6mortar"> <Package name="mk6mortar">
<Key ID="STR_ACE_mk6mortar_useMils"> <Key ID="STR_ACE_MK6MORTAR_rangetable_name">
<English>Mk6 Mortar: Show Angle in MILS</English> <English>82mm Rangetable</English>
</Key>
<Key ID="STR_ACE_MK6MORTAR_rangetable_description">
<English>Range Table for the MK6 82mm Mortar</English>
</Key>
<Key ID="STR_ACE_MK6MORTAR_rangetable_action">
<English>Open 82mm Rangetable</English>
</Key>
<Key ID="STR_ACE_MK6MORTAR_rangetable_charge">
<English>Charge</English>
</Key> </Key>
</Package> </Package>
</Project> </Project>