Game_Vehicle::Game_Vehicle(Type _type) : Game_Character(getDataFromType(_type)) { type = _type; SetDirection(Left); SetSpriteDirection(Left); SetAnimationType(AnimType::AnimType_non_continuous); SetLayer(RPG::EventPage::Layers_same); LoadSystemSettings(); }
CScaleProperty::CScaleProperty() { SetEasingType(Linear); SetAnimationType(Scale); SetPropertyName(QString("scaleX")); }
bool JAnimator::Load(const char* scriptFile) { JFileSystem *fileSystem = JFileSystem::GetInstance(); if (fileSystem == NULL) return false; if (!fileSystem->OpenFile(scriptFile)) return false; int size = fileSystem->GetFileSize(); char *xmlBuffer = new char[size]; fileSystem->ReadFile(xmlBuffer, size); TiXmlDocument doc; doc.Parse(xmlBuffer); TiXmlNode* script = 0; TiXmlNode* frame = 0; TiXmlNode* obj = 0; TiXmlNode* param = 0; TiXmlElement* element = 0; float defaultTime = 0.033f; script = doc.FirstChild("script"); if (script) { element = script->ToElement(); printf("---- Loading %s:%s\n", element->Value(), element->Attribute("name")); char *type[] = { "ANIMATION_TYPE_LOOPING", "ANIMATION_TYPE_ONCE_AND_STAY", "ANIMATION_TYPE_ONCE_AND_BACK", "ANIMATION_TYPE_ONCE_AND_GONE", "ANIMATION_TYPE_PINGPONG" }; const char* aniType = element->Attribute("type"); for (int i=0; i<5; i++) if (strcmp(type[i], aniType)==0) { SetAnimationType(i); break; } float fps; if (element->QueryFloatAttribute("framerate", &fps) != TIXML_SUCCESS) fps = 30.0f; defaultTime = 1/fps; for (frame = script->FirstChild("frame"); frame; frame = frame->NextSibling()) { JAnimatorFrame *aniFrame = new JAnimatorFrame(this); float duration; element = frame->ToElement(); if (element->QueryFloatAttribute("time", &duration) != TIXML_SUCCESS) duration = defaultTime; aniFrame->SetFrameTime(duration); for (obj = frame->FirstChild(); obj; obj = obj->NextSibling()) { for (param = obj->FirstChild(); param; param = param->NextSibling()) { element = param->ToElement(); if (element != NULL) { if (strcmp(element->Value(), "settings")==0) { const char* quadName = element->Attribute("quad"); JQuad* quad = mResource->GetQuad(quadName); float x, y; float vsize, hsize; float angle; int a, r, g, b; int value; bool flipped = false; if (element->QueryFloatAttribute("x", &x) != TIXML_SUCCESS) x = 0.0f; if (element->QueryFloatAttribute("y", &y) != TIXML_SUCCESS) y = 0.0f; if (element->QueryFloatAttribute("hsize", &hsize) != TIXML_SUCCESS) hsize = 1.0f; if (element->QueryFloatAttribute("vsize", &vsize) != TIXML_SUCCESS) vsize = 1.0f; if (element->QueryFloatAttribute("rotation", &angle) != TIXML_SUCCESS) angle = 0.0f; if (element->QueryIntAttribute("a", &a) != TIXML_SUCCESS) a = 255; if (element->QueryIntAttribute("r", &r) != TIXML_SUCCESS) r = 255; if (element->QueryIntAttribute("g", &g) != TIXML_SUCCESS) g = 255; if (element->QueryIntAttribute("b", &b) != TIXML_SUCCESS) b = 255; if (element->QueryIntAttribute("flip", &value) == TIXML_SUCCESS) flipped = (value==1); JAnimatorObject *object = new JAnimatorObject(); object->SetQuad(quad); object->SetPosition(x, y); object->SetHScale(hsize); object->SetVScale(vsize); object->SetRotation(angle); object->SetColor(ARGB(a,r,g,b)); object->SetFlip(flipped); aniFrame->AddObject(object); } } } } mFrames.push_back(aniFrame); } } fileSystem->CloseFile(); delete[] xmlBuffer; return true; }
void AnimationMainMenu::OnValueChanged(VItemValueChangedEvent *pEvent) { VDialog::OnValueChanged(pEvent); // toggle animation type radio buttons if (pEvent->m_pItem==m_pCheckBoxSkeletalAnim && pEvent->AsBool()==true) { SetAnimationType(SKELETAL); return; } if (pEvent->m_pItem==m_pCheckBoxVertexAnim && pEvent->AsBool()==true) { SetAnimationType(VERTEX); return; } // start vertex animation if (pEvent->m_pItem==m_pCheckBoxPlayVertexAnim) { VisVertexAnimControl_cl *pAnimCtrl = m_pVertexAnimCharacter->GetVertexAnimControl(); #if defined(_VISION_PSP2) // PSP2 uses hardware deformation by default, which does not support vertex animation. VisAnimConfig_cl *pCfg = m_pVertexAnimCharacter->GetAnimConfig(); pCfg->SetSkinningMode(VIS_SKINNINGMODE_SOFTWARE); #endif if (pEvent->AsBool()) { pAnimCtrl->SetCurrentSequencePosition(0.0f); pAnimCtrl->Play(); } else { pAnimCtrl->Pause(); } return; } // start single skeletal anim if (pEvent->m_pItem==m_pCheckBoxSkelPlay) { VisSkeletalAnimControl_cl *pAnimCtrl = m_pSkeletalCharacter->GetSingleAnimControl(); if (pEvent->AsBool()) { pAnimCtrl->SetCurrentSequencePosition(0.0f); pAnimCtrl->Play(); } else { pAnimCtrl->Pause(); } return; } // select animtion type for skeletal animation if (pEvent->m_pItem==m_pSkeletalModeList) { SetSkeletalMode((SimpleSkeletalAnimatedObject_cl::SampleMode_e)pEvent->AsListItem()->GetData()); return; } // blend animation if (pEvent->m_pItem==m_pCheckBoxSkelBlend) { m_pSkeletalCharacter->SetBlendWalkToRun(pEvent->AsBool()); return; } // set animation timing via slider if (pEvent->m_pItem==m_pSliderSetAnimTime) { SetSkeletalAnimPhase(pEvent->AsFloat()); // in interval [0..1] return; } // set neck yaw via slider (forward kinematic) if (pEvent->m_pItem==m_pSliderFKinYaw) { SetSkeletalNeckYaw(pEvent->AsFloat()); // in interval [-70..70] return; } if (pEvent->m_pItem==m_pSliderLayered) { SetSkeletalLayeredAnimWeight(pEvent->AsFloat()); return; } }
CFillProperty::CFillProperty() { SetAnimationType(Fill); SetPropertyName(QString("fillScale")); }