DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ InitCuttent()

override void PPEMatClassParameterFloatSaturation::InitCuttent ( )
protected

См. определение в файле PPEMatClassParameterFloat.c строка 266

267{
268 protected ref map<int,ref array<float,int>> m_LayerInfo; //<priority,<value,operator>>
269
271 protected float m_ValueDefault;
272 protected float m_ValueMin;
273 protected float m_ValueMax;
274
275 void PPEMatClassParameterFloat(int mat_idx, int parameter_idx, PPEClassBase parent)
276 {
278 }
279
280 override void InitDefaults()
281 {
282 Class.CastTo(m_Float,m_Defaults);
283 //m_Float = PPETemplateDefFloat.Cast(m_Defaults);
284 m_ValueDefault = m_Float.param2;
285 m_ValueMin = m_Float.param3;
286 m_ValueMax = m_Float.param4;
287 }
288
289 override void InitCuttent()
290 {
291 m_CurrentValues = new Param1<float>(m_ValueDefault);
292 }
293
294 override int GetParameterVarType()
295 {
296 return PPEConstants.VAR_TYPE_FLOAT;
297 }
298
299 override void Update(float timeslice, out Param p_total, out bool setting_defaults, int order)
300 {
301 super.Update(timeslice,p_total,setting_defaults,order);
302
303 int active_request_count = 0;
304
306
307 bool setting_value_zero = false;
308
309 float float_value_temp = 0.0;
310 float float_value_default = 0.0;
311 float float_value_total = 0.0;
312
313 if (p_total == null)
314 {
315 p_total = new Param1<float>(0.0);
316 }
317
318 if (m_RequestMap.Count() > 0)
319 {
320 m_LayerInfo.Clear();
321 }
322 else
323 {
324 //DbgPrnt("m_RequestMap.Count() is zero! Using default values. | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
326 m_Parent.ParamUpdateRemove(m_ParameterIndex);
327 return;
328 }
329
330 for ( int i = 0; i < m_RequestMap.Count(); i++ )
331 {
332 req_data = PPERequestParamDataFloat.Cast(m_RequestMap.GetElement(i));
333
334 if (req_data == null)
335 {
336 Error("Debug | PPEMatClassParameterFloat | req_data not found! | " + this + " | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
337 continue;
338 }
339
340 setting_value_zero = req_data.IsSettingDefaultValues();
341
342 if (setting_value_zero && !req_data.GetUpdatingDataValues() && !req_data.IsDataActive())
343 {
344 //DbgPrnt("Is Default, not updating | idx: " + i + " | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
345 continue;
346 }
347
348 if (setting_value_zero)
349 {
350 req_data.m_FloatTarget = 0;//min;
351 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | !data.m_DefaultTargetSet | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | req_data.m_FloatTarget: " + req_data.m_FloatTarget);
352 }
353 else
354 {
355 active_request_count++;
356 }
357
358 //evaluation
359 //--------------------------------
360 req_data.m_FloatLast = req_data.m_FloatCurrent;
361
362 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive()) //set to exact value, not updating anymore
363 {
364 float_value_temp = req_data.m_FloatCurrent;
365 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
366 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | !req_data.m_UpdatingData | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | not updating, addaing current value into mix: " + float_value_temp);
367 continue;
368 }
369
370 float_value_temp = req_data.m_FloatTarget;
371
372 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
373 req_data.SetUpdatingDataValues(false);
374 if (setting_value_zero)
375 {
376 req_data.SetDataActive(false);
377 //RemovePriorityInfo(req_data.GetPriorityLayer()); //redundant?
378 }
379 else
380 {
381 float_value_temp = req_data.m_FloatTarget;
382 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
383 }
384
385 req_data.m_FloatCurrent = float_value_temp;
386 }
387
388 //---------------------------
389 //MASK handling and calculation
390 float value;
391 int operator;
392 bool override_active = false;
393
394 if ( m_ValueMax == 0.0 )
395 float_value_total = m_ValueDefault; //?
396 else
397 float_value_total = m_ValueDefault / m_ValueMax;
398
399 //float_value_total = Math.InverseLerp(m_ValueMin,m_ValueMax,m_ValueDefault);
400 float_value_default = float_value_total;
401
402 for ( i = 0; i < m_LayerInfo.Count(); i++ )
403 {
404 if ( override_active )
405 break;
406
407 value = m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_VALUE);
408 operator = m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_OPERATOR);
409
410 switch (operator)
411 {
412 case PPOperators.LOWEST:
413 float_value_total = Math.Min(float_value_total,value);
414 break;
415
416 case PPOperators.HIGHEST:
417 float_value_total = Math.Max(float_value_total,value);
418 break;
419
420 case PPOperators.ADD:
421 //float_value_total = float_value_total + value - float_value_default;
422 float_value_total = float_value_total + value;
423 break;
424
425 case PPOperators.ADD_RELATIVE:
426 float_value_total = (1 - float_value_total) * value + float_value_total;
427 break;
428
429 case PPOperators.SUBSTRACT:
430 //float_value_total = float_value_total - value + float_value_default;
431 float_value_total = float_value_total - value;
432 break;
433
434 case PPOperators.SUBSTRACT_RELATIVE:
435 float_value_total = float_value_total - value * float_value_total;
436 break;
437
438 case PPOperators.SUBSTRACT_REVERSE:
439 //float_value_total = value - float_value_default - float_value_total;
440 float_value_total = value - float_value_total;
441 break;
442
443 case PPOperators.SUBSTRACT_REVERSE_RELATIVE:
444 float_value_total = value * float_value_total - float_value_total;
445 break;
446
447 case PPOperators.MULTIPLICATIVE:
448 //float_value_total = Math.Lerp(float_value_default, float_value_total, value);
449 float_value_total = float_value_total * value;
450 break;
451
452 case PPOperators.OVERRIDE:
453 float_value_total = value;
454 break;
455
456 case PPOperators.SET:
457 float_value_total = value;
458 break;
459 }
460
461 //DbgPrnt("m_LayerInfo | float_value_total pre-clamp: " + float_value_total + " | i: " + i);
462 float_value_total = Math.Clamp(float_value_total,0,1);
463
464 if ( operator == PPOperators.OVERRIDE )
465 {
466 //DbgPrnt("m_LayerInfo | PPOperators.OVERRIDE at: " + i);
467 override_active = true;
468 }
469
470 //RemovePriorityInfo(m_CommandLayersArray.Get(i));
471 }
472
473 m_CommandLayersArray.Clear();
474
475 //TODO - consider moving this up, if possible
476 if (active_request_count == 0)
477 {
479 }
480 else
481 {
482 float res = Math.Lerp(m_ValueMin,m_ValueMax,float_value_total);
483 Param1<float>.Cast(p_total).param1 = res; //converts back to absolute values
484 }
485
486 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | parameter update end, removing from queue");
487 m_Parent.ParamUpdateRemove(m_ParameterIndex);
488
489 m_CurrentValues = p_total;
490 }
491
492 void PrepareLayerInfo(int layer, float value, int operator)
493 {
494 m_LayerInfo.Set(layer,{value,operator});
495 AddPriorityInfo(layer);
496 }
497
499 override void SetParameterValueDefault(inout Param p_total)
500 {
501 p_total = new Param1<float>(PPETemplateDefFloat.Cast(m_Defaults).param2);
502 m_CurrentValues = p_total;
503 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | exit 3 - zero value");
504 }
505}
506
508{
509 void PPEMatClassParameterFloatSaturation(int mat_idx, int parameter_idx, PPEClassBase parent)
510 {
511 m_Dependencies = new map<int,ref array<int>>;
512 m_Dependencies.Set(PostProcessEffectType.Glow,{PPEGlow.PARAM_COLORIZATIONCOLOR, PPEGlow.PARAM_OVERLAYCOLOR});
513 }
514}
map
Определения ControlsXboxNew.c:4
PPOperators
PP operators, specify operation between subsequent layers.
Определения PPEConstants.c:53
Param4< string, float, float, float > PPETemplateDefFloat
Определения PPEConstants.c:87
ref map< int, ref ColorValuesData > m_LayerInfo
Определения PPEMatClassParameterColor.c:44
override void SetParameterValueDefault(inout Param p_total)
No active requests for the mat. parameter value change, sets the value to DEFAULT (zero?...
Определения PPEMatClassParameterFloat.c:476
class PPEMatClassParameterFloat extends PPEMatClassParameterCommandData PPEMatClassParameterFloatSaturation(int mat_idx, int parameter_idx, PPEClassBase parent)
Определения PPEMatClassParameterFloat.c:244
override void InitCuttent()
Определения PPEMatClassParameterFloat.c:266
override int GetParameterVarType()
Определения PPEMatClassParameterFloat.c:271
void PPEMatClassParameterFloat(int mat_idx, int parameter_idx, PPEClassBase parent)
Определения PPEMatClassParameterFloat.c:252
float m_ValueMax
Определения PPEMatClassParameterFloat.c:250
float m_ValueMin
Определения PPEMatClassParameterFloat.c:249
void PrepareLayerInfo(int layer, float value, int operator)
Определения PPEMatClassParameterFloat.c:469
float m_ValueDefault
Определения PPEMatClassParameterFloat.c:248
PPETemplateDefFloat m_Float
Определения PPEMatClassParameterFloat.c:247
override void InitDefaults()
Определения PPEMatClassParameterFloat.c:257
void PPERequestParamDataFloat(int requester_idx, int mat_id, int param_id, int data_type=0, int priority=0, int mask=PPOperators.SET, bool relative=false)
Определения PPERequestData.c:142
Widget m_Parent
Определения SizeToChild.c:92
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения EnMath.c:7
Created once, on manager init. Script-side representation of C++ material class, separate handling.
Определения PPEMatClassesBase.c:3
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
PostProcessEffectType
Post-process effect type.
Определения EnWorld.c:72
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
proto native volatile void Update()
Определения PlayerSoundManager.c:125