mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 18:40:02 +00:00
CClumpModelInfo; little fixes
This commit is contained in:
parent
f0442960a2
commit
1b936f6ffb
|
@ -382,7 +382,11 @@ CWorld::ProcessVerticalLine(const CVector &point1, float z2, CColPoint &point, C
|
||||||
{
|
{
|
||||||
AdvanceCurrentScanCode();
|
AdvanceCurrentScanCode();
|
||||||
CVector point2(point1.x, point1.y, z2);
|
CVector point2(point1.x, point1.y, z2);
|
||||||
return ProcessVerticalLineSector(*GetSector(GetSectorIndexX(point1.x), GetSectorIndexY(point1.y)),
|
int secX = GetSectorIndexX(point1.x);
|
||||||
|
int secY = GetSectorIndexY(point1.y);
|
||||||
|
secX = clamp(secX, 0, NUMSECTORS_X-1);
|
||||||
|
secY = clamp(secY, 0, NUMSECTORS_Y-1);
|
||||||
|
return ProcessVerticalLineSector(*GetSector(secX, secY),
|
||||||
CColLine(point1, point2), point, entity, checkBuildings, checkVehicles,
|
CColLine(point1, point2), point, entity, checkBuildings, checkVehicles,
|
||||||
checkPeds, checkObjects, checkDummies, ignoreSeeThrough, poly);
|
checkPeds, checkObjects, checkDummies, ignoreSeeThrough, poly);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "NodeName.h"
|
#include "NodeName.h"
|
||||||
#include "VisibilityPlugins.h"
|
#include "VisibilityPlugins.h"
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
|
#include "AnimManager.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
CClumpModelInfo::DeleteRwObject(void)
|
CClumpModelInfo::DeleteRwObject(void)
|
||||||
|
@ -13,17 +14,17 @@ CClumpModelInfo::DeleteRwObject(void)
|
||||||
RpClumpDestroy(m_clump);
|
RpClumpDestroy(m_clump);
|
||||||
m_clump = nil;
|
m_clump = nil;
|
||||||
RemoveTexDictionaryRef();
|
RemoveTexDictionaryRef();
|
||||||
|
if(GetAnimFileIndex() != -1)
|
||||||
|
CAnimManager::RemoveAnimBlockRef(GetAnimFileIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PED_SKIN
|
|
||||||
static RpAtomic*
|
static RpAtomic*
|
||||||
SetHierarchyForSkinAtomic(RpAtomic *atomic, void *data)
|
SetHierarchyForSkinAtomic(RpAtomic *atomic, void *data)
|
||||||
{
|
{
|
||||||
RpSkinAtomicSetHAnimHierarchy(atomic, (RpHAnimHierarchy*)data);
|
RpSkinAtomicSetHAnimHierarchy(atomic, (RpHAnimHierarchy*)data);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
RwObject*
|
RwObject*
|
||||||
CClumpModelInfo::CreateInstance(void)
|
CClumpModelInfo::CreateInstance(void)
|
||||||
|
@ -31,24 +32,17 @@ CClumpModelInfo::CreateInstance(void)
|
||||||
if(m_clump == nil)
|
if(m_clump == nil)
|
||||||
return nil;
|
return nil;
|
||||||
RpClump *clone = RpClumpClone(m_clump);
|
RpClump *clone = RpClumpClone(m_clump);
|
||||||
#ifdef PED_SKIN
|
|
||||||
if(IsClumpSkinned(clone)){
|
if(IsClumpSkinned(clone)){
|
||||||
RpHAnimHierarchy *hier;
|
RpHAnimHierarchy *hier;
|
||||||
RpHAnimAnimation *anim;
|
RpHAnimAnimation *anim;
|
||||||
|
|
||||||
hier = GetAnimHierarchyFromClump(clone);
|
hier = GetAnimHierarchyFromClump(clone);
|
||||||
assert(hier);
|
assert(hier);
|
||||||
// This seems dangerous as only the first atomic will get a hierarchy
|
|
||||||
// can we guarantee this if hands and head are also in the clump?
|
|
||||||
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:
|
|
||||||
// RpSkinGetNumBones(RpSkinGeometryGetSkin(RpAtomicGetGeometry(IsClumpSkinned(clone))));
|
|
||||||
RpHAnimHierarchyUpdateMatrices(hier);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return (RwObject*)clone;
|
return (RwObject*)clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,31 +70,19 @@ CClumpModelInfo::SetClump(RpClump *clump)
|
||||||
m_clump = clump;
|
m_clump = clump;
|
||||||
CVisibilityPlugins::SetClumpModelInfo(m_clump, this);
|
CVisibilityPlugins::SetClumpModelInfo(m_clump, this);
|
||||||
AddTexDictionaryRef();
|
AddTexDictionaryRef();
|
||||||
RpClumpForAllAtomics(clump, SetAtomicRendererCB, nil);
|
if(GetAnimFileIndex() != -1)
|
||||||
|
CAnimManager::AddAnimBlockRef(GetAnimFileIndex());
|
||||||
|
|
||||||
// TODO: also set for player?
|
|
||||||
if(strncmp(GetName(), "playerh", 8) == 0)
|
|
||||||
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
|
|
||||||
|
|
||||||
#ifdef PED_SKIN
|
|
||||||
if(IsClumpSkinned(clump)){
|
if(IsClumpSkinned(clump)){
|
||||||
int i;
|
int i;
|
||||||
RpHAnimHierarchy *hier;
|
RpHAnimHierarchy *hier;
|
||||||
RpAtomic *skinAtomic;
|
RpAtomic *skinAtomic;
|
||||||
RpSkin *skin;
|
RpSkin *skin;
|
||||||
|
|
||||||
// mobile:
|
|
||||||
// hier = nil;
|
|
||||||
// RwFrameForAllChildren(RpClumpGetFrame(clump), GetHierarchyFromChildNodesCB, &hier);
|
|
||||||
// assert(hier);
|
|
||||||
// RpClumpForAllAtomics(clump, SetHierarchyForSkinAtomic, hier);
|
|
||||||
// skinAtomic = GetFirstAtomic(clump);
|
|
||||||
|
|
||||||
// xbox:
|
|
||||||
hier = GetAnimHierarchyFromClump(clump);
|
hier = GetAnimHierarchyFromClump(clump);
|
||||||
assert(hier);
|
assert(hier);
|
||||||
RpSkinAtomicSetHAnimHierarchy(IsClumpSkinned(clump), hier);
|
RpClumpForAllAtomics(clump, SetHierarchyForSkinAtomic, hier);
|
||||||
skinAtomic = IsClumpSkinned(clump);
|
skinAtomic = GetFirstAtomic(clump);
|
||||||
|
|
||||||
assert(skinAtomic);
|
assert(skinAtomic);
|
||||||
skin = RpSkinGeometryGetSkin(RpAtomicGetGeometry(skinAtomic));
|
skin = RpSkinGeometryGetSkin(RpAtomicGetGeometry(skinAtomic));
|
||||||
|
@ -113,9 +95,29 @@ 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CClumpModelInfo::SetAnimFile(const char *file)
|
||||||
|
{
|
||||||
|
if(strcasecmp(file, "null") == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_animFileName = new char[strlen(file)+1];
|
||||||
|
strcpy(m_animFileName, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CClumpModelInfo::ConvertAnimFileIndex(void)
|
||||||
|
{
|
||||||
|
if(m_animFileIndex != -1){
|
||||||
|
// we have a string pointer in that union
|
||||||
|
int32 index = CAnimManager::GetAnimationBlockIndex(m_animFileName);
|
||||||
|
delete[] m_animFileName;
|
||||||
|
m_animFileIndex = index;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -139,27 +141,26 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--MIAMI: unused
|
||||||
RwFrame*
|
RwFrame*
|
||||||
CClumpModelInfo::FindFrameFromNameCB(RwFrame *frame, void *data)
|
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 +168,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*
|
||||||
|
|
|
@ -30,9 +30,13 @@ class CClumpModelInfo : public CBaseModelInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RpClump *m_clump;
|
RpClump *m_clump;
|
||||||
|
union {
|
||||||
|
int32 m_animFileIndex;
|
||||||
|
char *m_animFileName;
|
||||||
|
};
|
||||||
|
|
||||||
CClumpModelInfo(void) : CBaseModelInfo(MITYPE_CLUMP) {}
|
CClumpModelInfo(void) : CBaseModelInfo(MITYPE_CLUMP) { m_animFileIndex = -1; }
|
||||||
CClumpModelInfo(ModelInfoType id) : CBaseModelInfo(id) {}
|
CClumpModelInfo(ModelInfoType id) : CBaseModelInfo(id) { m_animFileIndex = -1; }
|
||||||
~CClumpModelInfo() {}
|
~CClumpModelInfo() {}
|
||||||
void DeleteRwObject(void);
|
void DeleteRwObject(void);
|
||||||
RwObject *CreateInstance(void);
|
RwObject *CreateInstance(void);
|
||||||
|
@ -40,6 +44,9 @@ public:
|
||||||
RwObject *GetRwObject(void) { return (RwObject*)m_clump; }
|
RwObject *GetRwObject(void) { return (RwObject*)m_clump; }
|
||||||
|
|
||||||
virtual void SetClump(RpClump *);
|
virtual void SetClump(RpClump *);
|
||||||
|
virtual void SetAnimFile(const char *file);
|
||||||
|
virtual void ConvertAnimFileIndex(void);
|
||||||
|
virtual int GetAnimFileIndex(void) { return m_animFileIndex; }
|
||||||
|
|
||||||
static RpAtomic *SetAtomicRendererCB(RpAtomic *atomic, void *data);
|
static RpAtomic *SetAtomicRendererCB(RpAtomic *atomic, void *data);
|
||||||
void SetFrameIds(RwObjectNameIdAssocation *assocs);
|
void SetFrameIds(RwObjectNameIdAssocation *assocs);
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "AnimManager.h"
|
#include "AnimManager.h"
|
||||||
#include "VisibilityPlugins.h"
|
#include "VisibilityPlugins.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
void
|
void
|
||||||
CWeaponModelInfo::SetAnimFile(const char *file)
|
CWeaponModelInfo::SetAnimFile(const char *file)
|
||||||
{
|
{
|
||||||
|
|
|
@ -398,10 +398,10 @@ CBoat::ProcessControl(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slow down or push down boat as it approaches the world limits
|
// Slow down or push down boat as it approaches the world limits
|
||||||
m_vecMoveSpeed.x = Min(m_vecMoveSpeed.x, -(GetPosition().x - 1900.0f)*0.01f); // east
|
m_vecMoveSpeed.x = Min(m_vecMoveSpeed.x, -(GetPosition().x - (WORLD_MAX_X-50.0f))*0.01f); // east
|
||||||
m_vecMoveSpeed.x = Max(m_vecMoveSpeed.x, -(GetPosition().x - -1515.0f)*0.01f); // west
|
m_vecMoveSpeed.x = Max(m_vecMoveSpeed.x, -(GetPosition().x - (WORLD_MIN_X+50.0f))*0.01f); // west
|
||||||
m_vecMoveSpeed.y = Min(m_vecMoveSpeed.y, -(GetPosition().y - 600.0f)*0.01f); // north
|
m_vecMoveSpeed.y = Min(m_vecMoveSpeed.y, -(GetPosition().y - (WORLD_MAX_Y-50.0f))*0.01f); // north
|
||||||
m_vecMoveSpeed.y = Max(m_vecMoveSpeed.y, -(GetPosition().y - -1900.0f)*0.01f); // south
|
m_vecMoveSpeed.y = Max(m_vecMoveSpeed.y, -(GetPosition().y - (WORLD_MIN_Y+50.0f))*0.01f); // south
|
||||||
|
|
||||||
if(!onLand && bBoatInWater)
|
if(!onLand && bBoatInWater)
|
||||||
ApplyWaterResistance();
|
ApplyWaterResistance();
|
||||||
|
|
|
@ -806,7 +806,7 @@ CPlane::LoadPath(char const *filename, int32 &numNodes, float &totalLength, bool
|
||||||
|
|
||||||
for(i = 0; i < numNodes; i++){
|
for(i = 0; i < numNodes; i++){
|
||||||
*gString = '\0';
|
*gString = '\0';
|
||||||
for(lp = 0; work_buff[bp] != '\n'; bp++, lp++)
|
for(lp = 0; work_buff[bp] != '\n' && work_buff[bp] != '\0'; bp++, lp++)
|
||||||
gString[lp] = work_buff[bp];
|
gString[lp] = work_buff[bp];
|
||||||
bp++;
|
bp++;
|
||||||
// BUG: game doesn't terminate string
|
// BUG: game doesn't terminate string
|
||||||
|
|
Loading…
Reference in a new issue