Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

photoshoot: helmets, unsupported #867

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified arma/hemtt_comm_x64.dll
Binary file not shown.
11 changes: 11 additions & 0 deletions arma/src/photoshoot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub fn group() -> Group {
Group::new()
.command("ready", ready)
.command("weapon", weapon)
.command("weapon_unsupported", weapon_unsupported)
.command("previews", previews)
}

Expand All @@ -26,6 +27,16 @@ fn weapon(ctx: Context, weapon: String) {
.unwrap();
}

fn weapon_unsupported(ctx: Context, weapon: String) {
let Some(sender) = ctx.global().get::<std::sync::mpsc::Sender<Message>>() else {
println!("`photoshoot:weapon_unsupported` called without a sender");
return;
};
sender
.send(Message::Photoshoot(Photoshoot::WeaponUnsupported(weapon)))
.unwrap();
}

fn previews(ctx: Context) {
let Some(sender) = ctx.global().get::<std::sync::mpsc::Sender<Message>>() else {
println!("`photoshoot:previews` called without a sender");
Expand Down
Binary file modified bin/dist/profile/@hemtt/hemtt_comm_x64.dll
Binary file not shown.
35 changes: 35 additions & 0 deletions bin/dist/profile/autotest/photoshoot.VR/functions/fnc_firearm.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
params [
["_class", "", [""]],
["_pistol", false, [false]]
];

if (_class == "") exitWith {};

if (isNil "ps_cam") then {
ps_cam = "camera" camCreate [0,0,0];
};

private _pos = getPos item_position;

private _holder = createVehicle ["groundweaponholder",_pos,[],0,"none"];
_holder setPos _pos;
_holder addWeaponCargo [_class,1];
_holder setVectorDirAndUp [[0,0,1],[1,0,0]];

private _fov = if (_pistol) then {0.3} else {0.7};
private _campos = [_pos,0.5,90] call bis_fnc_relpos;
_campos set [2,_pos#2 + 0.5];
ps_cam camSetPos _campos;
ps_cam camSetFov _fov;
ps_cam camSetTarget [_pos#0,_pos#1,_pos#2 + 0.57];
ps_cam camCommit 0;

sleep 0.5;

screenshot format ["%1.png", _class];
sleep 0.3;
"hemtt_comm" callExtension ["photoshoot:weapon", [_class]];

deleteVehicle _holder;

sleep 0.1;
34 changes: 34 additions & 0 deletions bin/dist/profile/autotest/photoshoot.VR/functions/fnc_headgear.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
params [
["_class", "", [""]]
];

if (_class == "") exitWith {};

if (isNil "ps_cam") then {
ps_cam = "camera" camCreate [0,0,0];
};

private _pos = getPos item_position;

private _holder = createVehicle ["groundweaponholder",_pos,[],0,"none"];
_holder setPos _pos;
_holder addWeaponCargo [_class,1];
_holder setVectorDirAndUp [[0,0,1],[0,-1,0]];

private _campos = [_pos, 2.5, 20] call bis_fnc_relpos;
_campos set [2,_pos#2 + 2.5];
ps_cam cameraEffect ["INTERNAL", "BACK"];
ps_cam camSetPos _campos;
ps_cam camSetFov 0.1;
ps_cam camSetTarget [_pos#0,_pos#1 + 0.425,_pos#2 + 1.3];
ps_cam camCommit 0;

sleep 0.5;

screenshot format ["%1.png", _class];
sleep 0.3;
"hemtt_comm" callExtension ["photoshoot:weapon", [_class]];

deleteVehicle _holder;

sleep 0.1;
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ps_cam camSetDir vectorDir camera_uniform;
ps_cam camSetPos getPos camera_uniform;
hideObject camera_uniform;
ps_cam camCommit 0;
model_clothing hideObject false;

sleep 0.1;

Expand All @@ -22,4 +23,5 @@ model_clothing setFace "HEMTTPhotoshoot";
waitUntil { 10 preloadObject model_clothing };
screenshot format ["%1.png", _uniform];
sleep 0.3;
model_clothing hideObject true;
"hemtt_comm" callExtension ["photoshoot:weapon", [_uniform]];
71 changes: 64 additions & 7 deletions bin/dist/profile/autotest/photoshoot.VR/init.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ps_preview = [];

ps_fnc_uniform = compile preprocessFileLineNumbers "functions\fnc_uniforms.sqf";
ps_fnc_uniform = compile preprocessFileLineNumbers "functions\fnc_uniform.sqf";
ps_fnc_firearm = compile preprocessFileLineNumbers "functions\fnc_firearm.sqf";
ps_fnc_headgear = compile preprocessFileLineNumbers "functions\fnc_headgear.sqf";

addMissionEventHandler ["ExtensionCallback", {
params ["_name", "_function", "_data"];
Expand All @@ -25,18 +27,66 @@ addMissionEventHandler ["ExtensionCallback", {
case "weapon_add": {
diag_log format ["Weapon: %1", _data];
"hemtt_comm" callExtension ["log", ["debug", format ["Checking Weapon: %1", _data]]];
private _allowedSlots = getArray (configFile >> "CfgWeapons" >> _data >> "allowedSlots") select 0;
"hemtt_comm" callExtension ["log", ["debug", format ["Allowed Slots: %1", _allowedSlots]]];
switch (_allowedSlots) do {
case 901: {
private _type = getNumber (configFile >> "CfgWeapons" >> _data >> "ItemInfo" >> "type");
"hemtt_comm" callExtension ["log", ["debug", format ["Type: %1", _type]]];
switch (_type) do {
// case 1: {
// // Primary
// "hemtt_comm" callExtension ["log", ["debug", format ["Primary: %1", _data]]];
// [_data] spawn ps_fnc_firearm;
// };
// case 2: {
// // Handgun
// "hemtt_comm" callExtension ["log", ["debug", format ["Handgun: %1", _data]]];
// [_data, true] spawn ps_fnc_firearm;
// };
// case 3: {
// // Secondary
// "hemtt_comm" callExtension ["log", ["debug", format ["Secondary: %1", _data]]];
// [_data] spawn ps_fnc_firearm;
// };
// case 101: {
// // Muzzle
// "hemtt_comm" callExtension ["log", ["debug", format ["Muzzle: %1", _data]]];
// [_data] spawn ps_fnc_muzzle;
// };
// case 201: {
// // Optic
// "hemtt_comm" callExtension ["log", ["debug", format ["Optic: %1", _data]]];
// [_data] spawn ps_fnc_optic;
// };
// case 301: {
// // Flashlight
// "hemtt_comm" callExtension ["log", ["debug", format ["Flashlight: %1", _data]]];
// [_data] spawn ps_fnc_flashlight;
// };
// case 602: {
// // NVG
// "hemtt_comm" callExtension ["log", ["debug", format ["NVG: %1", _data]]];
// [_data] spawn ps_fnc_nvg;
// };
case 605: {
// Headgear
"hemtt_comm" callExtension ["log", ["debug", format ["Headgear: %1", _data]]];
[_data] spawn ps_fnc_headgear;
};
// case 701: {
// // Vest
// "hemtt_comm" callExtension ["log", ["debug", format ["Vest: %1", _data]]];
// [_data] spawn ps_fnc_vest;
// };
case 801: {
// Uniform
"hemtt_comm" callExtension ["log", ["debug", format ["Uniform: %1", _data]]];
[_data] spawn ps_fnc_uniform;
};
// case 901: {
// // Backpack
// "hemtt_comm" callExtension ["log", ["debug", format ["Backpack: %1", _data]]];
// [_data] spawn ps_fnc_backpack;
// };
default {
// unsupported
"hemtt_comm" callExtension ["log", ["warn", format ["Unsupported: %1", _data]]];
diag_log format ["Unsupported: %1", _data];
"hemtt_comm" callExtension ["photoshoot:weapon_unsupported", [_data]];
};
};
Expand All @@ -52,9 +102,16 @@ addMissionEventHandler ["ExtensionCallback", {
};
}];

showCinemaBorder false;

0 spawn {
// it fades in
sleep 1;
diag_log "Photoshoot: Ready";
diag_log format ["response: %1", "hemtt_comm" callExtension ["photoshoot:ready", []]];

if (isNil "ps_cam") then {
ps_cam = "camera" camCreate [0,0,0];
showCinemaBorder false;
};
};
Loading
Loading