jetelain / cTab

Public repository for cTab
http://ctab.plan-ops.fr/
GNU General Public License v2.0
7 stars 7 forks source link

Sharing icons #45

Open DE-Schmitt opened 1 year ago

DE-Schmitt commented 1 year ago

@jetelain If you need more icons for your wonderful mod, feel free to add/use our ctab icon set from Titan Platoon which we have created to enhance the ctab experience: https://ludwig-software.de/uploads/titan/20230311-titan_ctab_icons.zip

Contains 33 icons in all formats needed by ctab GTD and SIT, for example:

We have adapted the enemy menu by exchanging the current ctab enemy markers with our markers.

DE-Schmitt commented 1 year ago

Therefore we added the following lines to fnc_translateUserMarker.sqf:

if (_markerIcon == 5050) exitWith {"\cTab\img\titan\o_artillery_howitzer.paa"};
if (_markerIcon == 5051) exitWith {"\cTab\img\titan\o_artillery_self-propelled.paa"};
if (_markerIcon == 5052) exitWith {"\cTab\img\titan\o_artillery_mortar.paa"};
if (_markerIcon == 5053) exitWith {"\cTab\img\titan\o_artillery_rocket-launcher.paa"};
if (_markerIcon == 5054) exitWith {"\cTab\img\titan\o_artillery_target-aq-radar.paa"};

if (_markerIcon == 5060) exitWith {"\cTab\img\titan\o_aircraft_rotary-wing_attack.paa"};
if (_markerIcon == 5061) exitWith {"\cTab\img\titan\o_aircraft_rotary-wing_utility.paa"};

if (_markerIcon == 5065) exitWith {"\cTab\img\titan\o_aircraft_fixed-wing_attack.paa"};
if (_markerIcon == 5066) exitWith {"\cTab\img\titan\o_aircraft_fixed-wing_bomber.paa"};
if (_markerIcon == 5067) exitWith {"\cTab\img\titan\o_aircraft_fixed-wing_fighter.paa"};
if (_markerIcon == 5068) exitWith {"\cTab\img\titan\o_aircraft_fixed-wing_utility.paa"};

if (_markerIcon == 5070) exitWith {"\cTab\img\titan\o_air-defense_aaa.paa"};
if (_markerIcon == 5071) exitWith {"\cTab\img\titan\o_air-defense_sam.paa"};
if (_markerIcon == 5072) exitWith {"\cTab\img\titan\o_air-defense_aaa_sam.paa"};
if (_markerIcon == 5073) exitWith {"\cTab\img\titan\o_air-defense_radar.paa"};

if (_markerIcon == 5080) exitWith {"\cTab\img\titan\o_armored_armored.paa"};
if (_markerIcon == 5081) exitWith {"\cTab\img\titan\o_armored_mechanized-infantry.paa"};

if (_markerIcon == 5090) exitWith {"\cTab\img\titan\o_infantry_infantry.paa"};
if (_markerIcon == 5091) exitWith {"\cTab\img\titan\o_infantry_motorized-infantry.paa"};
if (_markerIcon == 5092) exitWith {"\cTab\img\titan\o_infantry_infantryman_rifle.paa"};
if (_markerIcon == 5093) exitWith {"\cTab\img\titan\o_infantry_infantryman_machine-gunner.paa"};
if (_markerIcon == 5094) exitWith {"\cTab\img\titan\o_infantry_infantryman_anti-tank.paa"};
if (_markerIcon == 5095) exitWith {"\cTab\img\titan\o_infantry_infantryman_manpad.paa"};
if (_markerIcon == 5096) exitWith {"\cTab\img\titan\o_infantry_infantryman_sniper.paa"};

if (_markerIcon == 5030) exitWith {"\cTab\img\titan\o_static_anti-tank.paa"};
if (_markerIcon == 5031) exitWith {"\cTab\img\titan\o_static_grenade-launcher.paa"};
if (_markerIcon == 5032) exitWith {"\cTab\img\titan\o_static_machine-gunner.paa"};

