peds starting to work

This commit is contained in:
aap 2020-05-09 17:05:26 +02:00
parent 989ded6052
commit 97d5698e0c
20 changed files with 171 additions and 262 deletions

View File

@ -81,13 +81,13 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_BOMBER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, { ANIM_BOMBER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_HGUN_RELOAD, 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_AK_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_FPS_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, // { ANIM_FPS_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_BAT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, // { ANIM_FPS_BAT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_UZI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, // { ANIM_FPS_UZI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_PUMP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, // { ANIM_FPS_PUMP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_AK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, // { ANIM_FPS_AK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_M16, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, // { ANIM_FPS_M16, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_ROCKET, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, // { ANIM_FPS_ROCKET, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_IDLE, ASSOC_REPEAT }, { ANIM_FIGHT_IDLE, ASSOC_REPEAT },
{ ANIM_FIGHT2_IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, { ANIM_FIGHT2_IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_SH_F, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, { ANIM_FIGHT_SH_F, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
@ -263,13 +263,13 @@ char const *aStdAnimations[] = {
"bomber", "bomber",
"WEAPON_hgun_rload", "WEAPON_hgun_rload",
"WEAPON_AK_rload", "WEAPON_AK_rload",
"FPS_PUNCH", // "FPS_PUNCH",
"FPS_BAT", // "FPS_BAT",
"FPS_UZI", // "FPS_UZI",
"FPS_PUMP", // "FPS_PUMP",
"FPS_AK", // "FPS_AK",
"FPS_M16", // "FPS_M16",
"FPS_ROCKET", // "FPS_ROCKET",
"FIGHTIDLE", "FIGHTIDLE",
"FIGHT2IDLE", "FIGHT2IDLE",
"FIGHTsh_F", "FIGHTsh_F",
@ -825,7 +825,8 @@ CAnimManager::BlendAnimation(RpClump *clump, AssocGroupId groupId, AnimationId a
void void
CAnimManager::LoadAnimFiles(void) CAnimManager::LoadAnimFiles(void)
{ {
LoadAnimFile("ANIM\\PED.IFP"); // LoadAnimFile("ANIM\\PED.IFP");
LoadAnimFile("ANIM\\PED_MIAMI.IFP");
ms_aAnimAssocGroups = new CAnimBlendAssocGroup[NUM_ANIM_ASSOC_GROUPS]; ms_aAnimAssocGroups = new CAnimBlendAssocGroup[NUM_ANIM_ASSOC_GROUPS];
CreateAnimAssocGroups(); CreateAnimAssocGroups();
} }
@ -986,15 +987,6 @@ CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*somename)[32]
kf->deltaTime = fbuf[10]; // absolute time here kf->deltaTime = fbuf[10]; // absolute time here
} }
} }
/*
// convert absolute time to deltas
for(l = seq->numFrames-1; l > 0; l--){
KeyFrame *kf1 = seq->GetKeyFrame(l);
KeyFrame *kf2 = seq->GetKeyFrame(l-1);
kf1->deltaTime -= kf2->deltaTime;
}
*/
} }
hier->RemoveQuaternionFlips(); hier->RemoveQuaternionFlips();

View File

@ -61,13 +61,13 @@ enum AnimationId
ANIM_BOMBER, ANIM_BOMBER,
ANIM_HGUN_RELOAD, ANIM_HGUN_RELOAD,
ANIM_AK_RELOAD, ANIM_AK_RELOAD,
ANIM_FPS_PUNCH, // ANIM_FPS_PUNCH,
ANIM_FPS_BAT, // ANIM_FPS_BAT,
ANIM_FPS_UZI, // ANIM_FPS_UZI,
ANIM_FPS_PUMP, // ANIM_FPS_PUMP,
ANIM_FPS_AK, // ANIM_FPS_AK,
ANIM_FPS_M16, // ANIM_FPS_M16,
ANIM_FPS_ROCKET, // ANIM_FPS_ROCKET,
ANIM_FIGHT_IDLE, ANIM_FIGHT_IDLE,
ANIM_FIGHT2_IDLE, ANIM_FIGHT2_IDLE,
ANIM_FIGHT_SH_F, ANIM_FIGHT_SH_F,

View File

