本文整理汇总了C++中C4PropList::GetPropertyInt方法的典型用法代码示例。如果您正苦于以下问题:C++ C4PropList::GetPropertyInt方法的具体用法?C++ C4PropList::GetPropertyInt怎么用?C++ C4PropList::GetPropertyInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C4PropList
的用法示例。
在下文中一共展示了C4PropList::GetPropertyInt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ObjectComJump
bool ObjectComJump(C4Object *cObj) // by ObjectComUp, ExecCMDFMoveTo, FnJump
{
// Only if walking
if (cObj->GetProcedure()!=DFA_WALK) return false;
// Calculate direction & forces
C4Real TXDir=Fix0;
C4PropList *pActionWalk = cObj->GetAction();
C4Real iPhysicalWalk = C4REAL100(pActionWalk->GetPropertyInt(P_Speed)) * itofix(cObj->GetCon(), FullCon);
C4Real iPhysicalJump = C4REAL100(cObj->GetPropertyInt(P_JumpSpeed)) * itofix(cObj->GetCon(), FullCon);
if (cObj->Action.ComDir==COMD_Left || cObj->Action.ComDir==COMD_UpLeft) TXDir=-iPhysicalWalk;
else if (cObj->Action.ComDir==COMD_Right || cObj->Action.ComDir==COMD_UpRight) TXDir=+iPhysicalWalk;
C4Real x = cObj->fix_x, y = cObj->fix_y;
// find bottom-most vertex, correct starting position for simulation
int32_t iBtmVtx = cObj->Shape.GetBottomVertex();
if (iBtmVtx != -1) {
x += cObj->Shape.GetVertexX(iBtmVtx);
y += cObj->Shape.GetVertexY(iBtmVtx);
}
// Try dive
if (cObj->Shape.ContactDensity > C4M_Liquid)
if (SimFlightHitsLiquid(x,y,TXDir,-iPhysicalJump))
if (ObjectActionDive(cObj,TXDir,-iPhysicalJump))
return true;
// Regular jump
return ObjectActionJump(cObj,TXDir,-iPhysicalJump,true);
}
示例2: itofix
bool C4ValueProviderAction::Execute()
{
// Object might have been removed
if(!Object) return false;
const C4Action& Action = Object->Action;
C4PropList* pActionDef = Object->GetAction();
// TODO: We could cache these...
const StdMeshAnimation* animation = Action.Animation->GetAnimation();
const int32_t length = pActionDef->GetPropertyInt(P_Length);
const int32_t delay = pActionDef->GetPropertyInt(P_Delay);
if (delay)
Value = itofix(Action.Phase * delay + Action.PhaseDelay) * ftofix(animation->Length) / (delay * length);
else
Value = itofix(Action.Phase) * ftofix(animation->Length) / length;
return true;
}
示例3: if
void C4GraphicsOverlay::UpdateFacet()
{
// special: Nothing to update for object and pSourceGfx may be NULL
// If there will ever be something to init here, UpdateFacet() will also need to be called when objects have been loaded
if (eMode == MODE_Object) return;
// otherwise, source graphics must be specified
if (!pSourceGfx) return;
C4Def *pDef = pSourceGfx->pDef;
assert(pDef);
fZoomToShape = false;
// Clear old mesh instance, if any
delete pMeshInstance; pMeshInstance = NULL;
// update by mode
switch (eMode)
{
case MODE_None:
break;
case MODE_Base: // def base graphics
if (pSourceGfx->Type == C4DefGraphics::TYPE_Bitmap)
fctBlit.Set(pSourceGfx->GetBitmap(), 0, 0, pDef->Shape.Wdt, pDef->Shape.Hgt, pDef->Shape.x+pDef->Shape.Wdt/2, pDef->Shape.y+pDef->Shape.Hgt/2);
else if (pSourceGfx->Type == C4DefGraphics::TYPE_Mesh)
pMeshInstance = new StdMeshInstance(*pSourceGfx->Mesh, 1.0f);
break;
case MODE_Action: // graphics of specified action
{
// Clear old facet
fctBlit.Default();
// Ensure there is actually an action set
if (!Action[0])
return;
C4Value v;
pDef->GetProperty(P_ActMap, &v);
C4PropList *actmap = v.getPropList();
if (!actmap)
return;
actmap->GetPropertyByS(::Strings.RegString(Action), &v);
C4PropList *action = v.getPropList();
if (!action)
return;
if (pSourceGfx->Type == C4DefGraphics::TYPE_Bitmap)
{
fctBlit.Set(pSourceGfx->GetBitmap(),
action->GetPropertyInt(P_X), action->GetPropertyInt(P_Y),
action->GetPropertyInt(P_Wdt), action->GetPropertyInt(P_Hgt));
// FIXME: fctBlit.TargetX has to be set here
}
else if (pSourceGfx->Type == C4DefGraphics::TYPE_Mesh)
{
C4String* AnimationName = action->GetPropertyStr(P_Animation);
if (!AnimationName) return;
pMeshInstance = new StdMeshInstance(*pSourceGfx->Mesh, 1.0f);
const StdMeshAnimation* Animation = pSourceGfx->Mesh->GetSkeleton().GetAnimationByName(AnimationName->GetData());
if (!Animation) return;
pMeshInstance->PlayAnimation(*Animation, 0, NULL, new C4ValueProviderRef<int32_t>(iPhase, ftofix(Animation->Length / action->GetPropertyInt(P_Length))), new C4ValueProviderConst(itofix(1)), true);
}
break;
}
case MODE_ObjectPicture: // ingame picture of object
// calculated at runtime
break;
case MODE_IngamePicture:
case MODE_Picture: // def picture
fZoomToShape = true;
// drawn at runtime
break;
case MODE_ExtraGraphics: // like ColorByOwner-sfc
// calculated at runtime
break;
case MODE_Rank:
// drawn at runtime
break;
case MODE_Object:
// TODO
break;
}
}
示例4: oldxdir
void C4Object::DoMovement()
{
int32_t iContact=0;
bool fAnyContact=false; int iContacts = 0;
BYTE fTurned=0,fRedirectYR=0,fNoAttach=0;
// Restrictions
if (Def->NoHorizontalMove) xdir=0;
// Dig free target area
C4PropList* pActionDef = GetAction();
if (pActionDef)
if (pActionDef->GetPropertyInt(P_DigFree))
{
int ctcox, ctcoy;
// Shape size square
if (pActionDef->GetPropertyInt(P_DigFree)==1)
{
ctcox=fixtoi(fix_x+xdir); ctcoy=fixtoi(fix_y+ydir);
::Landscape.DigFreeRect(ctcox+Shape.GetX(),ctcoy+Shape.GetY(),Shape.Wdt,Shape.Hgt,this);
}
// Free size round (variable size)
else
{
ctcox=fixtoi(fix_x+xdir); ctcoy=fixtoi(fix_y+ydir);
int32_t rad = pActionDef->GetPropertyInt(P_DigFree);
if (Con<FullCon) rad = rad*6*Con/5/FullCon;
::Landscape.DigFree(ctcox,ctcoy-1,rad,this);
}
}
// store previous movement and ocf
C4Real oldxdir(xdir), oldydir(ydir);
uint32_t old_ocf = OCF;
bool fMoved = false;
C4Real new_x = fix_x + xdir;
C4Real new_y = fix_y + ydir;
SideBounds(new_x);
if (!Action.t_attach) // Unattached movement = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
{
// Horizontal movement - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Move to target
while (fixtoi(new_x) != fixtoi(fix_x))
{
// Next step
int step = Sign(new_x - fix_x);
uint32_t border_hack_contacts = 0;
iContact=ContactCheck(GetX() + step, GetY(), &border_hack_contacts);
if (iContact || border_hack_contacts)
{
fAnyContact=true; iContacts |= t_contact | border_hack_contacts;
}
if (iContact)
{
// Abort horizontal movement
new_x = fix_x;
// Vertical redirection (always)
RedirectForce(xdir,ydir,-1);
ApplyFriction(ydir,ContactVtxFriction(this));
}
else // Free horizontal movement
{
DoMotion(step, 0);
fMoved = true;
}
}
// Vertical movement - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Movement target
new_y = fix_y + ydir;
// Movement bounds (vertical)
VerticalBounds(new_y);
// Move to target
while (fixtoi(new_y) != fixtoi(fix_y))
{
// Next step
int step = Sign(new_y - fix_y);
if ((iContact=ContactCheck(GetX(), GetY() + step, nullptr, ydir > 0)))
{
fAnyContact=true; iContacts |= t_contact;
new_y = fix_y;
// Vertical contact horizontal friction
ApplyFriction(xdir,ContactVtxFriction(this));
// Redirection slide or rotate
if (!ContactVtxCNAT(this,CNAT_Left))
RedirectForce(ydir,xdir,-1);
else if (!ContactVtxCNAT(this,CNAT_Right))
RedirectForce(ydir,xdir,+1);
else
{
// living things are always capable of keeping their rotation
if (OCF & OCF_Rotate) if (iContact==1) if (!Alive)
{
RedirectForce(ydir,rdir,-ContactVtxWeight(this));
fRedirectYR=1;
}
ydir=0;
}
}
else // Free vertical movement
{
//.........这里部分代码省略.........
示例5: return
bool C4SoundModifier::GetBoolProp(C4PropertyName key, bool default_value)
{
// get scaled property and fill in default value
C4PropList *p = props._getPropList();
return (p->GetPropertyInt(key, int32_t(default_value ? 1 : 0)) != 0);
}
示例6: float
float C4SoundModifier::GetFloatProp(C4PropertyName key, float ratio, float default_value)
{
// get scaled property and fill in default value
C4PropList *p = props._getPropList();
return float(p->GetPropertyInt(key, int32_t(default_value * ratio))) / ratio;
}