summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-06-23 12:58:14 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2019-06-23 12:58:14 +0200
commita87f3188e9832c442b66fa67fd312359a77a32c0 (patch)
treebc3a15ed31af15cd045f94fab5bfbf5c06f86b88 /src/control
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadre3-a87f3188e9832c442b66fa67fd312359a77a32c0.tar
re3-a87f3188e9832c442b66fa67fd312359a77a32c0.tar.gz
re3-a87f3188e9832c442b66fa67fd312359a77a32c0.tar.bz2
re3-a87f3188e9832c442b66fa67fd312359a77a32c0.tar.lz
re3-a87f3188e9832c442b66fa67fd312359a77a32c0.tar.xz
re3-a87f3188e9832c442b66fa67fd312359a77a32c0.tar.zst
re3-a87f3188e9832c442b66fa67fd312359a77a32c0.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Replay.cpp46
-rw-r--r--src/control/Replay.h46
2 files changed, 68 insertions, 24 deletions
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index d9cd2a80..ab253cde 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -1,11 +1,13 @@
#include "common.h"
#include "patcher.h"
+#include "AnimBlendAssociation.h"
#include "BulletTraces.h"
#include "Clock.h"
#include "Draw.h"
#include "math/Matrix.h"
#include "ModelIndices.h"
#include "Replay.h"
+#include "RpAnimBlend.h"
#include "Pad.h"
#include "Pools.h"
#include "CutsceneMgr.h"
@@ -45,7 +47,7 @@ bool &CReplay::bDoLoadSceneWhenDone = *(bool*)0x95CD76;
void PrintElementsInPtrList(void)
{
for (CPtrNode* node = CWorld::GetBigBuildingList(LEVEL_NONE).first; node; node = node->next) {
- // Most likely debug print was present here
+ /* Most likely debug print was present here */
}
}
@@ -231,7 +233,49 @@ void CReplay::StorePedUpdate(CPed *ped, int id)
Record.m_nOffset += sizeof(tPedUpdatePacket);
}
#endif
+
+#if 0
WRAPPER void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state) { EAXJMP(0x593670); }
+#else
+void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
+{
+ CAnimBlendAssociation* second;
+ float blend_amount;
+ CAnimBlendAssociation* main = RpAnimBlendClumpGetMainAssociation((RpClump*)ped->m_rwObject, &second, &blend_amount);
+ if (main){
+ state->animId = main->animId;
+ state->time = 255.0f / 4.0f * max(0.0f, min(4.0f, main->currentTime));
+ state->speed = 255.0f / 3.0f * max(0.0f, min(3.0f, main->speed));
+ }else{
+ state->animId = 3;
+ state->time = 0;
+ state->speed = 85;
+ }
+ if (second) {
+ state->secAnimId = second->animId;
+ state->secTime = 255.0f / 4.0f * max(0.0f, min(4.0f, second->currentTime));
+ state->secSpeed = 255.0f / 3.0f * max(0.0f, min(3.0f, second->speed));
+ state->blendAmount = 255.0f / 2.0f * max(0.0f, min(2.0f, blend_amount));
+ }else{
+ state->secAnimId = 0;
+ state->secTime = 0;
+ state->secSpeed = 0;
+ state->blendAmount = 0;
+ }
+ CAnimBlendAssociation* partial = RpAnimBlendClumpGetMainPartialAssociation((RpClump*)ped->m_rwObject);
+ if (partial) {
+ state->partAnimId = partial->animId;
+ state->partAnimTime = 255.0f / 4.0f * max(0.0f, min(4.0f, partial->currentTime));
+ state->partAnimSpeed = 255.0f / 3.0f * max(0.0f, min(3.0f, partial->speed));
+ state->partBlendAmount = 255.0f / 2.0f * max(0.0f, min(2.0f, partial->blendAmount));
+ }else{
+ state->partAnimId = 0;
+ state->partAnimTime = 0;
+ state->partAnimSpeed = 0;
+ state->partBlendAmount = 0;
+ }
+}
+#endif
WRAPPER void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { EAXJMP(0x593BB0); }
WRAPPER void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594050); }
WRAPPER void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state) { EAXJMP(0x5942A0); }
diff --git a/src/control/Replay.h b/src/control/Replay.h
index b73b249c..8d1f1c38 100644
--- a/src/control/Replay.h
+++ b/src/control/Replay.h
@@ -19,33 +19,33 @@ struct CAddressInReplayBuffer
struct CStoredAnimationState
{
- int8 animId;
- int8 time;
- int8 speed;
- int8 secAnimId;
- int8 secTime;
- int8 secSpeed;
- int8 blendAmount;
- int8 partAnimId;
- int8 partAnimTime;
- int8 partAnimSpeed;
- int8 partBlendAmount;
+ uint8 animId;
+ uint8 time;
+ uint8 speed;
+ uint8 secAnimId;
+ uint8 secTime;
+ uint8 secSpeed;
+ uint8 blendAmount;
+ uint8 partAnimId;
+ uint8 partAnimTime;
+ uint8 partAnimSpeed;
+ uint8 partBlendAmount;
};
struct CStoredDetailedAnimationState
{
- int8 m_abAnimId[3];
- int8 m_abCurTime[3];
- int8 m_abSpeed[3];
- int8 m_abBlendAmount[3];
- int8 m_abFunctionCallbackID[3];
- int16 m_awFlags[3];
- int8 m_abAnimId2[6];
- int8 m_abCurTime2[6];
- int8 m_abSpeed2[6];
- int8 m_abBlendAmount2[6];
- int8 m_abFunctionCallbackID2[6];
- int16 m_awFlags2[6];
+ int8 aAnimId[3];
+ int8 aCurTime[3];
+ int8 aSpeed[3];
+ int8 aBlendAmount[3];
+ int8 aFunctionCallbackID[3];
+ int16 aFlags[3];
+ int8 aAnimId2[6];
+ int8 aCurTime2[6];
+ int8 aSpeed2[6];
+ int8 aBlendAmount2[6];
+ int8 aFunctionCallbackID2[6];
+ int16 aFlags2[6];
};
class CReplay