mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' of github.com:acemod/ACE3
This commit is contained in:
commit
10bb77e738
BIN
ace_breakLine.dll
Normal file
BIN
ace_breakLine.dll
Normal file
Binary file not shown.
@ -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";
|
||||
};
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -485,16 +485,12 @@
|
||||
<Italian>A Terra!</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Interaction_TeamManagement">
|
||||
<English>Team<br/>Management</English>
|
||||
<German>Team<br/>Management</German>
|
||||
<Spanish>Gestión<br/>de equipo</Spanish>
|
||||
<French>Gestion<br/>d'équipe</French>
|
||||
<Polish>Zarządzanie<br/>oddziałem</Polish>
|
||||
<Czech>Správa<br/>týmu</Czech>
|
||||
<Russian>Управление<br/>группой</Russian>
|
||||
<Portuguese>Gerenciamento<br/>de Equipe</Portuguese>
|
||||
<Italian>Organizzazione<br/>Squadra</Italian>
|
||||
<Hungarian>Csapat<br/>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<br/>Red</English>
|
||||
<German>Team Rot<br/>beitreten</German>
|
||||
<Spanish>Unirse al<br/>equipo rojo</Spanish>
|
||||
<French>Rejoindre<br/>Rouge</French>
|
||||
<Polish>Dołącz do drużyny<br/>czerwonej</Polish>
|
||||
<Czech>Připojit do<br/>Červeného týmu</Czech>
|
||||
<Russian>Присоединиться<br/>к красной группе</Russian>
|
||||
<Portuguese>Unir-se à<br/>Equipe Vermelha</Portuguese>
|
||||
<Italian>Entra nella<br/>Squadra Rossa</Italian>
|
||||
<Hungarian>Csatlakozás a<br/>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<br/>Green</English>
|
||||
<German>Team Grün<br/>beitreten</German>
|
||||
<Spanish>Unirse al<br/>equipo verde</Spanish>
|
||||
<French>Rejoindre<br/>Verte</French>
|
||||
<Polish>Dołącz do<br/>drużyny zielonej</Polish>
|
||||
<Czech>Připojit do<br/>Zeleného týmu</Czech>
|
||||
<Russian>Присоединиться<br/>к зеленой группе</Russian>
|
||||
<Portuguese>Unir-se à<br/>Equipe Verde</Portuguese>
|
||||
<Italian>Entra nella<br/>Squadra Verde</Italian>
|
||||
<Hungarian>Csatlakozás a<br/>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<br/>Blue</English>
|
||||
<German>Team Blau<br/>beitreten</German>
|
||||
<Spanish>Unirse al<br/>equipo azul</Spanish>
|
||||
<French>Rejoindre<br/>Bleue</French>
|
||||
<Polish>Dołącz do<br/>drużyny niebieskiej</Polish>
|
||||
<Czech>Připojit do<br/>Modrého týmu</Czech>
|
||||
<Russian>Присоединиться<br/>к синей группе</Russian>
|
||||
<Portuguese>Unir-se à<br/>Equipe Azul</Portuguese>
|
||||
<Italian>Entra nella<br/>Squadra Blu</Italian>
|
||||
<Hungarian>Csatlakozás a<br/>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<br/>Yellow</English>
|
||||
<German>Team Gelb<br/>beitreten</German>
|
||||
<Spanish>Unirse al<br/>equipo amarillo</Spanish>
|
||||
<French>Rejoindre<br/>Jaune</French>
|
||||
<Polish>Dołącz do<br/>drużyny żółtej</Polish>
|
||||
<Czech>Připojit do<br/>Žlutého týmu</Czech>
|
||||
<Russian>Присоединиться<br/>к желтой группе</Russian>
|
||||
<Portuguese>Unir-se à<br/>Equipe Amarela</Portuguese>
|
||||
<Italian>Entra nella<br/>Squadra Gialla</Italian>
|
||||
<Hungarian>Csatlakozás a<br/>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>
|
||||
|
@ -2,22 +2,22 @@
|
||||
<Project name="ACE">
|
||||
<Package name="Laser_SelfDesignate">
|
||||
<Key ID="STR_ACE_Laser_SelfDesignate_DesignatorOn">
|
||||
<English>Laser<br/>Designator On</English>
|
||||
<German>Lasermarkierer<br/>an</German>
|
||||
<Spanish>Laser<br/>Designador encendido</Spanish>
|
||||
<Russian>ЛЦУ<br/>ВКЛ</Russian>
|
||||
<Czech>Laserový<br/>značkovač zapnut</Czech>
|
||||
<Polish>Desygnator<br/>laserowy wł.</Polish>
|
||||
<French>Désignateur<br/>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<br/>Designator Off</English>
|
||||
<German>Lasermarkierer<br/>aus</German>
|
||||
<Spanish>Laser<br/>Designador apagado</Spanish>
|
||||
<Russian>ЛЦУ<br/>ВЫКЛ</Russian>
|
||||
<Czech>Laserový<br/>značkovat vypnut</Czech>
|
||||
<Polish>Desygnator<br/>laserowy wył.</Polish>
|
||||
<French>Désignateur<br/>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>
|
||||
|
@ -2,16 +2,16 @@
|
||||
<Project name="ACE">
|
||||
<Package name="MagazineRepack">
|
||||
<Key ID="STR_ACE_MagazineRepack_RepackMagazines">
|
||||
<English>Repack<br/>Magazines</English>
|
||||
<German>Magazine<br/>umpacken</German>
|
||||
<Spanish>Reorganizar<br/>cargadores</Spanish>
|
||||
<French>Réorganiser<br/>chargeurs</French>
|
||||
<Polish>Przepakuj<br/>magazynki</Polish>
|
||||
<Czech>Přepáskovat<br/>Zásobníky</Czech>
|
||||
<Italian>Ricarica<br/>Caricatori</Italian>
|
||||
<Portuguese>Reorganizar<br/>Carregadores</Portuguese>
|
||||
<Hungarian>Újratárazás<br/></Hungarian>
|
||||
<Russian>Перепаковать<br/>магазины</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>
|
||||
|
@ -128,11 +128,11 @@
|
||||
<Russian>Проверить температуру оружия</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Overheating_CheckTemperatureShort">
|
||||
<English>Check weapon<br/>temperature</English>
|
||||
<Spanish>Verificar temperatura<br/>del arma</Spanish>
|
||||
<Polish>Sprawdź temperaturę<br/>broni</Polish>
|
||||
<Czech>Zkontrolovat teplotu<br/>zbraně</Czech>
|
||||
<French>Vérifier la<br/>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>
|
||||
|
@ -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}")
|
11
extensions/breakLine/CMakeLists.txt
Normal file
11
extensions/breakLine/CMakeLists.txt
Normal 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()
|
79
extensions/breakLine/ace_breakLine.cpp
Normal file
79
extensions/breakLine/ace_breakLine.cpp
Normal 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 )
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user