Merge branch 'master' of github.com:acemod/ACE3

This commit is contained in:
jaynus 2015-04-14 15:11:55 -07:00
commit 10bb77e738
13 changed files with 182 additions and 90 deletions

BIN
ace_breakLine.dll Normal file

Binary file not shown.

View File

@ -23,4 +23,10 @@ class ACE_Settings {
isClientSettable = 1;
displayName = "$STR_ACE_Interact_Menu_AlwaysUseCursorSelfInteraction";
};
class GVAR(UseListMenu) {
value = 0;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_Interact_Menu_UseListMenu";
};
};

View File

@ -35,8 +35,18 @@ GVAR(iconCount) = GVAR(iconCount) + 1;
if(_icon == "") then {
_icon = DEFAULT_ICON;
};
_text = format ["<img image='%1' color='%2' align='center'/><br/><t color='%3' size='0.80' align='center' shadow='1' shadowColor='#000000' shadowOffset='0.07'>%4</t>", _icon, _color, _color, _text];
_text = if (GVAR(UseListMenu)) then {
format ["<img image='%1' color='%2' align='left'/><t color='%3' size='0.80' shadow='1' shadowColor='#000000' shadowOffset='0.07'>%4</t>", _icon, _color, _color, _text]
} else {
format ["<img image='%1' color='%2' align='center'/><br/><t color='%3' size='0.80' align='center' shadow='1' shadowColor='#000000' shadowOffset='0.07'>%4</t>", _icon, _color, _color, "ace_breakLine" callExtension _text];
};
_ctrl ctrlSetStructuredText (parseText _text);
_ctrl ctrlSetPosition [(_sPos select 0)-(0.125*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.25*SafeZoneW, 0.1*SafeZoneW];
//_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1];
_text = if (GVAR(UseListMenu)) then {
_ctrl ctrlSetPosition [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW];
} else {
_ctrl ctrlSetPosition [(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW];
};
//_ctrl ctrlSetBackgroundColor [0, 1, 0, 0.1];
_ctrl ctrlCommit 0;

View File

@ -92,7 +92,12 @@ if (_numChildren == 1) then {
};
// Scale menu based on the amount of children
_scale = 0.17 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5);
_scale = if (GVAR(UseListMenu)) then {
0.17
} else {
0.17 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5)
};
// Animate menu scale
if (_menuInSelectedPath && (_menuDepth == count _path)) then {
_scale = _scale * (0.3 + 0.7 * (((diag_tickTime - GVAR(expandedTime)) * 8) min 1));
@ -106,8 +111,13 @@ _angle = _centerAngle - _angleSpan / 2;
{
//BEGIN_COUNTER(children);
private ["_offset","_newPos"];
_newPos = [(_sPos select 0) -_scale * cos _angle,
(_sPos select 1) +_scale * (sin _angle) * 4/3];
_newPos = if (GVAR(UseListMenu)) then {
[(_sPos select 0) + _scale * 1.10,
(_sPos select 1) + _scale * 0.30 * 4/3 * (_foreachindex - _numChildren/2 + 0.5)];
} else {
[(_sPos select 0) -_scale * cos _angle,
(_sPos select 1) +_scale * (sin _angle) * 4/3];
};
//drawLine3D [_pos, _newPos, [1,0,0,0.8]];
//END_COUNTER(children);

View File

@ -24,7 +24,12 @@ private "_ctrl";
_ctrl = GVAR(iconCtrls) select GVAR(iconCount);
GVAR(iconCount) = GVAR(iconCount) + 1;
_ctrl ctrlSetStructuredText (parseText format ["<img image='%1' color='#FF0000' size='1.6' align='center'/>", _icon]);
_ctrl ctrlSetPosition [(_sPos select 0)-(0.05*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.1*SafeZoneW, 0.035*SafeZoneW];
if (GVAR(UseListMenu)) then {
_ctrl ctrlSetStructuredText (parseText format ["<img image='%1' color='#FF0000' size='1.6'/>", _icon]);
_ctrl ctrlSetPosition [(_sPos select 0)-(0.014*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.05*SafeZoneW, 0.035*SafeZoneW];
} else {
_ctrl ctrlSetStructuredText (parseText format ["<img image='%1' color='#FF0000' size='1.6' align='center'/>", _icon]);
_ctrl ctrlSetPosition [(_sPos select 0)-(0.050*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.1*SafeZoneW, 0.035*SafeZoneW];
};
//_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1];
_ctrl ctrlCommit 0;

View File

@ -485,16 +485,12 @@
<Italian>A Terra!</Italian>
</Key>
<Key ID="STR_ACE_Interaction_TeamManagement">
<English>Team&lt;br/&gt;Management</English>
<German>Team&lt;br/&gt;Management</German>
<Spanish>Gestión&lt;br/&gt;de equipo</Spanish>
<French>Gestion&lt;br/&gt;d'équipe</French>
<Polish>Zarządzanie&lt;br/&gt;oddziałem</Polish>
<Czech>Správa&lt;br/&gt;týmu</Czech>
<Russian>Управление&lt;br/&gt;группой</Russian>
<Portuguese>Gerenciamento&lt;br/&gt;de Equipe</Portuguese>
<Italian>Organizzazione&lt;br/&gt;Squadra</Italian>
<Hungarian>Csapat&lt;br/&gt;kezelés</Hungarian>
<English>Group</English>
<German>Gruppe</German>
<Spanish>Grupo</Spanish>
<French>Équipe</French>
<Portuguese>Equipe</Portuguese>
<Italian>Squadra</Italian>
</Key>
<Key ID="STR_ACE_Interaction_TeamRED">
<English>Red</English>
@ -545,52 +541,24 @@
<Hungarian>Sárga</Hungarian>
</Key>
<Key ID="STR_ACE_Interaction_JoinTeamRed">
<English>Join Team&lt;br/&gt;Red</English>
<German>Team Rot&lt;br/&gt;beitreten</German>
<Spanish>Unirse al&lt;br/&gt;equipo rojo</Spanish>
<French>Rejoindre&lt;br/&gt;Rouge</French>
<Polish>Dołącz do drużyny&lt;br/&gt;czerwonej</Polish>
<Czech>Připojit do&lt;br/&gt;Červeného týmu</Czech>
<Russian>Присоединиться&lt;br/&gt;к красной группе</Russian>
<Portuguese>Unir-se à&lt;br/&gt;Equipe Vermelha</Portuguese>
<Italian>Entra nella&lt;br/&gt;Squadra Rossa</Italian>
<Hungarian>Csatlakozás a&lt;br/&gt;piros csapathoz</Hungarian>
<English>Join Red</English>
<Spanish>Unirse al rojo</Spanish>
<French>Rejoindre Rouge</French>
</Key>
<Key ID="STR_ACE_Interaction_JoinTeamGreen">
<English>Join Team&lt;br/&gt;Green</English>
<German>Team Grün&lt;br/&gt;beitreten</German>
<Spanish>Unirse al&lt;br/&gt;equipo verde</Spanish>
<French>Rejoindre&lt;br/&gt;Verte</French>
<Polish>Dołącz do&lt;br/&gt;drużyny zielonej</Polish>
<Czech>Připojit do&lt;br/&gt;Zeleného týmu</Czech>
<Russian>Присоединиться&lt;br/&gt;к зеленой группе</Russian>
<Portuguese>Unir-se à&lt;br/&gt;Equipe Verde</Portuguese>
<Italian>Entra nella&lt;br/&gt;Squadra Verde</Italian>
<Hungarian>Csatlakozás a&lt;br/&gt;zöld csapathoz</Hungarian>
<English>Join Green</English>
<Spanish>Unirse al verde</Spanish>
<French>Rejoindre Verte</French>
</Key>
<Key ID="STR_ACE_Interaction_JoinTeamBlue">
<English>Join Team&lt;br/&gt;Blue</English>
<German>Team Blau&lt;br/&gt;beitreten</German>
<Spanish>Unirse al&lt;br/&gt;equipo azul</Spanish>
<French>Rejoindre&lt;br/&gt;Bleue</French>
<Polish>Dołącz do&lt;br/&gt;drużyny niebieskiej</Polish>
<Czech>Připojit do&lt;br/&gt;Modrého týmu</Czech>
<Russian>Присоединиться&lt;br/&gt;к синей группе</Russian>
<Portuguese>Unir-se à&lt;br/&gt;Equipe Azul</Portuguese>
<Italian>Entra nella&lt;br/&gt;Squadra Blu</Italian>
<Hungarian>Csatlakozás a&lt;br/&gt;kék csapathoz</Hungarian>
<English>Join Blue</English>
<Spanish>Unirse al azul</Spanish>
<French>Rejoindre Bleue</French>
</Key>
<Key ID="STR_ACE_Interaction_JoinTeamYellow">
<English>Join Team&lt;br/&gt;Yellow</English>
<German>Team Gelb&lt;br/&gt;beitreten</German>
<Spanish>Unirse al&lt;br/&gt;equipo amarillo</Spanish>
<French>Rejoindre&lt;br/&gt;Jaune</French>
<Polish>Dołącz do&lt;br/&gt;drużyny żółtej</Polish>
<Czech>Připojit do&lt;br/&gt;Žlutého týmu</Czech>
<Russian>Присоединиться&lt;br/&gt;к желтой группе</Russian>
<Portuguese>Unir-se à&lt;br/&gt;Equipe Amarela</Portuguese>
<Italian>Entra nella&lt;br/&gt;Squadra Gialla</Italian>
<Hungarian>Csatlakozás a&lt;br/&gt;sárga csapathoz</Hungarian>
<English>Join Yellow</English>
<Spanish>Unirse al amarillo</Spanish>
<French>Rejoindre Jaune</French>
</Key>
<Key ID="STR_ACE_Interaction_JoinedTeam">
<English>You joined Team %1</English>

View File

@ -2,22 +2,22 @@
<Project name="ACE">
<Package name="Laser_SelfDesignate">
<Key ID="STR_ACE_Laser_SelfDesignate_DesignatorOn">
<English>Laser&lt;br/&gt;Designator On</English>
<German>Lasermarkierer&lt;br/&gt;an</German>
<Spanish>Laser&lt;br/&gt;Designador encendido</Spanish>
<Russian>ЛЦУ&lt;br/&gt;ВКЛ</Russian>
<Czech>Laserový&lt;br/&gt;značkovač zapnut</Czech>
<Polish>Desygnator&lt;br/&gt;laserowy wł.</Polish>
<French>Désignateur&lt;br/&gt;Laser Allumé</French>
<English>Laser Designator On</English>
<German>Lasermarkierer an</German>
<Spanish>Laser Designador encendido</Spanish>
<Russian>ЛЦУ ВКЛ</Russian>
<Czech>Laserový značkovač zapnut</Czech>
<Polish>Desygnator laserowy wł.</Polish>
<French>Désignateur Laser Allumé</French>
</Key>
<Key ID="STR_ACE_Laser_SelfDesignate_DesignatorOff">
<English>Laser&lt;br/&gt;Designator Off</English>
<German>Lasermarkierer&lt;br/&gt;aus</German>
<Spanish>Laser&lt;br/&gt;Designador apagado</Spanish>
<Russian>ЛЦУ&lt;br/&gt;ВЫКЛ</Russian>
<Czech>Laserový&lt;br/&gt;značkovat vypnut</Czech>
<Polish>Desygnator&lt;br/&gt;laserowy wył.</Polish>
<French>Désignateur&lt;br/&gt;Laser Éteint</French>
<English>Laser Designator Off</English>
<German>Lasermarkierer aus</German>
<Spanish>Laser Designador apagado</Spanish>
<Russian>ЛЦУ ВЫКЛ</Russian>
<Czech>Laserový značkovat vypnut</Czech>
<Polish>Desygnator laserowy wył.</Polish>
<French>Désignateur Laser Éteint</French>
</Key>
</Package>
</Project>

View File

@ -2,16 +2,16 @@
<Project name="ACE">
<Package name="MagazineRepack">
<Key ID="STR_ACE_MagazineRepack_RepackMagazines">
<English>Repack&lt;br/&gt;Magazines</English>
<German>Magazine&lt;br/&gt;umpacken</German>
<Spanish>Reorganizar&lt;br/&gt;cargadores</Spanish>
<French>Réorganiser&lt;br/&gt;chargeurs</French>
<Polish>Przepakuj&lt;br/&gt;magazynki</Polish>
<Czech>Přepáskovat&lt;br/&gt;Zásobníky</Czech>
<Italian>Ricarica&lt;br/&gt;Caricatori</Italian>
<Portuguese>Reorganizar&lt;br/&gt;Carregadores</Portuguese>
<Hungarian>Újratárazás&lt;br/&gt;</Hungarian>
<Russian>Перепаковать&lt;br/&gt;магазины</Russian>
<English>Repack Magazines</English>
<German>Magazine umpacken</German>
<Spanish>Reorganizar cargadores</Spanish>
<French>Réorganiser chargeurs</French>
<Polish>Przepakuj magazynki</Polish>
<Czech>Přepáskovat Zásobníky</Czech>
<Italian>Ricarica Caricatori</Italian>
<Portuguese>Reorganizar Carregadores</Portuguese>
<Hungarian>Újratárazás </Hungarian>
<Russian>Перепаковать магазины</Russian>
</Key>
<Key ID="STR_ACE_MagazineRepack_SelectMagazineMenu">
<English>Select Magazine Menu</English>

View File

@ -128,11 +128,11 @@
<Russian>Проверить температуру оружия</Russian>
</Key>
<Key ID="STR_ACE_Overheating_CheckTemperatureShort">
<English>Check weapon&lt;br/&gt;temperature</English>
<Spanish>Verificar temperatura&lt;br/&gt;del arma</Spanish>
<Polish>Sprawdź temperaturę&lt;br/&gt;broni</Polish>
<Czech>Zkontrolovat teplotu&lt;br/&gt;zbraně</Czech>
<French>Vérifier la&lt;br/&gt;température</French>
<English>Check weapon temperature</English>
<Spanish>Verificar temperatura del arma</Spanish>
<Polish>Sprawdź temperaturę broni</Polish>
<Czech>Zkontrolovat teplotu zbraně</Czech>
<French>Vérifier la température</French>
</Key>
<Key ID="STR_ACE_Overheating_CheckingTemperature">
<English>Checking temperature ...</English>

View File

@ -27,6 +27,7 @@ include_directories(AFTER "common")
# Add extensions to build here
add_subdirectory(fcs)
add_subdirectory(breakline)
add_subdirectory(advanced_ballistics)
message("Build Type: ${CMAKE_BUILD_TYPE}")

View File

@ -0,0 +1,11 @@
set(ACE_EXTENSION_NAME "ace_breakLine")
file(GLOB SOURCES *.h *.hpp *.c *.cpp)
add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES})
add_dependencies(${ACE_EXTENSION_NAME} ace_common)
SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "")
if(CMAKE_COMPILER_IS_GNUCXX)
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1)
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1)
endif()