if (_markerIcon == 5040) exitWith {"\cTab\img\titan\o_misc_supply.paa"};    
if (_markerIcon == 5041) exitWith {"\cTab\img\titan\o_misc_signal.paa"};
if (_markerIcon == 5042) exitWith {"\cTab\img\titan\o_misc_uav.paa"};
if (_markerIcon == 5043) exitWith {"\cTab\img\titan\o_misc_installation.paa"};
if (_markerIcon == 5044) exitWith {"\cTab\img\titan\o_misc_naval.paa"};

Together with a small change to this line since our ids are above 200 (but still below 300): if ( _markerIcon >= 200 && _markerIcon <= 300 ) then {

DE-Schmitt commented 1 year ago

And I guess you will use macros for all menu items in the future. We already used the macros you provided (but did not completely use yourself until now) in cTab_markerMenu_controls.hpp

Some adjustments for the main enemy menu:

CTAB_MENU_ENTRY_ICON("Infantry"       ,1,1,0,5006,"\ctab\img\menu\nope.paa") 
CTAB_MENU_ENTRY_ICON("Armored/Tracked",2,1,0,5005,"\ctab\img\menu\nope.paa")   
CTAB_MENU_ENTRY_ICON("Artillery"      ,3,1,0,5001,"\ctab\img\menu\nope.paa")  
CTAB_MENU_ENTRY_ICON("Air Defense"    ,4,1,0,5004,"\ctab\img\menu\nope.paa")  
CTAB_MENU_ENTRY_ICON("Aircraft"       ,5,1,0,5002,"\ctab\img\menu\nope.paa") 
CTAB_MENU_ENTRY_ICON("Misc"           ,6,1,0,5008,"\ctab\img\menu\nope.paa")  

CTAB_MENU_ENTRY_ICON("Mine"           ,7,1,80,1,"\ctab\img\menu\10061500002101000000.paa")
CTAB_MENU_ENTRY_ICON("IED"            ,8,1,81,1,"\ctab\img\menu\10061500002104000000.paa")

And then of course all the submenus like:

class infantrySubmenu: cTab_RscControlsGroup
{
    #define cTab_MENU_MAX_ELEMENTS 5
    idc = 5006;
    x = MENU_X;
    y = MENU_Y;
    w = MENU_W;
    h = MENU_H(cTab_MENU_MAX_ELEMENTS);
    class controls
    {
        BACKBUTTON(cTab_MENU_MAX_ELEMENTS)

        CTAB_MENU_ENTRY_ICON("Single"            ,1,1,0,5010,"\ctab\img\menu\nope.paa") 
        CTAB_MENU_ENTRY_ICON("Static"            ,2,1,0,5011,"\ctab\img\menu\nope.paa")         
        CTAB_MENU_ENTRY_ICON("Infantry"          ,3,1,5090,12,"\ctab\img\titan\o_infantry_infantry_red32.paa")  
        CTAB_MENU_ENTRY_ICON("Infantry Motorized",4,1,5091,12,"\ctab\img\titan\o_infantry_motorized-infantry_red32.paa")  

        EXITBUTTON(cTab_MENU_MAX_ELEMENTS)
    };
};

and

class infantrySingleSubmenu: cTab_RscControlsGroup
{
    #define cTab_MENU_MAX_ELEMENTS 6
    idc = 5010;
    x = MENU_X;
    y = MENU_Y;
    w = MENU_W;
    h = MENU_H(cTab_MENU_MAX_ELEMENTS);
    class controls
    {
        BACKBUTTON(cTab_MENU_MAX_ELEMENTS)

        CTAB_MENU_ENTRY_ICON("Rifle" ,1,1,5092,13,"\ctab\img\titan\o_infantry_infantryman_rifle_red32.paa")
        CTAB_MENU_ENTRY_ICON("Sniper",2,1,5096,13,"\ctab\img\titan\o_infantry_infantryman_sniper_red32.paa")  
        CTAB_MENU_ENTRY_ICON("MG"    ,3,1,5093,13,"\ctab\img\titan\o_infantry_infantryman_machine-gunner_red32.paa")  
        CTAB_MENU_ENTRY_ICON("AT"    ,4,1,5094,13,"\ctab\img\titan\o_infantry_infantryman_anti-tank_red32.paa")  
        CTAB_MENU_ENTRY_ICON("Manpad",5,1,5095,13,"\ctab\img\titan\o_infantry_infantryman_manpad_red32.paa")  

        EXITBUTTON(cTab_MENU_MAX_ELEMENTS)
    };
};

and so on.

DE-Schmitt commented 1 year ago

Artillery submenu:

CTAB_MENU_ENTRY_ICON("Howitzer"       ,1,1,5050,12,"\ctab\img\titan\o_artillery_howitzer_red32.paa") 
CTAB_MENU_ENTRY_ICON("Self-propelled" ,2,1,5051,12,"\ctab\img\titan\o_artillery_self-propelled_red32.paa") 
CTAB_MENU_ENTRY_ICON("Mortar"         ,3,1,5052,12,"\ctab\img\titan\o_artillery_mortar_red32.paa") 
CTAB_MENU_ENTRY_ICON("Rocket-Launcher",4,1,5053,12,"\ctab\img\titan\o_artillery_rocket-launcher_red32.paa") 
CTAB_MENU_ENTRY_ICON("Target-aq-radar",5,1,5054,12,"\ctab\img\titan\o_artillery_target-aq-radar_red32.paa") 

Aircraft submenu:

CTAB_MENU_ENTRY_ICON("FW Utility",1,1,5068,12,"\ctab\img\titan\o_aircraft_fixed-wing_utility_red32.paa")  
CTAB_MENU_ENTRY_ICON("FW Fighter",2,1,5067,12,"\ctab\img\titan\o_aircraft_fixed-wing_fighter_red32.paa")  
CTAB_MENU_ENTRY_ICON("FW Attack" ,3,1,5065,12,"\ctab\img\titan\o_aircraft_fixed-wing_attack_red32.paa") 
CTAB_MENU_ENTRY_ICON("FW Bomber" ,4,1,5066,12,"\ctab\img\titan\o_aircraft_fixed-wing_bomber_red32.paa")  
CTAB_MENU_ENTRY_ICON("RW Utility",5,1,5061,12,"\ctab\img\titan\o_aircraft_rotary-wing_utility_red32.paa") 
CTAB_MENU_ENTRY_ICON("RW Attack" ,6,1,5060,12,"\ctab\img\titan\o_aircraft_rotary-wing_attack_red32.paa") 

Airdefense submenu:

CTAB_MENU_ENTRY_ICON("AAA"             ,1,1,5070,12,"\ctab\img\titan\o_air-defense_aaa_red32.paa")  
CTAB_MENU_ENTRY_ICON("SAM"             ,2,1,5071,12,"\ctab\img\titan\o_air-defense_sam_red32.paa")  
CTAB_MENU_ENTRY_ICON("Combined AAA/SAM",3,1,5072,12,"\ctab\img\titan\o_air-defense_aaa_sam_red32.paa")  
CTAB_MENU_ENTRY_ICON("Radar"           ,4,1,5073,12,"\ctab\img\titan\o_air-defense_radar_red32.paa")  

Armor submenu:

CTAB_MENU_ENTRY_ICON("Armor"              ,1,1,5080,12,"\ctab\img\titan\o_armored_armored_red32.paa")  
CTAB_MENU_ENTRY_ICON("Infantry Mechanized",2,1,5081,12,"\ctab\img\titan\o_armored_mechanized-infantry_red32.paa")  

Infantry submenu

CTAB_MENU_ENTRY_ICON("Single"            ,1,1,0,5010,"\ctab\img\menu\nope.paa") 
CTAB_MENU_ENTRY_ICON("Static"            ,2,1,0,5011,"\ctab\img\menu\nope.paa")         
CTAB_MENU_ENTRY_ICON("Infantry"          ,3,1,5090,12,"\ctab\img\titan\o_infantry_infantry_red32.paa")  
CTAB_MENU_ENTRY_ICON("Infantry Motorized",4,1,5091,12,"\ctab\img\titan\o_infantry_motorized-infantry_red32.paa")  

Infantry single submenu:

CTAB_MENU_ENTRY_ICON("Rifle" ,1,1,5092,13,"\ctab\img\titan\o_infantry_infantryman_rifle_red32.paa")
CTAB_MENU_ENTRY_ICON("Sniper",2,1,5096,13,"\ctab\img\titan\o_infantry_infantryman_sniper_red32.paa")  
CTAB_MENU_ENTRY_ICON("MG"    ,3,1,5093,13,"\ctab\img\titan\o_infantry_infantryman_machine-gunner_red32.paa")  
CTAB_MENU_ENTRY_ICON("AT"    ,4,1,5094,13,"\ctab\img\titan\o_infantry_infantryman_anti-tank_red32.paa")  
CTAB_MENU_ENTRY_ICON("Manpad",5,1,5095,13,"\ctab\img\titan\o_infantry_infantryman_manpad_red32.paa")  

Infantry static submenu:

CTAB_MENU_ENTRY_ICON("MG",1,1,5032,1,"\ctab\img\titan\o_static_machine-gunner_red32.paa")  
CTAB_MENU_ENTRY_ICON("AT",2,1,5030,1,"\ctab\img\titan\o_static_anti-tank_red32.paa") 
CTAB_MENU_ENTRY_ICON("GL",3,1,5031,1,"\ctab\img\titan\o_static_grenade-launcher_red32.paa")  

Misc submenu:

CTAB_MENU_ENTRY_ICON("Supply"      ,1,1,5040,12,"\ctab\img\titan\o_misc_supply_red32.paa")  
CTAB_MENU_ENTRY_ICON("Signal"      ,2,1,5041,12,"\ctab\img\titan\o_misc_signal_red32.paa")  
CTAB_MENU_ENTRY_ICON("UAV"         ,3,1,5042,12,"\ctab\img\titan\o_misc_uav_red32.paa")  
CTAB_MENU_ENTRY_ICON("Installation",4,1,5043,12,"\ctab\img\titan\o_misc_installation_red32.paa")  
CTAB_MENU_ENTRY_ICON("Naval"       ,5,1,5044,12,"\ctab\img\titan\o_misc_naval_red32.paa")  
DE-Schmitt commented 1 year ago

I forgot to mention some changes to the fnc_userMenuSelect.sqf like

_idcToShow = call {
if (_type == 11) exitWith {3301};
if (_type == 12) exitWith {3303}; // Singular, Team, Squad ... Size Selection Dialog
if (_type == 13) exitWith {3304}; // heading dialog
if (_type == 5006) exitWith {5006}; // "Infantry" sub menu 
if (_type == 5010) exitWith {5010}; // "Infantry Single" sub menu 
if (_type == 5011) exitWith {5011}; // "Infantry Static" sub menu 
if (_type == 5005) exitWith {5005}; // "Armored/Tracked" sub menu 
if (_type == 5001) exitWith {5001}; // "Artillery" sub menu 
if (_type == 5004) exitWith {5004}; // "Air Defense" sub menu  
if (_type == 5002) exitWith {5002}; // "Aircraft" sub menu 
if (_type == 5008) exitWith {5008}; // "Misc" sub menu 
if (_type == 21) exitWith {3305};
if (_type == 31) exitWith {3306};
if (_type == 100) exitWith {3308};
if (_type == 101) exitWith {3309};
if (_type == 102) exitWith {3310};
if (_type == 103) exitWith {3311};
_type;
};

and

// Hide all menu controls
{ctrlShow [_x,false];} count [3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3310,3311,5001,5002,5004,5005,5006,5008,5010,5011];
DE-Schmitt commented 1 year ago

Of course it would be great if you add those changes to your code. Then its easier for us to keep our ctab updated :-D

jetelain commented 1 year ago

Hi, thank you for additional icons.

It will also need some extra work to integrate with SIT/cTab IRL : finding corresponding APP 6D matching codes for the milsymbol library.

In fact I am studying a way to allow much more symbols, that's why I started using raw APP 6D codes (for image names only now, it's easy to combinate images from a code to get the symbol).