@ -2,26 +2,29 @@
#include "PedModelInfo.h" #include "PedModelInfo.h"
#include "Bones.h" #include "Bones.h"
#ifdef PED_SKIN
int int
ConvertPedNode2BoneTag(int node) ConvertPedNode2BoneTag(int node)
{ {
switch(node){ switch(node){
case PED_TORSO: return BONE_waist; case PED_MID: return BONE_spine1;
case PED_MID: return BONE_torso; // this is what Xbox/Mobile use case PED_HEAD: return BONE_head;
// return BONE_mid; // this is what PS2/PC use case PED_UPPERARML: return BONE_l_upperarm;
case PED_HEAD: return BONE_head; case PED_UPPERARMR: return BONE_r_upperarm;
case PED_UPPERARML: return BONE_upperarml; case PED_HANDL: return BONE_l_hand;
case PED_UPPERARMR: return BONE_upperarmr; case PED_HANDR: return BONE_r_hand;
case PED_HANDL: return BONE_Lhand; case PED_UPPERLEGL: return BONE_l_thigh;
case PED_HANDR: return BONE_Rhand; case PED_UPPERLEGR: return BONE_r_thigh;
case PED_UPPERLEGL: return BONE_upperlegl; case PED_FOOTL: return BONE_l_foot;
case PED_UPPERLEGR: return BONE_upperlegr; case PED_FOOTR: return BONE_r_foot;
case PED_FOOTL: return BONE_footl; case PED_LOWERLEGR: return BONE_r_calf;
case PED_FOOTR: return BONE_footr; case PED_LOWERLEGL: return BONE_l_calf;
case PED_LOWERLEGR: return BONE_lowerlegl; case PED_FOREARML: return BONE_l_forearm;
case PED_FOREARMR: return BONE_r_forearm;
case PED_CLAVICLEL: return BONE_l_clavicle;
case PED_CLAVICLER: return BONE_r_clavicle;
case PED_NECK: return BONE_neck;
} }
assert(0 && "this node has no bone");
return -1; return -1;
} }
@ -29,24 +32,28 @@ const char*
ConvertBoneTag2BoneName(int tag) ConvertBoneTag2BoneName(int tag)
{ {
switch(tag){ switch(tag){
case BONE_waist: return "Swaist"; case BONE_root: return "Root";
case BONE_upperlegr: return "Supperlegr"; case BONE_pelvis: return "Pelvis";
case BONE_lowerlegr: return "Slowerlegr"; case BONE_spine: return "Spine";
case BONE_footr: return "Sfootr"; case BONE_spine1: return "Spine1";
case BONE_upperlegl: return "Supperlegl"; case BONE_neck: return "Neck";
case BONE_lowerlegl: return "Slowerlegl"; case BONE_head: return "Head";
case BONE_footl: return "Sfootl"; case BONE_l_clavicle: return "Bip01 R Clavicle";
case BONE_mid: return "Smid"; case BONE_l_upperarm: return "R UpperArm";
case BONE_torso: return "Storso"; case BONE_l_forearm: return "R Forearm";
case BONE_head: return "Shead"; case BONE_l_hand: return "R Hand";
case BONE_upperarmr: return "Supperarmr"; case BONE_l_finger: return "R Fingers";
case BONE_lowerarmr: return "Slowerarmr"; case BONE_r_clavicle: return "Bip01 L Clavicle";
case BONE_Rhand: return "SRhand"; case BONE_r_upperarm: return "L UpperArm";
case BONE_upperarml: return "Supperarml"; case BONE_r_forearm: return "L Forearm";
case BONE_lowerarml: return "Slowerarml"; case BONE_r_hand: return "L Hand";
case BONE_Lhand: return "SLhand"; case BONE_r_finger: return "L Fingers";
case BONE_l_thigh: return "L Thigh";
case BONE_l_calf: return "L Calf";
case BONE_l_foot: return "L Foot";
case BONE_r_thigh: return "R Thigh";
case BONE_r_calf: return "R Calf";
case BONE_r_foot: return "R Foot";
} }
return nil; return nil;
} }
#endif

View File

