-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaddNewCharacterFG.bio2s
111 lines (98 loc) · 2.47 KB
/
addNewCharacterFG.bio2s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//#include "std\paramFile.inc"
#include "std\lodNames.inc"
console = openStandardIO;
_log = "p:\log.txt";
_wrnlog = "p:\wrn.txt";
shellCmd ("CMD /C DEL /Q "+_log+" 2>nul");
shellCmd ("CMD /C DEL /Q "+_wrnlog+" 2>nul");
f_main =
{
_fail = false;
_changed = false;
if (typename _this=="STRING") then
{
p3d = newLODObject;
p3dname =_this;
_fail = !(p3d loadP3d p3dname);
if (_fail) then { console<<"Unable to open:"<<p3dname<<eoln;};
runFromO2 = false;
texpath = ((splitPath p3dname) @ 0);
}
else
{
p3dname = nameof _this;
p3dname = splitPath p3dname;
p3dname = p3dname @ 2 + p3dname @ 3;
runFromO2 = true;
p3d = _this;
};
if (!_fail) then
{
console<<"----------------------------------------------------------------------"<<eoln;
console<<"Checking file: "<<p3dname<<eoln;
objects = getObjects p3d;
resols = getResolutions p3d;
_hasView = false;
_hasFire = false;
for "_i" from 0 to (count p3d-1) do
{
private ["_obj","_resol","_isol","_numsect","_degen"];
_resol = resols @ _i;
_obj = objects @ _i;
if (_resol<LOD_EDIT_MIN || _resol>=LOD_EDIT_MAX) then
{
#define CHECK_FIRE_AND_VIEW true
if (CHECK_FIRE_AND_VIEW and LOD_VIEWGEO==_resol) then
{
_hasView = true;
};
if (CHECK_FIRE_AND_VIEW and LOD_FIREGEO==_resol) then
{
_hasFire = true;
};
};
};
if (_hasFire and not _hasView) then
{
// Rename existing firegeometry to view geoemtry
p3d setActiveSpecial LOD_FIREGEO;
p3d setResolution LOD_VIEWGEO;
// Add new firegeometry
_level = addLevel p3d;
p3d setResolution LOD_FIREGEO;
console<<"Fire geom renamed to View geom"<<eoln;
// Load new fire geometry template
p3d_newFG = newLODObject;
_fail2 = !(p3d_newFG loadP3d "J:\Arma\NewFireGeometryTemplate.p3d");
if (_fail2) then { console<<"Unable to open:"<<p3dname<<eoln;};
// Copy fire geometry from template to our new fire geo level
_level mergeObject ((getObjects p3d_newFG) @ 13);
_changed = true;
};
if (_changed and !runFromO2) then
{
if (!save p3d)then {console <<"unable to SAVE "<<p3dname<<eoln;};
};
};
};
if (typename this=="STRING") then
{
_filename = this;
if (_filename@((count _filename) - 1)=="\") then
{
_stream = shellCmdOpenPipe ("CMD /C for /r "+_filename+" %i in (*.p3d)do @ECHO %i");
while {! eof _stream} do
{
(getline _stream) call f_main;
};
shellCmd("CMD /C pause");
}
else
{
_filename call f_main;
}
}
else
{
this call f_main;
};