In order to keep things simple for users, I think I will add a system to allow mission makers to pick a selection of appropriate markers depending of enemy, and keep current list as a default.

jetelain commented 1 year ago

Note: In your fork, if your are interested in vehicle horizontal compass, you will probably have to change this line : https://github.com/jetelain/cTab/blob/326a51124263cee6125106f41cfd8bfb7fbe3ca7/%40cTab/addons/compass/functions/fnc_updateCompass.sqf#L74 change it to

if ( _markerIcon < 20 || _markerIcon > 5000  ) then {

Anyway, I may change it in the near future to display all markers due to users feedback (or at least have an option to choose which markers are displayed).

Schmitt-DE commented 1 year ago

When I integrate our custom icons (with Select1 values above 5000), the SIT web app show the icons but not the heading arrow and also not the size indicator. It gets transferred perfectly fine to the ArmA3 instance since I can see the heading arrows and size indicators for our custom icons just fine in game, even when sent by SIT web app. But the web app does not show heading arrow/size indicator. Any ideas? Is there something magic in the SIT code that says "do not show heading arrows for Select1 values above 5000" or something similiar?

new MenuItem
{
    Label = SharedResource.STR_ctab_core_ArmorMenu,
    Select1 = 5092, NextMenu = 12,
    Preview = "/img/titan/o_misc_naval_red64.png"
},
Schmitt-DE commented 1 year ago

The id does not seem to be relevant. I checked it with ids like "40" as well. Still does not work. I also tried to avoid any subdirectory for the images. Also no success.

Where is the code position where the heading indicator/group size indicator is actually drawn on the browser map?

jetelain commented 1 year ago

In fact the heading and group size is generated by the milsymbol library, browser side. In current implementation you cannot have size or heading with an image.

Schmitt-DE commented 1 year ago

Any idea for a workaround?

Schmitt-DE commented 1 year ago

OK, I kind of solved the problem by drawing two icons above each other. One standard icon including the direction arrow and size indicator. Above that another icon which shows the custom symbol.

Therefore I slightly changed one line of cTabIRL/cTabWebApp/Hub/CTabHub.cs into: Symbol = CTabMarkers.GetMilSymbol(iconA, iconB) + CTabMarkers.GetUnitSize(iconB),

And switched the function GetUnitSize(string iconB) to public instead of private.

The biggest change was needed in the cTabIRL/cTabWebApp/wwwroot/js/map.js file:

 // "10061000000000000000" Unknown Enemy Marker which is a simple empty red rhombus
        var unitSize = marker.symbol.substr(-2, 2);
        var unitSizeIcon = "10061000" + unitSize + "0000000000";

        var symOptions = { size: 24, additionalInformation: marker.name, strokeWidth: 6, outlineWidth: 3 };
        if (marker.kind == 'u' && marker.heading < 360) {
            symOptions.direction = marker.heading;
        }
        var sym = new ms.Symbol(unitSizeIcon, symOptions);

        var iconHtml = '<div style="background-image: url(\'' + sym.asCanvas(window.devicePixelRatio * 0.5).toDataURL() + '\');height: 128px;width:64px;background-repeat: no-repeat, no-repeat;background-position:2px 0px; "><img src="/img/' + marker.symbol.substr(4, marker.symbol.length - 6) + '" width="32" height="32" style="margin-left:0px;margin-top:4px;" />&nbsp;&nbsp;&nbsp;&nbsp;</div>';

The result is not perfect but ok.