@ -2,22 +2,28 @@
enum BoneTag enum BoneTag
{ {
BONE_waist, BONE_root = 0,
BONE_upperlegr, BONE_pelvis = 1,
BONE_lowerlegr, BONE_spine = 2,
BONE_footr, BONE_spine1 = 3,
BONE_upperlegl, BONE_neck = 4,
BONE_lowerlegl, BONE_head = 5,
BONE_footl, BONE_l_clavicle = 31,
BONE_mid, BONE_l_upperarm = 32,
BONE_torso, BONE_l_forearm = 33,
BONE_head, BONE_l_hand = 34,
BONE_upperarmr, BONE_l_finger = 35,
BONE_lowerarmr, BONE_r_clavicle = 21,
BONE_Rhand, BONE_r_upperarm = 22,
BONE_upperarml, BONE_r_forearm = 23,
BONE_lowerarml, BONE_r_hand = 24,
BONE_Lhand, BONE_r_finger = 25,
BONE_l_thigh = 41,
BONE_l_calf = 42,
BONE_l_foot = 43,
BONE_r_thigh = 51,
BONE_r_calf = 52,
BONE_r_foot = 53,
}; };
int ConvertPedNode2BoneTag(int node); int ConvertPedNode2BoneTag(int node);

View File

@ -1357,8 +1357,9 @@ cAudioManager::GetBlackProjectMaleTalkSfx(int16 sound, int32 model)
return GetGenericMaleTalkSfx(sound); return GetGenericMaleTalkSfx(sound);
} }
if (model == MI_P_MAN2) // TODO(MIAMI): just making this compile
sfx += (SFX_BLACK_PROJECT_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1); // if (model == MI_P_MAN2)
// sfx += (SFX_BLACK_PROJECT_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1);
return sfx; return sfx;
} }
@ -2188,8 +2189,9 @@ cAudioManager::GetBusinessMaleYoungTalkSfx(int16 sound, int32 model)
return GetGenericMaleTalkSfx(sound); return GetGenericMaleTalkSfx(sound);
} }
if (model == MI_B_MAN3) // TODO(MIAMI): just making this compile
sfx += (SFX_BUSINESS_MALE_YOUNG_VOICE_2_DRIVER_ABUSE_1 - SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1); // if (model == MI_B_MAN3)
// sfx += (SFX_BUSINESS_MALE_YOUNG_VOICE_2_DRIVER_ABUSE_1 - SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1);
return sfx; return sfx;
} }
@ -2265,8 +2267,9 @@ cAudioManager::GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model)
return GetGenericFemaleTalkSfx(sound); return GetGenericFemaleTalkSfx(sound);
} }
if (model == MI_B_WOM2) // TODO(MIAMI): just making this compile
sfx += (SFX_WHITE_BUSINESS_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1); // if (model == MI_B_WOM2)
// sfx += (SFX_WHITE_BUSINESS_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1);
return sfx; return sfx;
} }
@ -2451,8 +2454,9 @@ cAudioManager::GetFanMaleTalkSfx(int16 sound, int32 model)
return GetGenericMaleTalkSfx(sound); return GetGenericMaleTalkSfx(sound);
} }
if (model == MI_FAN_MAN2) // TODO(MIAMI): just making this compile
sfx += (SFX_FOOTBALL_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_FOOTBALL_MALE_VOICE_1_DRIVER_ABUSE_1); // if (model == MI_FAN_MAN2)
// sfx += (SFX_FOOTBALL_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_FOOTBALL_MALE_VOICE_1_DRIVER_ABUSE_1);
return sfx; return sfx;
} }
@ -2631,11 +2635,12 @@ cAudioManager::GetShopperFemaleTalkSfx(int16 sound, int32 model)
return GetGenericFemaleTalkSfx(sound); return GetGenericFemaleTalkSfx(sound);
} }
if (model == MI_SHOPPER2) { // TODO(MIAMI): just making this compile
sfx += (SFX_SHOPPER_VOICE_2_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1); // if (model == MI_SHOPPER2) {
} else if (model == MI_SHOPPER3) { // sfx += (SFX_SHOPPER_VOICE_2_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1);
sfx += (SFX_SHOPPER_VOICE_3_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1); // } else if (model == MI_SHOPPER3) {
} // sfx += (SFX_SHOPPER_VOICE_3_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1);
// }
return sfx; return sfx;
} }
@ -3044,6 +3049,8 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
return GetNormalMaleTalkSfx(sound); return GetNormalMaleTalkSfx(sound);
case MI_TAXI_D: case MI_TAXI_D:
return GetTaxiDriverTalkSfx(sound); return GetTaxiDriverTalkSfx(sound);
// TODO(MIAMI): just making this compile
/*
case MI_PIMP: case MI_PIMP:
return GetPimpTalkSfx(sound); return GetPimpTalkSfx(sound);
case MI_GANG01: case MI_GANG01:
@ -3173,6 +3180,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
return GetStudentFemaleTalkSfx(sound); return GetStudentFemaleTalkSfx(sound);
case MI_CAS_MAN: case MI_CAS_MAN:
return GetCasualMaleOldTalkSfx(sound); return GetCasualMaleOldTalkSfx(sound);
*/
default: default:
return GetGenericMaleTalkSfx(sound); return GetGenericMaleTalkSfx(sound);
} }
@ -6303,8 +6311,9 @@ cAudioManager::ProcessPed(CPhysical *ped)
// params.m_bDistanceCalculated = false; // params.m_bDistanceCalculated = false;
params.m_pPed = (CPed *)ped; params.m_pPed = (CPed *)ped;
params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (ped->GetModelIndex() == MI_FATMALE02) // TODO(MIAMI): just making this compile
ProcessPedHeadphones(&params); // if (ped->GetModelIndex() == MI_FATMALE02)
// ProcessPedHeadphones(&params);
ProcessPedOneShots(&params); ProcessPedOneShots(&params);
} }

