summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/animation/AnimBlendAssocGroup.cpp5
-rw-r--r--src/animation/AnimBlendAssociation.cpp5
-rw-r--r--src/animation/AnimBlendAssociation.h16
-rw-r--r--src/animation/AnimBlendList.h1
-rw-r--r--src/animation/AnimBlendNode.cpp4
-rw-r--r--src/animation/AnimManager.cpp70
-rw-r--r--src/animation/AnimManager.h4
-rw-r--r--src/core/Cam.cpp2
-rw-r--r--src/core/Camera.h2
-rw-r--r--src/core/Streaming.cpp23
-rw-r--r--src/core/config.h3
-rw-r--r--src/peds/Ped.cpp20
-rw-r--r--src/peds/PlayerPed.cpp2
-rw-r--r--src/render/Sprite.cpp12
-rw-r--r--src/weapons/BulletInfo.cpp2
-rw-r--r--src/weapons/Weapon.cpp2
16 files changed, 96 insertions, 77 deletions
diff --git a/src/animation/AnimBlendAssocGroup.cpp b/src/animation/AnimBlendAssocGroup.cpp
index bdcca2f8..5a6d10b4 100644
--- a/src/animation/AnimBlendAssocGroup.cpp
+++ b/src/animation/AnimBlendAssocGroup.cpp
@@ -3,6 +3,7 @@
#include "ctype.h"
#include "General.h"
+#include "RwHelper.h"
#include "ModelInfo.h"
#include "AnimManager.h"
#include "RpAnimBlend.h"
@@ -131,6 +132,10 @@ CAnimBlendAssocGroup::CreateAssociations(const char *name)
assert(model);
printf("Associated anim %s with model %s\n", anim->name, model->GetName());
RpClump *clump = (RpClump*)model->CreateInstance();
+#ifdef PED_SKIN
+ if(IsClumpSkinned(clump))
+ RpClumpForAllAtomics(clump, AtomicRemoveAnimFromSkinCB, nil);
+#endif
RpAnimBlendClumpInit(clump);
assocList[i].Init(clump, anim);
RpClumpDestroy(clump);
diff --git a/src/animation/AnimBlendAssociation.cpp b/src/animation/AnimBlendAssociation.cpp
index daca7d68..8c99b694 100644
--- a/src/animation/AnimBlendAssociation.cpp
+++ b/src/animation/AnimBlendAssociation.cpp
@@ -147,11 +147,11 @@ CAnimBlendAssociation::Start(float time)
SetCurrentTime(time);
}
-void
+bool
CAnimBlendAssociation::UpdateTime(float timeDelta, float relSpeed)
{
if(!IsRunning())
- return;
+ return true;
timeStep = (flags & ASSOC_MOVEMENT ? relSpeed*hierarchy->totalLength : speed) * timeDelta;
currentTime += timeStep;
@@ -174,6 +174,7 @@ CAnimBlendAssociation::UpdateTime(float timeDelta, float relSpeed)
}
}
}
+ return true;
}
// return whether we still exist after this function
diff --git a/src/animation/AnimBlendAssociation.h b/src/animation/AnimBlendAssociation.h
index d35db1db..dd4c7a34 100644
--- a/src/animation/AnimBlendAssociation.h
+++ b/src/animation/AnimBlendAssociation.h
@@ -5,7 +5,6 @@
#include "AnimBlendHierarchy.h"
enum {
- // TODO
ASSOC_RUNNING = 1,
ASSOC_REPEAT = 2,
ASSOC_DELETEFADEDOUT = 4,
@@ -13,13 +12,12 @@ enum {
ASSOC_PARTIAL = 0x10,
ASSOC_MOVEMENT = 0x20, // ???
ASSOC_HAS_TRANSLATION = 0x40,
- ASSOC_FLAG80 = 0x80, // used for footstep sound calculation
- ASSOC_FLAG100 = 0x100,
- ASSOC_FLAG200 = 0x200,
- ASSOC_FLAG400 = 0x400, // unused, blending it with move anims makes them stop. 0x800 in VC
- ASSOC_FLAG800 = 0x800, // anims that we fall to front. 0x1000 in VC
- ASSOC_HAS_X_TRANSLATION = 0x1000,
- // 0x2000 is vehicle anims in VC
+ ASSOC_WALK = 0x80, // for CPed::PlayFootSteps(void)
+ ASSOC_FLAG_XPRESS = 0x100, // only used by xpress scratch, see CPed::Chat(void)
+ ASSOC_NOWALK = 0x200, // see CPed::PlayFootSteps(void)
+ ASSOC_BLOCK = 0x400, // unused in assoc description, blocks other anims from being played
+ ASSOC_FRONTAL = 0x800, // anims that we fall to front
+ ASSOC_HAS_X_TRANSLATION = 0x1000, // for 2d velocity extraction
};
// Anim hierarchy associated with a clump
@@ -75,7 +73,7 @@ public:
void SetCurrentTime(float time);
void SyncAnimation(CAnimBlendAssociation *other);
void Start(float time);
- void UpdateTime(float timeDelta, float relSpeed);
+ bool UpdateTime(float timeDelta, float relSpeed);
bool UpdateBlend(float timeDelta);
void SetRun(void) { flags |= ASSOC_RUNNING; }
diff --git a/src/animation/AnimBlendList.h b/src/animation/AnimBlendList.h
index d4b9a64a..018b5988 100644
--- a/src/animation/AnimBlendList.h
+++ b/src/animation/AnimBlendList.h
@@ -23,5 +23,6 @@ public:
prev->next = next;
if(next)
next->prev = prev;
+ Init();
}
};
diff --git a/src/animation/AnimBlendNode.cpp b/src/animation/AnimBlendNode.cpp
index 193e9176..df6cd1d5 100644
--- a/src/animation/AnimBlendNode.cpp
+++ b/src/animation/AnimBlendNode.cpp
@@ -6,8 +6,8 @@
void
CAnimBlendNode::Init(void)
{
- frameA = 0;
- frameB = 0;
+ frameA = -1;
+ frameB = -1;
remainingTime = 0.0f;
sequence = nil;
association = nil;
diff --git a/src/animation/AnimManager.cpp b/src/animation/AnimManager.cpp
index ebd2e1fb..8fb1576c 100644
--- a/src/animation/AnimManager.cpp
+++ b/src/animation/AnimManager.cpp
@@ -11,17 +11,17 @@
#include "AnimBlendAssocGroup.h"
#include "AnimManager.h"
-CAnimBlock CAnimManager::ms_aAnimBlocks[2];
-CAnimBlendHierarchy CAnimManager::ms_aAnimations[250];
+CAnimBlock CAnimManager::ms_aAnimBlocks[NUMANIMBLOCKS];
+CAnimBlendHierarchy CAnimManager::ms_aAnimations[NUMANIMATIONS];
int32 CAnimManager::ms_numAnimBlocks;
int32 CAnimManager::ms_numAnimations;
CAnimBlendAssocGroup *CAnimManager::ms_aAnimAssocGroups;
CLinkList<CAnimBlendHierarchy*> CAnimManager::ms_animCache;
AnimAssocDesc aStdAnimDescs[] = {
- { ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_FLAG80 },
- { ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_FLAG80 },
- { ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_FLAG80 },
+ { ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
+ { ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
+ { ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
{ ANIM_IDLE_STANCE, ASSOC_REPEAT },
{ ANIM_WALK_START, ASSOC_HAS_TRANSLATION },
{ ANIM_RUN_STOP, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION },
@@ -32,26 +32,26 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_IDLE_ARMED, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_IDLE_CHAT, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_IDLE_TAXI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
- { ANIM_KO_SHOT_FRONT1, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FLAG800 },
- { ANIM_KO_SHOT_FRONT2, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FLAG800 },
- { ANIM_KO_SHOT_FRONT3, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FLAG800 },
- { ANIM_KO_SHOT_FRONT4, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FLAG800 },
- { ANIM_KO_SHOT_FACE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FLAG800 },
+ { ANIM_KO_SHOT_FRONT1, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
+ { ANIM_KO_SHOT_FRONT2, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
+ { ANIM_KO_SHOT_FRONT3, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
+ { ANIM_KO_SHOT_FRONT4, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
+ { ANIM_KO_SHOT_FACE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_KO_SHOT_STOM, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
- { ANIM_KO_SHOT_ARML, ASSOC_PARTIAL | ASSOC_FLAG800 },
- { ANIM_KO_SHOT_ARMR, ASSOC_PARTIAL | ASSOC_FLAG800 },
+ { ANIM_KO_SHOT_ARML, ASSOC_PARTIAL | ASSOC_FRONTAL },
+ { ANIM_KO_SHOT_ARMR, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_KO_SHOT_LEGL, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_KO_SHOT_LEGR, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
- { ANIM_KD_LEFT, ASSOC_PARTIAL | ASSOC_FLAG800 },
- { ANIM_KD_RIGHT, ASSOC_PARTIAL | ASSOC_FLAG800 },
+ { ANIM_KD_LEFT, ASSOC_PARTIAL | ASSOC_FRONTAL },
+ { ANIM_KD_RIGHT, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_KO_SKID_FRONT, ASSOC_PARTIAL },
{ ANIM_KO_SPIN_R, ASSOC_PARTIAL },
- { ANIM_KO_SKID_BACK, ASSOC_PARTIAL | ASSOC_FLAG800 },
+ { ANIM_KO_SKID_BACK, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_KO_SPIN_L, ASSOC_PARTIAL },
- { ANIM_SHOT_FRONT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_FLAG200 },
- { ANIM_SHOT_LEFT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_FLAG200 },
- { ANIM_SHOT_BACK_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_FLAG200 },
- { ANIM_SHOT_RIGHT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_FLAG200 },
+ { ANIM_SHOT_FRONT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
+ { ANIM_SHOT_LEFT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
+ { ANIM_SHOT_BACK_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
+ { ANIM_SHOT_RIGHT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_HIT_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_LEFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_HIT_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
@@ -62,22 +62,22 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_HIT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_WALK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_WALL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
- { ANIM_FLOOR_HIT_F, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_FLAG800 },
+ { ANIM_FLOOR_HIT_F, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_HIT_BEHIND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_PUNCH_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_KICK_FLOOR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_BAT_H, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_BAT_V, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
- { ANIM_WEAPON_HGUN_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_FLAG200 },
+ { ANIM_WEAPON_HGUN_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_WEAPON_AK_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_PUMP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_SNIPER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_THROW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_THROWU, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_START_THROW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
- { ANIM_BOMBER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_FLAG200 },
- { ANIM_HGUN_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_FLAG200 },
- { ANIM_AK_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_FLAG200 },
+ { ANIM_BOMBER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
+ { ANIM_HGUN_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
+ { ANIM_AK_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_FPS_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_BAT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_UZI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
@@ -96,7 +96,7 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_FIGHT_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_ROUNDHOUSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_FIGHT_LONGKICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
- { ANIM_FIGHT_PPUNCH, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_FLAG200 },
+ { ANIM_FIGHT_PPUNCH, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_CAR_JACKED_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_CAR_LJACKED_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_CAR_JACKED_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
@@ -142,7 +142,7 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_DRIVEBY_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_CAR_LB, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_DRIVE_BOAT, ASSOC_DELETEFADEDOUT },
- { ANIM_CAR_GETOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
+ { ANIM_CAR_GETOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_GETOUT_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_CLOSE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_HOOKERTALK, ASSOC_REPEAT | ASSOC_PARTIAL },
@@ -175,8 +175,8 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_FALL_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_FALL_COLLAPSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_EV_STEP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
- { ANIM_EV_DIVE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FLAG800 },
- { ANIM_XPRESS_SCRATCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_FLAG100 },
+ { ANIM_EV_DIVE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
+ { ANIM_XPRESS_SCRATCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_FLAG_XPRESS },
{ ANIM_ROAD_CROSS, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_TURN_180, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_ARREST_GUN, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
@@ -185,18 +185,18 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_DUCK_DOWN, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_DUCK_LOW, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_RBLOCK_CSHOOT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
- { ANIM_WEAPON_THROWU, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
+ { ANIM_WEAPON_THROWU2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_HANDSUP, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HANDSCOWER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
- { ANIM_FUCKU, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_FLAG200 },
+ { ANIM_FUCKU, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_PHONE_IN, ASSOC_PARTIAL },
{ ANIM_PHONE_OUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_PHONE_TALK, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
};
AnimAssocDesc aStdAnimDescsSide[] = {
- { ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_FLAG80 | ASSOC_HAS_X_TRANSLATION },
- { ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_FLAG80 | ASSOC_HAS_X_TRANSLATION },
- { ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_FLAG80 | ASSOC_HAS_X_TRANSLATION },
+ { ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
+ { ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
+ { ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
{ ANIM_IDLE_STANCE, ASSOC_REPEAT },
{ ANIM_WALK_START, ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION },
};
@@ -750,8 +750,8 @@ CAnimManager::LoadAnimFiles(void)
CBaseModelInfo *mi = CModelInfo::GetModelInfo(ms_aAnimAssocDefinitions[i].modelIndex);
RpClump *clump = (RpClump*)mi->CreateInstance();
RpAnimBlendClumpInit(clump);
- CAnimBlendAssocGroup *group = &CAnimManager::ms_aAnimAssocGroups[i];
- const AnimAssocDefinition *def = &CAnimManager::ms_aAnimAssocDefinitions[i];
+ CAnimBlendAssocGroup *group = &ms_aAnimAssocGroups[i];
+ const AnimAssocDefinition *def = &ms_aAnimAssocDefinitions[i];
group->CreateAssociations(def->blockName, clump, def->animNames, def->numAnims);
for(j = 0; j < group->numAssociations; j++)
group->GetAnimation(j)->flags |= def->animDescs[j].flags;
diff --git a/src/animation/AnimManager.h b/src/animation/AnimManager.h
index 1b333b60..d27e4512 100644
--- a/src/animation/AnimManager.h
+++ b/src/animation/AnimManager.h
@@ -64,8 +64,8 @@ struct AnimAssocDefinition
class CAnimManager
{
static const AnimAssocDefinition ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS];
- static CAnimBlock ms_aAnimBlocks[2];
- static CAnimBlendHierarchy ms_aAnimations[250];
+ static CAnimBlock ms_aAnimBlocks[NUMANIMBLOCKS];
+ static CAnimBlendHierarchy ms_aAnimations[NUMANIMATIONS];
static int32 ms_numAnimBlocks;
static int32 ms_numAnimations;
static CAnimBlendAssocGroup *ms_aAnimAssocGroups;
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 76d8d22b..3b11ec5f 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -25,8 +25,6 @@
#include "Camera.h"
#include "DMAudio.h"
-const float DefaultFOV = 70.0f; // beta: 80.0f
-
bool PrintDebugCode = false;
int16 DebugCamMode;
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 02122dfe..51138f99 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -40,6 +40,8 @@ enum
#define DEFAULT_CAR_ZOOM_VALUE_2 (1.9f)
#define DEFAULT_CAR_ZOOM_VALUE_3 (3.9f)
+const float DefaultFOV = 70.0f; // beta: 80.0f
+
class CCam
{
public:
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 5aa419b1..f24192ef 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1493,12 +1493,14 @@ CStreaming::GetCdImageOffset(int32 lastPosn)
}
inline bool
-TxdAvailable(int32 txdId)
+ModelNotLoaded(int32 modelId)
{
- CStreamingInfo *si = &CStreaming::ms_aInfoForModel[txdId + STREAM_OFFSET_TXD];
- return si->m_loadState == STREAMSTATE_LOADED || si->m_loadState == STREAMSTATE_READING;
+ CStreamingInfo *si = &CStreaming::ms_aInfoForModel[modelId];
+ return si->m_loadState != STREAMSTATE_LOADED && si->m_loadState != STREAMSTATE_READING;
}
+inline bool TxdNotLoaded(int32 txdId) { return ModelNotLoaded(txdId + STREAM_OFFSET_TXD); }
+
// Find stream id of next requested file in cdimage
int32
CStreaming::GetNextFileOnCd(int32 lastPosn, bool priority)
@@ -1523,10 +1525,15 @@ CStreaming::GetNextFileOnCd(int32 lastPosn, bool priority)
continue;
// request Txd if necessary
- if(streamId < STREAM_OFFSET_TXD &&
- !TxdAvailable(CModelInfo::GetModelInfo(streamId)->GetTxdSlot())){
- ReRequestTxd(CModelInfo::GetModelInfo(streamId)->GetTxdSlot());
- }else if(ms_aInfoForModel[streamId].GetCdPosnAndSize(posn, size)){
+ if(streamId < STREAM_OFFSET_TXD){
+ int txdId = CModelInfo::GetModelInfo(streamId)->GetTxdSlot();
+ if(TxdNotLoaded(txdId)){
+ ReRequestTxd(txdId);
+ continue;
+ }
+ }
+
+ if(ms_aInfoForModel[streamId].GetCdPosnAndSize(posn, size)){
if(posn < posnFirst){
// find first requested file in image
streamIdFirst = streamId;
@@ -1624,7 +1631,7 @@ CStreaming::RequestModelStream(int32 ch)
if(streamId < STREAM_OFFSET_TXD){
if (havePed && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_PED ||
haveBigFile && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_VEHICLE ||
- !TxdAvailable(CModelInfo::GetModelInfo(streamId)->GetTxdSlot()))
+ TxdNotLoaded(CModelInfo::GetModelInfo(streamId)->GetTxdSlot()))
break;
}else{
if(haveBigFile && size > 200)
diff --git a/src/core/config.h b/src/core/config.h
index 7c1fab5b..79d9ab86 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -38,6 +38,9 @@ enum Config {
NUMAUDIOSCRIPTOBJECTS = 256,
NUMCUTSCENEOBJECTS = 50,
+ NUMANIMBLOCKS = 2,
+ NUMANIMATIONS = 250,
+
NUMTEMPOBJECTS = 30,
// Path data
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 161cd927..646873dc 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -2096,10 +2096,10 @@ CPed::PlayFootSteps(void)
float walkRunAssocBlend = 0.0f, idleAssocBlend = 0.0f;
for (; assoc; assoc = RpAnimBlendGetNextAssociation(assoc)) {
- if (assoc->flags & ASSOC_FLAG80) {
+ if (assoc->flags & ASSOC_WALK) {
walkRunAssoc = assoc;
walkRunAssocBlend += assoc->blendAmount;
- } else if ((assoc->flags & ASSOC_FLAG200) == 0) {
+ } else if ((assoc->flags & ASSOC_NOWALK) == 0) {
idleAssocBlend += assoc->blendAmount;
}
}
@@ -3287,7 +3287,7 @@ CPed::Chat(void)
} else
Say(SOUND_PED_CHAT);
- } else if (!RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG100)) {
+ } else if (!RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG_XPRESS)) {
if (CGeneral::GetRandomNumber() < 20) {
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_XPRESS_SCRATCH, 4.0f);
@@ -3743,7 +3743,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
bool detectDieAnim = true;
if (m_nPedState == PED_FALL || m_nPedState == PED_GETUP) {
if (!IsPedHeadAbovePos(-0.3f)) {
- if (RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG800))
+ if (RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FRONTAL))
dieAnim = ANIM_FLOOR_HIT_F;
else
dieAnim = ANIM_FLOOR_HIT;
@@ -3765,7 +3765,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
if (IsPedHeadAbovePos(-0.3f)) {
dieAnim = NUM_ANIMS;
} else {
- if (RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG800))
+ if (RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FRONTAL))
dieAnim = ANIM_FLOOR_HIT_F;
else
dieAnim = ANIM_FLOOR_HIT;
@@ -3805,7 +3805,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
if (IsPedHeadAbovePos(-0.3f)) {
dieAnim = NUM_ANIMS;
} else {
- if (RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG800))
+ if (RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FRONTAL))
dieAnim = ANIM_FLOOR_HIT_F;
else
dieAnim = ANIM_FLOOR_HIT;
@@ -4273,7 +4273,7 @@ CPed::SetGetUp(void)
animAssoc->flags |= ASSOC_DELETEFADEDOUT;
}
- if (RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG800))
+ if (RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FRONTAL))
animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_GETUP_FRONT, 1000.0f);
else
animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_GETUP1, 1000.0f);
@@ -16301,7 +16301,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
if (CGame::nastyGame) {
if (hitLevel == HITLEVEL_GROUND) {
CAnimBlendAssociation *floorHitAssoc;
- if (RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG800)) {
+ if (RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FRONTAL)) {
floorHitAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT_F, 8.0f);
} else {
floorHitAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[FIGHTMOVE_HITONFLOOR].animId, 8.0f);
@@ -16323,7 +16323,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
}
} else if (m_nPedState == PED_FALL) {
if (hitLevel == HITLEVEL_GROUND && !IsPedHeadAbovePos(-0.3f)) {
- CAnimBlendAssociation *floorHitAssoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG800) ?
+ CAnimBlendAssociation *floorHitAssoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FRONTAL) ?
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT_F, 8.0f) :
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT, 8.0f);
if (floorHitAssoc) {
@@ -17148,7 +17148,7 @@ CPed::SetMoveAnim(void)
else
animGroupToUse = m_animGroup;
- CAnimBlendAssociation *animAssoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG400);
+ CAnimBlendAssociation *animAssoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_BLOCK);
if (!animAssoc) {
CAnimBlendAssociation *fightIdleAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FIGHT_IDLE);
animAssoc = fightIdleAssoc;
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 6d0d394d..c6c4824b 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -1327,7 +1327,7 @@ CPlayerPed::ProcessControl(void)
case PED_ATTACK:
case PED_FIGHT:
case PED_AIM_GUN:
- if (!RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG400)) {
+ if (!RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_BLOCK)) {
if (TheCamera.Cams[0].Using3rdPersonMouseCam()) {
if (padUsed)
PlayerControl1stPersonRunAround(padUsed);
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index 30eaf840..1dd1aaab 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -29,13 +29,17 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh,
float recip = 1.0f/out->z;
out->x *= SCREEN_WIDTH * recip;
out->y *= SCREEN_HEIGHT * recip;
- // What is this? size?
- *outw = 70.0f/CDraw::GetFOV() * SCREEN_WIDTH * recip;
#ifdef ASPECT_RATIO_SCALE
- *outh = 70.0f/CDraw::GetFOV() / (DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO) * SCREEN_HEIGHT * recip;
+ float fov = CDraw::ConvertFOV(DefaultFOV);
#else
- *outh = 70.0f/CDraw::GetFOV() * SCREEN_HEIGHT * recip;
+ const float fov = DefaultFOV;
#endif
+ // this is used to scale correctly if you zoom in with sniper rifle
+ float fovScale = fov / CDraw::GetFOV();
+
+ *outw = fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH;
+ *outh = fovScale * recip * SCREEN_HEIGHT;
+
return true;
}
diff --git a/src/weapons/BulletInfo.cpp b/src/weapons/BulletInfo.cpp
index 83b6471e..92d98a50 100644
--- a/src/weapons/BulletInfo.cpp
+++ b/src/weapons/BulletInfo.cpp
@@ -122,7 +122,7 @@ void CBulletInfo::Update(void)
}
if (pPed->GetPedState() == PED_DEAD) {
CAnimBlendAssociation* pAnim;
- if (RpAnimBlendClumpGetFirstAssociation(pPed->GetClump(), ASSOC_FLAG800))
+ if (RpAnimBlendClumpGetFirstAssociation(pPed->GetClump(), ASSOC_FRONTAL))
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT_F, 8.0f);
else
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT, 8.0f);
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index 17ce64c0..aef53094 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -973,7 +973,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
if ( victimPed->Dead() )
{
CAnimBlendAssociation *asoc;
- if ( RpAnimBlendClumpGetFirstAssociation(victimPed->GetClump(), ASSOC_FLAG800) )
+ if ( RpAnimBlendClumpGetFirstAssociation(victimPed->GetClump(), ASSOC_FRONTAL) )
asoc = CAnimManager::BlendAnimation(victimPed->GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT_F, 8.0f);
else
asoc = CAnimManager::BlendAnimation(victimPed->GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT, 8.0f);