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

◆ GetParameterVarType()

override int PPEMatClassParameterFloatSaturation::GetParameterVarType ( )
protected

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

272{
273 protected ref map<int,ref array<float,int>> m_LayerInfo; //<priority,<value,operator>>
274
276 protected float m_ValueDefault;
277 protected float m_ValueMin;
278 protected float m_ValueMax;
279
280 void PPEMatClassParameterFloat(int mat_idx, int parameter_idx, PPEClassBase parent)
281 {
283 }
284
285 override void InitDefaults()
286 {
287 Class.CastTo(m_Float,m_Defaults);
288 //m_Float = PPETemplateDefFloat.Cast(m_Defaults);
289 m_ValueDefault = m_Float.param2;
290 m_ValueMin = m_Float.param3;
291 m_ValueMax = m_Float.param4;
292 }
293
294 override void InitCuttent()
295 {
296 m_CurrentValues = new Param1<float>(m_ValueDefault);
297 }
298
299 override int GetParameterVarType()
300 {
301 return PPEConstants.VAR_TYPE_FLOAT;
302 }
303
304 override void Update(float timeslice, out Param p_total, out bool setting_defaults, int order)
305 {
306 super.Update(timeslice,p_total,setting_defaults,order);
307
308 int active_request_count = 0;
309
311
312 bool setting_value_zero = false;
313
314 float float_value_temp = 0.0;
315 float float_value_default = 0.0;
316 float float_value_total = 0.0;
317
318 if (p_total == null)
319 {
320 p_total = new Param1<float>(0.0);
321 }
322
323 if (m_RequestMap.Count() > 0)
324 {
325 m_LayerInfo.Clear();
326 }
327 else
328 {
329 //DbgPrnt("m_RequestMap.Count() is zero! Using default values. | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
331 m_Parent.ParamUpdateRemove(m_ParameterIndex);
332 return;
333 }
334
335 for ( int i = 0; i < m_RequestMap.Count(); i++ )
336 {
337 req_data = PPERequestParamDataFloat.Cast(m_RequestMap.GetElement(i));
338
339 if (req_data == null)
340 {
341 Error("Debug | PPEMatClassParameterFloat | req_data not found! | " + this + " | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
342 continue;
343 }
344
345 setting_value_zero = req_data.IsSettingDefaultValues();
346
347 if (setting_value_zero && !req_data.GetUpdatingDataValues() && !req_data.IsDataActive())
348 {
349 //DbgPrnt("Is Default, not updating | idx: " + i + " | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
350 continue;
351 }
352
353 if (setting_value_zero)
354 {
355 req_data.m_FloatTarget = 0;//min;
356 //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);
357 }
358 else
359 {
360 active_request_count++;
361 }
362
363 //evaluation
364 //--------------------------------
365 req_data.m_FloatLast = req_data.m_FloatCurrent;
366
367 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive()) //set to exact value, not updating anymore
368 {
369 float_value_temp = req_data.m_FloatCurrent;
370 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
371 //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);
372 continue;
373 }
374
375 float_value_temp = req_data.m_FloatTarget;
376
377 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
378 req_data.SetUpdatingDataValues(false);
379 if (setting_value_zero)
380 {
381 req_data.SetDataActive(false);
382 //RemovePriorityInfo(req_data.GetPriorityLayer()); //redundant?
383 }
384 else
385 {
386 float_value_temp = req_data.m_FloatTarget;
387 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
388 }
389
390 req_data.m_FloatCurrent = float_value_temp;
391 }
392
393 //---------------------------
394 //MASK handling and calculation
395 float value;
396 int operator;
397 bool override_active = false;
398
399 if ( m_ValueMax == 0.0 )
400 float_value_total = m_ValueDefault; //?
401 else
402 float_value_total = m_ValueDefault / m_ValueMax;
403
404 //float_value_total = Math.InverseLerp(m_ValueMin,m_ValueMax,m_ValueDefault);
405 float_value_default = float_value_total;
406
407 for ( i = 0; i < m_LayerInfo.Count(); i++ )
408 {
409 if ( override_active )
410 break;
411
412 value = m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_VALUE);
413 operator = m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_OPERATOR);
414
415 switch (operator)
416 {
417 case PPOperators.LOWEST:
418 float_value_total = Math.Min(float_value_total,value);
419 break;
420
421 case PPOperators.HIGHEST:
422 float_value_total = Math.Max(float_value_total,value);
423 break;
424
425 case PPOperators.ADD:
426 //float_value_total = float_value_total + value - float_value_default;
427 float_value_total = float_value_total + value;
428 break;
429
430 case PPOperators.ADD_RELATIVE:
431 float_value_total = (1 - float_value_total) * value + float_value_total;
432 break;
433
434 case PPOperators.SUBSTRACT:
435 //float_value_total = float_value_total - value + float_value_default;
436 float_value_total = float_value_total - value;
437 break;
438
439 case PPOperators.SUBSTRACT_RELATIVE:
440 float_value_total = float_value_total - value * float_value_total;
441 break;
442
443 case PPOperators.SUBSTRACT_REVERSE:
444 //float_value_total = value - float_value_default - float_value_total;
445 float_value_total = value - float_value_total;
446 break;
447
448 case PPOperators.SUBSTRACT_REVERSE_RELATIVE:
449 float_value_total = value * float_value_total - float_value_total;
450 break;
451
452 case PPOperators.MULTIPLICATIVE:
453 //float_value_total = Math.Lerp(float_value_default, float_value_total, value);
454 float_value_total = float_value_total * value;
455 break;
456
457 case PPOperators.OVERRIDE:
458 float_value_total = value;
459 break;
460
461 case PPOperators.SET:
462 float_value_total = value;
463 break;
464 }
465
466 //DbgPrnt("m_LayerInfo | float_value_total pre-clamp: " + float_value_total + " | i: " + i);
467 float_value_total = Math.Clamp(float_value_total,0,1);
468
469 if ( operator == PPOperators.OVERRIDE )
470 {
471 //DbgPrnt("m_LayerInfo | PPOperators.OVERRIDE at: " + i);
472 override_active = true;
473 }
474
475 //RemovePriorityInfo(m_CommandLayersArray.Get(i));
476 }
477
478 m_CommandLayersArray.Clear();
479
480 //TODO - consider moving this up, if possible
481 if (active_request_count == 0)
482 {
484 }
485 else
486 {
487 float res = Math.Lerp(m_ValueMin,m_ValueMax,float_value_total);
488 Param1<float>.Cast(p_total).param1 = res; //converts back to absolute values
489 }
490
491 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | parameter update end, removing from queue");
492 m_Parent.ParamUpdateRemove(m_ParameterIndex);
493
494 m_CurrentValues = p_total;
495 }
496
497 void PrepareLayerInfo(int layer, float value, int operator)
498 {
499 m_LayerInfo.Set(layer,{value,operator});
500 AddPriorityInfo(layer);
501 }
502
504 override void SetParameterValueDefault(inout Param p_total)
505 {
506 p_total = new Param1<float>(PPETemplateDefFloat.Cast(m_Defaults).param2);
507 m_CurrentValues = p_total;
508 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | exit 3 - zero value");
509 }
510}
511
513{
514 void PPEMatClassParameterFloatSaturation(int mat_idx, int parameter_idx, PPEClassBase parent)
515 {
516 m_Dependencies = new map<int,ref array<int>>;
517 m_Dependencies.Set(PostProcessEffectType.Glow,{PPEGlow.PARAM_COLORIZATIONCOLOR, PPEGlow.PARAM_OVERLAYCOLOR});
518 }
519}
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