Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bigbossbro08 2020-05-10 22:05:45 +06:00
commit bd302ecca1
8 changed files with 34 additions and 23 deletions

View File

@ -22,7 +22,7 @@ enum AssocGroupId
ASSOCGRP_BUSYWOMAN, ASSOCGRP_BUSYWOMAN,
ASSOCGRP_SEXYWOMAN, ASSOCGRP_SEXYWOMAN,
ASSOCGRP_OLDWOMAN, ASSOCGRP_OLDWOMAN,
ASSOCGRP_FARWOMAN, ASSOCGRP_FATWOMAN,
ASSOCGRP_PANICCHUNKY, ASSOCGRP_PANICCHUNKY,
ASSOCGRP_PLAYERBACK, ASSOCGRP_PLAYERBACK,
ASSOCGRP_PLAYERLEFT, ASSOCGRP_PLAYERLEFT,

View File

@ -78,7 +78,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;
} }

View File

@ -783,7 +783,7 @@ CFileLoader::LoadVehicleObject(const char *line)
mi->SetTexDictionary(txd); mi->SetTexDictionary(txd);
for(p = gamename; *p; p++) for(p = gamename; *p; p++)
if(*p == '_') *p = ' '; if(*p == '_') *p = ' ';
strncpy(mi->m_gameName, gamename, 32); strcpy(mi->m_gameName, gamename);
mi->m_level = level; mi->m_level = level;
mi->m_compRules = comprules; mi->m_compRules = comprules;

View File

@ -43,7 +43,7 @@ CClumpModelInfo::CreateInstance(void)
RpClumpForAllAtomics(clone, SetHierarchyForSkinAtomic, hier); RpClumpForAllAtomics(clone, SetHierarchyForSkinAtomic, hier);
anim = HAnimAnimationCreateForHierarchy(hier); anim = HAnimAnimationCreateForHierarchy(hier);
RpHAnimHierarchySetCurrentAnim(hier, anim); RpHAnimHierarchySetCurrentAnim(hier, anim);
// RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS)); RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS));
// the rest is xbox only: // the rest is xbox only:
// RpSkinGetNumBones(RpSkinGeometryGetSkin(RpAtomicGetGeometry(IsClumpSkinned(clone)))); // RpSkinGetNumBones(RpSkinGeometryGetSkin(RpAtomicGetGeometry(IsClumpSkinned(clone))));
RpHAnimHierarchyUpdateMatrices(hier); RpHAnimHierarchyUpdateMatrices(hier);
@ -113,7 +113,7 @@ CClumpModelInfo::SetClump(RpClump *clump)
weights->w2 /= sum; weights->w2 /= sum;
weights->w3 /= sum; weights->w3 /= sum;
} }
// RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS)); RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS));
} }
#endif #endif
} }
@ -139,13 +139,12 @@ CClumpModelInfo::FindFrameFromIdCB(RwFrame *frame, void *data)
{ {
RwObjectIdAssociation *assoc = (RwObjectIdAssociation*)data; RwObjectIdAssociation *assoc = (RwObjectIdAssociation*)data;
if(CVisibilityPlugins::GetFrameHierarchyId(frame) != assoc->id){ if(CVisibilityPlugins::GetFrameHierarchyId(frame) == assoc->id){
RwFrameForAllChildren(frame, FindFrameFromIdCB, assoc);
return assoc->frame ? nil : frame;
}else{
assoc->frame = frame; assoc->frame = frame;
return nil; return nil;
} }
RwFrameForAllChildren(frame, FindFrameFromIdCB, assoc);
return assoc->frame ? nil : frame;
} }
RwFrame* RwFrame*
@ -153,13 +152,12 @@ CClumpModelInfo::FindFrameFromNameCB(RwFrame *frame, void *data)
{ {
RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data; RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data;
if(CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){ if(!CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){
RwFrameForAllChildren(frame, FindFrameFromNameCB, assoc);
return assoc->frame ? nil : frame;
}else{
assoc->frame = frame; assoc->frame = frame;
return nil; return nil;
} }
RwFrameForAllChildren(frame, FindFrameFromNameCB, assoc);
return assoc->frame ? nil : frame;
} }
RwFrame* RwFrame*
@ -167,14 +165,13 @@ CClumpModelInfo::FindFrameFromNameWithoutIdCB(RwFrame *frame, void *data)
{ {
RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data; RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data;
if(CVisibilityPlugins::GetFrameHierarchyId(frame) || if(CVisibilityPlugins::GetFrameHierarchyId(frame) == 0 &&
CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){ !CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){
RwFrameForAllChildren(frame, FindFrameFromNameWithoutIdCB, assoc);
return assoc->frame ? nil : frame;
}else{
assoc->frame = frame; assoc->frame = frame;
return nil; return nil;
} }
RwFrameForAllChildren(frame, FindFrameFromNameWithoutIdCB, assoc);
return assoc->frame ? nil : frame;
} }
RwFrame* RwFrame*

View File

@ -36,7 +36,8 @@ public:
static RwObjectNameIdAssocation m_pPedIds[PED_NODE_MAX]; static RwObjectNameIdAssocation m_pPedIds[PED_NODE_MAX];
CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) { } CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) { m_hitColModel = nil; }
~CPedModelInfo(void) { delete m_hitColModel; }
void DeleteRwObject(void); void DeleteRwObject(void);
void SetClump(RpClump *); void SetClump(RpClump *);

View File

@ -150,7 +150,7 @@ void
CSimpleModelInfo::SetupBigBuilding(void) CSimpleModelInfo::SetupBigBuilding(void)
{ {
CSimpleModelInfo *related; CSimpleModelInfo *related;
if(m_lodDistances[0] > LOD_DISTANCE && m_atomics[2] == nil){ if(m_lodDistances[0] > LOD_DISTANCE && GetRelatedModel() == nil){
m_isBigBuilding = 1; m_isBigBuilding = 1;
FindRelatedModel(); FindRelatedModel();
related = GetRelatedModel(); related = GetRelatedModel();

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 = *GetBoneMatrix(m_ped, BONE_torso);
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

@ -147,7 +147,11 @@ CVisibilityPlugins::RenderFadingEntities(void)
if(e->m_rwObject == nil) if(e->m_rwObject == nil)
continue; continue;
mi = (CSimpleModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex()); mi = (CSimpleModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex());
#ifdef FIX_BUGS
if(mi->GetModelType() == MITYPE_SIMPLE && mi->m_noZwrite)
#else
if(mi->m_noZwrite) if(mi->m_noZwrite)
#endif
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
if(e->bDistanceFade){ if(e->bDistanceFade){
@ -159,7 +163,11 @@ CVisibilityPlugins::RenderFadingEntities(void)
}else }else
CRenderer::RenderOneNonRoad(e); CRenderer::RenderOneNonRoad(e);
#ifdef FIX_BUGS
if(mi->GetModelType() == MITYPE_SIMPLE && mi->m_noZwrite)
#else
if(mi->m_noZwrite) if(mi->m_noZwrite)
#endif
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
} }
} }