summaryrefslogtreecommitdiffstats
path: root/src/modelinfo/PedModelInfo.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-08-17 21:03:57 +0200
committereray orçunus <erayorcunus@gmail.com>2019-08-17 21:21:10 +0200
commit39223901bf459e0548605f64ae030e89fedb9949 (patch)
treeccd55f366d0b2a42b6746bf89017cb05139570e9 /src/modelinfo/PedModelInfo.cpp
parentMerge pull request #193 from erorcun/erorcun (diff)
downloadre3-39223901bf459e0548605f64ae030e89fedb9949.tar
re3-39223901bf459e0548605f64ae030e89fedb9949.tar.gz
re3-39223901bf459e0548605f64ae030e89fedb9949.tar.bz2
re3-39223901bf459e0548605f64ae030e89fedb9949.tar.lz
re3-39223901bf459e0548605f64ae030e89fedb9949.tar.xz
re3-39223901bf459e0548605f64ae030e89fedb9949.tar.zst
re3-39223901bf459e0548605f64ae030e89fedb9949.zip
Diffstat (limited to '')
-rw-r--r--src/modelinfo/PedModelInfo.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp
index c5242ef6..afe177c2 100644
--- a/src/modelinfo/PedModelInfo.cpp
+++ b/src/modelinfo/PedModelInfo.cpp
@@ -189,6 +189,45 @@ CPedModelInfo::CreateHitColModel(void)
m_hitColModel = colmodel;
}
+CColModel*
+CPedModelInfo::AnimatePedColModel(CColModel* colmodel, RwFrame* frame)
+{
+ RwObjectNameAssociation nameAssoc;
+ RwObjectIdAssociation idAssoc;
+ RwMatrix* mat = RwMatrixCreate();
+ CColSphere* spheres = colmodel->spheres;
+
+ for (int i = 0; i < NUMPEDINFONODES; i++) {
+ RwFrame* f = nil;
+ if (m_pColNodeInfos[i].name) {
+ nameAssoc.name = m_pColNodeInfos[i].name;
+ nameAssoc.frame = nil;
+ RwFrameForAllChildren(frame, FindFrameFromNameCB, &nameAssoc);
+ f = nameAssoc.frame;
+ }
+ else {
+ idAssoc.id = m_pColNodeInfos[i].pedNode;
+ idAssoc.frame = nil;
+ RwFrameForAllChildren(frame, FindFrameFromIdCB, &idAssoc);
+ f = idAssoc.frame;
+ }
+ if (f) {
+ RwMatrixCopy(mat, RwFrameGetMatrix(f));
+
+ for (f = RwFrameGetParent(f); f; f = RwFrameGetParent(f)) {
+ RwMatrixTransform(mat, &f->modelling, rwCOMBINEPOSTCONCAT);
+ if (RwFrameGetParent(f) == frame)
+ break;
+ }
+
+ spheres[i].center.x = mat->pos.x + m_pColNodeInfos[i].x;
+ spheres[i].center.y = mat->pos.y + 0.0f;
+ spheres[i].center.z = mat->pos.z + m_pColNodeInfos[i].z;
+ }
+ }
+
+ return colmodel;
+}
class CPedModelInfo_ : public CPedModelInfo
{