View File

@ -825,7 +825,7 @@ int32
CCarCtrl::ChooseGangCarModel(int32 gang) CCarCtrl::ChooseGangCarModel(int32 gang)
{ {
if (CStreaming::HasModelLoaded(MI_GANG01 + 2 * gang) && if (CStreaming::HasModelLoaded(MI_GANG01 + 2 * gang) &&
CStreaming::HasModelLoaded(MI_GANG02 + 2 * gang)) CStreaming::HasModelLoaded(MI_GANG01+1 + 2 * gang))
return CGangs::GetGangVehicleModel(gang); return CGangs::GetGangVehicleModel(gang);
return -1; return -1;
} }

View File

@ -76,7 +76,7 @@ static int32 NextValidModelId(int32 mi, int32 step)
int32 i = mi; int32 i = mi;
while (result == -1) { while (result == -1) {
i += step; i += step;
if (i < 0 || i > 5500) { if (i < 0 || i > MODELINFOSIZE) {
step = -step; step = -step;
continue; continue;
} }
@ -86,7 +86,7 @@ static int32 NextValidModelId(int32 mi, int32 step)
continue; continue;
if (pInfo->GetModelType() == MITYPE_PED if (pInfo->GetModelType() == MITYPE_PED
#ifdef FIX_BUGS #ifdef FIX_BUGS
&& !(i >= MI_SPECIAL01 && i <= MI_SPECIAL04) && !(i >= MI_SPECIAL01 && i <= MI_SPECIAL21)
#endif #endif
|| pInfo->GetModelType() == MITYPE_VEHICLE && || pInfo->GetModelType() == MITYPE_VEHICLE &&
#ifdef FIX_BUGS #ifdef FIX_BUGS

View File

@ -5903,8 +5903,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
continue; continue;
if (pPed->bFadeOut) if (pPed->bFadeOut)
continue; continue;
if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN) // if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN)
continue; // continue;
if (!ThisIsAValidRandomPed(pPed->m_nPedType)) if (!ThisIsAValidRandomPed(pPed->m_nPedType))
continue; continue;
if (pPed->bIsLeader || pPed->m_leader) if (pPed->bIsLeader || pPed->m_leader)
@ -5952,8 +5952,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
continue; continue;
if (pPed->bFadeOut) if (pPed->bFadeOut)
continue; continue;
if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN) // if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN)
continue; // continue;
if (!ThisIsAValidRandomPed(pPed->m_nPedType)) if (!ThisIsAValidRandomPed(pPed->m_nPedType))
continue; continue;
if (pPed->bIsLeader || pPed->m_leader) if (pPed->bIsLeader || pPed->m_leader)

View File

@ -67,8 +67,6 @@ CEventList::RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent
switch(entityType){ switch(entityType){
case EVENT_ENTITY_PED: case EVENT_ENTITY_PED:
ref = CPools::GetPedRef((CPed*)ent); ref = CPools::GetPedRef((CPed*)ent);
if(ent->GetModelIndex() >= MI_GANG01 && ent->GetModelIndex() <= MI_CRIMINAL02)
copsDontCare = true;
break; break;
case EVENT_ENTITY_VEHICLE: case EVENT_ENTITY_VEHICLE:
ref = CPools::GetVehicleRef((CVehicle*)ent); ref = CPools::GetVehicleRef((CVehicle*)ent);

View File

@ -861,15 +861,16 @@ CFileLoader::LoadPedObject(const char *line)
{ {
int id; int id;
char model[24], txd[24]; char model[24], txd[24];
char pedType[24], pedStats[24], animGroup[24]; char pedType[24], pedStats[24], animGroup[24], animFile[16];
int carsCanDrive; int carsCanDrive;
CPedModelInfo *mi; CPedModelInfo *mi;
int animGroupId; int animGroupId;
int radio1, radio2;
if(sscanf(line, "%d %s %s %s %s %s %x", sscanf(line, "%d %s %s %s %s %s %x %s %d %d",
&id, model, txd, &id, model, txd,
pedType, pedStats, animGroup, &carsCanDrive) != 7) pedType, pedStats, animGroup, &carsCanDrive,
return; animFile, &radio1, &radio2);
mi = CModelInfo::AddPedModel(id); mi = CModelInfo::AddPedModel(id);
mi->SetName(model); mi->SetName(model);

View File

@ -140,9 +140,9 @@ void ChangePlayerCheat()
do do
{ {
do do
modelId = CGeneral::GetRandomNumberInRange(0, MI_CAS_WOM+1); modelId = CGeneral::GetRandomNumberInRange(0, MI_WFYG2+1);
while (!CModelInfo::GetModelInfo(modelId)); while (!CModelInfo::GetModelInfo(modelId));
} while (modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL04 || modelId == MI_TAXI_D); } while (modelId == MI_TAXI_D);
uint8 flags = CStreaming::ms_aInfoForModel[modelId].m_flags; uint8 flags = CStreaming::ms_aInfoForModel[modelId].m_flags;
ped->DeleteRwObject(); ped->DeleteRwObject();

View File

@ -108,8 +108,8 @@ enum Config {
NUMPEDROUTES = 200, NUMPEDROUTES = 200,
NUMPHONES = 50, NUMPHONES = 50,
NUMPEDGROUPS = 31, NUMPEDGROUPS = 67,
NUMMODELSPERPEDGROUP = 8, // TODO(MIAMI): 16 once we have peds NUMMODELSPERPEDGROUP = 16,
NUMSHOTINFOS = 100, NUMSHOTINFOS = 100,
NUMROADBLOCKS = 300, NUMROADBLOCKS = 300,

View File

@ -176,6 +176,14 @@ enum
MI_MEDIC, MI_MEDIC,
MI_FIREMAN, MI_FIREMAN,
MI_MALE01, MI_MALE01,
MI_TAXI_D = 28, // HMOCA
MI_GANG01 = 83, // CBa
MI_VICE1 = 97,
MI_WFYG2 = 106, // last regular ped
MI_SPECIAL01 = 109,
MI_SPECIAL21 = 129,
/*
MI_TAXI_D, MI_TAXI_D,
MI_PIMP, MI_PIMP,
MI_GANG01, MI_GANG01,
@ -256,6 +264,7 @@ enum
MI_BUSKER3, MI_BUSKER3,
MI_BUSKER4, MI_BUSKER4,
// three more peds possible // three more peds possible
*/
MI_FIRST_VEHICLE = 130, MI_FIRST_VEHICLE = 130,
MI_LANDSTAL = MI_FIRST_VEHICLE, MI_LANDSTAL = MI_FIRST_VEHICLE,

View File

@ -187,16 +187,18 @@ struct ColNodeInfo
float radius; float radius;
}; };
#define NUMPEDINFONODES 8 #define NUMPEDINFONODES 10
ColNodeInfo m_pColNodeInfos[NUMPEDINFONODES] = { ColNodeInfo m_pColNodeInfos[NUMPEDINFONODES] = {
{ nil, PED_HEAD, PEDPIECE_HEAD, 0.0f, 0.05f, 0.2f }, { nil, PED_HEAD, PEDPIECE_HEAD, 0.0f, 0.05f, 0.15f },
{ "Storso", 0, PEDPIECE_TORSO, 0.0f, 0.15f, 0.2f }, { nil, PED_MID, PEDPIECE_TORSO, 0.0f, 0.15f, 0.2f },
{ "Storso", 0, PEDPIECE_TORSO, 0.0f, -0.05f, 0.3f }, { nil, PED_MID, PEDPIECE_TORSO, 0.0f, -0.05f, 0.25f },
{ nil, PED_MID, PEDPIECE_MID, 0.0f, -0.07f, 0.3f }, { nil, PED_MID, PEDPIECE_MID, 0.0f, -0.25f, 0.25f },
{ nil, PED_UPPERARML, PEDPIECE_LEFTARM, 0.07f, -0.1f, 0.2f }, { nil, PED_UPPERARML, PEDPIECE_LEFTARM, 0.03f, -0.05f, 0.16f },
{ nil, PED_UPPERARMR, PEDPIECE_RIGHTARM, -0.07f, -0.1f, 0.2f }, { nil, PED_UPPERARMR, PEDPIECE_RIGHTARM, -0.03f, -0.05f, 0.16f },
{ "Slowerlegl", 0, PEDPIECE_LEFTLEG, 0.0f, 0.07f, 0.25f }, { nil, PED_LOWERLEGL, PEDPIECE_LEFTLEG, 0.0f, 0.15f, 0.2f },
{ nil, PED_LOWERLEGR, PEDPIECE_RIGHTLEG, 0.0f, 0.07f, 0.25f }, { nil, PED_LOWERLEGR, PEDPIECE_RIGHTLEG, 0.0f, 0.15f, 0.2f },
{ nil, PED_FOOTL, PEDPIECE_LEFTLEG, 0.0f, 0.15f, 0.15f },
{ nil, PED_FOOTR, PEDPIECE_RIGHTLEG, 0.0f, 0.15f, 0.15f },
}; };
RwObject* RwObject*

View File

@ -5,8 +5,8 @@
#include "PedStats.h" #include "PedStats.h"
enum PedNode { enum PedNode {
PED_TORSO, PED_TORSO = 0, // has no bone!
PED_MID, // Smid on PS2/PC, Storso on mobile/xbox PED_MID,
PED_HEAD, PED_HEAD,
PED_UPPERARML, PED_UPPERARML,
PED_UPPERARMR, PED_UPPERARMR,
@ -17,7 +17,15 @@ enum PedNode {
PED_FOOTL, PED_FOOTL,
PED_FOOTR, PED_FOOTR,
PED_LOWERLEGR, PED_LOWERLEGR,
PED_NODE_MAX// Not valid: PED_LOWERLEGL PED_LOWERLEGL,
PED_FOREARML,
PED_FOREARMR,
PED_CLAVICLEL,
PED_CLAVICLER,
PED_NECK,
PED_NODE_MAX
}; };
class CPedModelInfo : public CClumpModelInfo class CPedModelInfo : public CClumpModelInfo

View File

@ -21,12 +21,6 @@ CCutsceneObject::CCutsceneObject(void)
ObjectCreatedBy = CUTSCENE_OBJECT; ObjectCreatedBy = CUTSCENE_OBJECT;
m_fMass = 1.0f; m_fMass = 1.0f;
m_fTurnMass = 1.0f; m_fTurnMass = 1.0f;
#ifdef PED_SKIN
bRenderHead = true;
bRenderRightHand = true;
bRenderLeftHand = true;
#endif
} }
void void
@ -85,47 +79,9 @@ CCutsceneObject::PreRender(void)
void void
CCutsceneObject::Render(void) CCutsceneObject::Render(void)
{ {
#ifdef PED_SKIN
if(IsClumpSkinned(GetClump())){
if(bRenderLeftHand) RenderLimb(BONE_Lhand);
if(bRenderRightHand) RenderLimb(BONE_Rhand);
if(bRenderHead) RenderLimb(BONE_head);
}
#endif
CObject::Render(); CObject::Render();
} }
#ifdef PED_SKIN
void
CCutsceneObject::RenderLimb(int32 bone)
{
RpAtomic *atomic;
CPedModelInfo *mi = (CPedModelInfo *)CModelInfo::GetModelInfo(GetModelIndex());
switch(bone){
case BONE_head:
atomic = mi->getHead();
break;
case BONE_Lhand:
atomic = mi->getLeftHand();
break;
case BONE_Rhand:
atomic = mi->getRightHand();
break;
default:
return;
}
if(atomic){
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump());
int idx = RpHAnimIDGetIndex(hier, bone);
RwMatrix *mat = &RpHAnimHierarchyGetMatrixArray(hier)[idx];
RwFrame *frame = RpAtomicGetFrame(atomic);
*RwFrameGetMatrix(frame) = *mat;
RwFrameUpdateObjects(frame);
RpAtomicRender(atomic);
}
}
#endif
bool bool
CCutsceneObject::SetupLighting(void) CCutsceneObject::SetupLighting(void)
{ {

View File

@ -5,29 +5,12 @@
class CCutsceneObject : public CObject class CCutsceneObject : public CObject
{ {
public: public:
#ifdef PED_SKIN
bool bRenderHead;
bool bRenderRightHand;
bool bRenderLeftHand;
bool GetRenderHead(void) { return bRenderHead; }
bool GetRenderRightHand(void) { return bRenderRightHand; }
bool GetRenderLeftHand(void) { return bRenderLeftHand; }
void SetRenderHead(bool render) { bRenderHead = render; }
void SetRenderRightHand(bool render) { bRenderRightHand = render; }
void SetRenderLeftHand(bool render) { bRenderLeftHand = render; }
#endif
CCutsceneObject(void); CCutsceneObject(void);
void SetModelIndex(uint32 id); void SetModelIndex(uint32 id);
void ProcessControl(void); void ProcessControl(void);
void PreRender(void); void PreRender(void);
void Render(void); void Render(void);
void RenderLimb(int32 bone);
bool SetupLighting(void); bool SetupLighting(void);
void RemoveLighting(bool reset); void RemoveLighting(bool reset);
}; };
#ifndef PED_SKIN
static_assert(sizeof(CCutsceneObject) == 0x198, "CCutsceneObject: error");
#endif

View File

@ -8036,83 +8036,11 @@ CPed::GetNextPointOnRoute(void)
return nextPoint; return nextPoint;
} }
// These categories are purely random, most of ped models have no correlation. So I don't think making an enum.
uint8 uint8
CPed::GetPedRadioCategory(uint32 modelIndex) CPed::GetPedRadioCategory(uint32 modelIndex)
{ {
switch (modelIndex) { // TODO(MIAMI): remove this function and use modelinfo for radio
case MI_MALE01: return 1;
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;
}
} }
// Some kind of VC leftover I think // Some kind of VC leftover I think

View File

@ -33,13 +33,18 @@ CPedIK::CPedIK(CPed *ped)
#ifdef PED_SKIN #ifdef PED_SKIN
inline RwMatrix* inline RwMatrix*
GetComponentMatrix(CPed *ped, int32 node) GetBoneMatrix(CPed *ped, int32 bone)
{ {
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(ped->GetClump()); RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(ped->GetClump());
int idx = RpHAnimIDGetIndex(hier, ped->m_pFrames[node]->nodeID); int idx = RpHAnimIDGetIndex(hier, bone);
RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier); RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
return &mats[idx]; return &mats[idx];
} }
inline RwMatrix*
GetComponentMatrix(CPed *ped, int32 node)
{
return GetBoneMatrix(ped, ped->m_pFrames[node]->nodeID);
}
#endif #endif
void void
@ -245,7 +250,7 @@ CPedIK::LookInDirection(float phi, float theta)
} }
// parent of head is torso // parent of head is torso
RwMatrix worldMat = *GetComponentMatrix(m_ped, BONE_torso); RwMatrix worldMat = *GetComponentMatrix(m_ped, PED_NECK);
ExtractYawAndPitchWorld(&worldMat, &yaw, &pitch); ExtractYawAndPitchWorld(&worldMat, &yaw, &pitch);
LimbMoveStatus headStatus = MoveLimb(m_headOrient, CGeneral::LimitRadianAngle(phi - yaw), LimbMoveStatus headStatus = MoveLimb(m_headOrient, CGeneral::LimitRadianAngle(phi - yaw),

View File

@ -37,6 +37,11 @@ enum ePedStats
PEDSTAT_SPORTSFAN, PEDSTAT_SPORTSFAN,
PEDSTAT_SHOPPER, PEDSTAT_SHOPPER,
PEDSTAT_OLDSHOPPER, PEDSTAT_OLDSHOPPER,
PEDSTAT_BEACH_GUY,
PEDSTAT_BEACH_GIRL,
PEDSTAT_SKATER,
PEDSTAT_STD_MISSION,
PEDSTAT_COWARD,
NUM_PEDSTATS NUM_PEDSTATS
}; };