OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ValueProviderAbsX Class Reference

#include <C4MeshAnimation.h>

Inheritance diagram for C4ValueProviderAbsX:
[legend]
Collaboration diagram for C4ValueProviderAbsX:
[legend]

Public Member Functions

 C4ValueProviderAbsX ()
 
 C4ValueProviderAbsX (C4Object *object, C4Real pos, C4Real begin, C4Real end, int32_t length)
 
virtual bool Execute ()
 
virtual void CompileFunc (StdCompiler *pComp)
 
virtual void DenumeratePointers ()
 
virtual void ClearPointers (C4Object *pObj)
 

Static Public Member Functions

static const IDBaseLookup (const char *name)
 
static const IDBaseLookup (const std::type_info &type)
 

Public Attributes

C4Real Value
 

Detailed Description

Definition at line 130 of file C4MeshAnimation.h.

Constructor & Destructor Documentation

C4ValueProviderAbsX::C4ValueProviderAbsX ( )
inline

Definition at line 133 of file C4MeshAnimation.h.

133 : Object(nullptr), Begin(Fix0), End(Fix0), Length(0) {}
const C4Real Fix0
Definition: C4Real.h:312
C4ValueProviderAbsX::C4ValueProviderAbsX ( C4Object object,
C4Real  pos,
C4Real  begin,
C4Real  end,
int32_t  length 
)

Definition at line 333 of file C4MeshAnimation.cpp.

References StdMeshInstanceValueProvider::Value.

333  :
334  Object(object), Begin(begin), End(end), Length(length)
335 {
336  Value = pos;
337 }

Member Function Documentation

virtual void C4ValueProviderAbsX::ClearPointers ( C4Object pObj)
inlinevirtual

Reimplemented from StdMeshInstance::SerializableValueProvider.

Definition at line 139 of file C4MeshAnimation.h.

139 { if(Object == pObj) Object = nullptr; }
void C4ValueProviderAbsX::CompileFunc ( StdCompiler pComp)
virtual

Reimplemented from StdMeshInstance::SerializableValueProvider.

Definition at line 361 of file C4MeshAnimation.cpp.

References CompileFunc(), C4MenuItem::Object, StdCompiler::Separator(), and StdCompiler::Value().

362 {
364  pComp->Separator();
365  pComp->Value(Object);
366  pComp->Separator();
367  pComp->Value(Begin);
368  pComp->Separator();
369  pComp->Value(End);
370  pComp->Separator();
371  pComp->Value(Length);
372 }
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:129
void Value(const T &rStruct)
Definition: StdCompiler.h:171
void CompileFunc(C4Real &rValue, StdCompiler *pComp)
Definition: C4Real.cpp:9033

Here is the call graph for this function:

virtual void C4ValueProviderAbsX::DenumeratePointers ( )
inlinevirtual

Reimplemented from StdMeshInstance::SerializableValueProvider.

Definition at line 138 of file C4MeshAnimation.h.

References C4ObjectPtr::DenumeratePointers().

138 { Object.DenumeratePointers(); }
void DenumeratePointers()
Definition: C4ObjectPtr.cpp:46

Here is the call graph for this function:

bool C4ValueProviderAbsX::Execute ( )
virtual

Implements StdMeshInstanceValueProvider.

Definition at line 339 of file C4MeshAnimation.cpp.

References Abs(), Distance(), fixtoi(), itofix(), C4MenuItem::Object, StdMeshInstanceValueProvider::Value, C4Object::xdir, and C4Object::ydir.

340 {
341  // Object might have been removed
342  if(!Object) return false;
343 
344  C4Real dist;
345  if(Object->xdir > itofix(100) || Object->ydir > itofix(100))
346  dist = itofix(Distance(0, 0, fixtoi(Object->xdir), fixtoi(Object->ydir)));
347  else if(Object->xdir > itofix(1) || Object->ydir > itofix(1))
348  dist = itofix(Distance(0, 0, fixtoi(Object->xdir, 256), fixtoi(Object->ydir, 256)), 16);
349  else
350  dist = itofix(Distance(0, 0, fixtoi(Object->xdir, 16384), fixtoi(Object->ydir, 16384)), 128);
351 
352  Value += (End - Begin) * Abs(Object->xdir) / Length;
353 
354  assert( (End >= Begin && Value >= Begin) || (End <= Begin && Value <= Begin));
355  while ( (End > Begin && Value > End) || (End < Begin && Value < End))
356  Value -= (End - Begin);
357 
358  return true;
359 }
Definition: C4Real.h:58
int32_t Distance(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2)
Definition: Standard.cpp:24
C4Fixed itofix(int32_t x)
Definition: C4Real.h:261
T Abs(T val)
Definition: Standard.h:44
int fixtoi(const C4Fixed &x)
Definition: C4Real.h:259
C4Real xdir
Definition: C4Object.h:126
C4Real ydir
Definition: C4Object.h:126

Here is the call graph for this function:

static const IDBase* StdMeshInstance::SerializableValueProvider::Lookup ( const char *  name)
inlinestaticinherited

Definition at line 462 of file StdMesh.h.

463  {
464  if(!IDs) return nullptr;
465  for(unsigned int i = 0; i < IDs->size(); ++i)
466  if(strcmp((*IDs)[i]->name, name) == 0)
467  return (*IDs)[i];
468  return nullptr;
469  }
static const IDBase* StdMeshInstance::SerializableValueProvider::Lookup ( const std::type_info &  type)
inlinestaticinherited

Definition at line 471 of file StdMesh.h.

472  {
473  if(!IDs) return nullptr;
474  for(unsigned int i = 0; i < IDs->size(); ++i)
475  if((*IDs)[i]->type == type)
476  return (*IDs)[i];
477  return nullptr;
478  }

Member Data Documentation


The documentation for this class was generated from the following files: