From e8c0619226a9da7ac40759b33df5d73d1f622c8e Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 9 May 2020 09:50:00 +0200 Subject: named anim assoc flags --- src/peds/Ped.cpp | 20 ++++++++++---------- src/peds/PlayerPed.cpp | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/peds') diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 3b95dfdd..0e740768 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); @@ -16298,7 +16298,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); @@ -16320,7 +16320,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) { @@ -17145,7 +17145,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); -- cgit v1.2.3 From 97d5698e0c669fd98911991b2ce3042fce376f06 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 9 May 2020 17:05:26 +0200 Subject: peds starting to work --- src/peds/Ped.cpp | 76 ++--------------------------------------------------- src/peds/PedIK.cpp | 11 +++++--- src/peds/PedStats.h | 5 ++++ 3 files changed, 15 insertions(+), 77 deletions(-) (limited to 'src/peds') diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 7a7316ae..fd4f9f58 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -8036,83 +8036,11 @@ CPed::GetNextPointOnRoute(void) return nextPoint; } -// These categories are purely random, most of ped models have no correlation. So I don't think making an enum. uint8 CPed::GetPedRadioCategory(uint32 modelIndex) { - switch (modelIndex) { - case MI_MALE01: - case MI_FEMALE03: - case MI_PROSTITUTE2: - case MI_WORKER1: - case MI_MOD_MAN: - case MI_MOD_WOM: - case MI_ST_WOM: - case MI_FAN_WOM: - return 3; - case MI_TAXI_D: - case MI_PIMP: - case MI_MALE02: - case MI_FEMALE02: - case MI_FATFEMALE01: - case MI_FATFEMALE02: - case MI_DOCKER1: - case MI_WORKER2: - case MI_FAN_MAN2: - return 9; - case MI_GANG01: - case MI_GANG02: - case MI_SCUM_MAN: - case MI_SCUM_WOM: - case MI_HOS_WOM: - case MI_CONST1: - return 1; - case MI_GANG03: - case MI_GANG04: - case MI_GANG07: - case MI_GANG08: - case MI_CT_MAN2: - case MI_CT_WOM2: - case MI_B_MAN3: - case MI_SHOPPER3: - return 4; - case MI_GANG05: - case MI_GANG06: - case MI_GANG11: - case MI_GANG12: - case MI_CRIMINAL02: - case MI_B_WOM2: - case MI_ST_MAN: - case MI_HOS_MAN: - return 5; - case MI_FATMALE01: - case MI_LI_MAN2: - case MI_SHOPPER1: - case MI_CAS_MAN: - return 6; - case MI_PROSTITUTE: - case MI_P_WOM2: - case MI_LI_WOM2: - case MI_B_WOM3: - case MI_CAS_WOM: - return 2; - case MI_P_WOM1: - case MI_DOCKER2: - case MI_STUD_MAN: - return 7; - case MI_CT_MAN1: - case MI_CT_WOM1: - case MI_LI_MAN1: - case MI_LI_WOM1: - case MI_B_MAN1: - case MI_B_MAN2: - case MI_B_WOM1: - case MI_SHOPPER2: - case MI_STUD_WOM: - return 8; - default: - return 0; - } + // TODO(MIAMI): remove this function and use modelinfo for radio + return 1; } // Some kind of VC leftover I think diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp index 3db3dc0f..0c7509eb 100644 --- a/src/peds/PedIK.cpp +++ b/src/peds/PedIK.cpp @@ -33,13 +33,18 @@ CPedIK::CPedIK(CPed *ped) #ifdef PED_SKIN inline RwMatrix* -GetComponentMatrix(CPed *ped, int32 node) +GetBoneMatrix(CPed *ped, int32 bone) { RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(ped->GetClump()); - int idx = RpHAnimIDGetIndex(hier, ped->m_pFrames[node]->nodeID); + int idx = RpHAnimIDGetIndex(hier, bone); RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier); return &mats[idx]; } +inline RwMatrix* +GetComponentMatrix(CPed *ped, int32 node) +{ + return GetBoneMatrix(ped, ped->m_pFrames[node]->nodeID); +} #endif void @@ -245,7 +250,7 @@ CPedIK::LookInDirection(float phi, float theta) } // parent of head is torso - RwMatrix worldMat = *GetComponentMatrix(m_ped, BONE_torso); + RwMatrix worldMat = *GetComponentMatrix(m_ped, PED_NECK); ExtractYawAndPitchWorld(&worldMat, &yaw, &pitch); LimbMoveStatus headStatus = MoveLimb(m_headOrient, CGeneral::LimitRadianAngle(phi - yaw), diff --git a/src/peds/PedStats.h b/src/peds/PedStats.h index 4c35e8ee..02f09c0d 100644 --- a/src/peds/PedStats.h +++ b/src/peds/PedStats.h @@ -37,6 +37,11 @@ enum ePedStats PEDSTAT_SPORTSFAN, PEDSTAT_SHOPPER, PEDSTAT_OLDSHOPPER, + PEDSTAT_BEACH_GUY, + PEDSTAT_BEACH_GIRL, + PEDSTAT_SKATER, + PEDSTAT_STD_MISSION, + PEDSTAT_COWARD, NUM_PEDSTATS }; -- cgit v1.2.3