View File

@ -0,0 +1,79 @@
/*
* ace_breakLine.cpp
*
* Takes a string and insert as many line breaks as needed so it fits a given width
*
* Takes:
* Localized string as string
* Example: "Check weapon temperature"
*
* Returns:
* String with line breaks
*/
#include "ace_common.h"
#include <sstream>
#include <vector>
#include <string>
#define MAXCHARACTERS 14
static char version[] = "1.0";
extern "C" {
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
};
std::vector<std::string> splitString(std::string input) {
std::istringstream ss(input);
std::string token;
std::vector<std::string> output;
while (std::getline(ss, token, ' ')) {
output.push_back(token);
}
return output;
}
std::string addLineBreaks(const std::vector<std::string> &words) {
std::stringstream sstream;
int numChar = 0;
int i = 0;
while (i < words.size()) {
if (numChar == 0) {
sstream << words[i];
numChar += words[i].size();
i++;
} else {
if (numChar + 1 + words[i].size() > MAXCHARACTERS) {
sstream << "<br/>";
numChar = 0;
} else {
sstream << " " << words[i];
numChar += 1 + words[i].size();
i++;
}
}
}
return sstream.str();
}
// i like to live dangerously. jk, fix strncpy sometime pls.
#pragma warning( push )
#pragma warning( disable : 4996 )
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
//strncpy(output, function, outputSize);
if (!strcmp(function, "version")) {
strncpy(output, version, outputSize);
} else {
strcpy(output, addLineBreaks(splitString(function)).c_str());
output[outputSize - 1] = '\0';
}
}
#pragma warning( pop )

View File

@ -12,7 +12,7 @@
*/
#include "ace_common.h"
#define _USE_MATH_DEFINES
#include <math.h>
@ -113,9 +113,11 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
double distance = std::stod(argStrings[3]);
double result = getSolution(initSpeed, airFriction, angleTarget, distance);
std::string resultString = std::to_string(result);
strcpy(output, resultString.c_str());
std::stringstream sstream;
sstream << result;
strcpy(output, sstream.str().c_str());
output[outputSize - 1] = '\0';
}
}