fixed key binding, head shots, freezes

This commit is contained in:
aap 2019-06-23 01:01:21 +02:00
parent 0126bef9a1
commit 047fa20f28
6 changed files with 20 additions and 22 deletions

View file

@ -2055,6 +2055,7 @@ STARTPATCHES
InjectHook(0x494450, CPad::ResetCheats, PATCH_JUMP); InjectHook(0x494450, CPad::ResetCheats, PATCH_JUMP);
InjectHook(0x4944B0, CPad::EditString, PATCH_JUMP); InjectHook(0x4944B0, CPad::EditString, PATCH_JUMP);
InjectHook(0x494690, CPad::EditCodesForControls, PATCH_JUMP); InjectHook(0x494690, CPad::EditCodesForControls, PATCH_JUMP);
//InjectHook(0x494E50, `global constructor keyed to'Pad.cpp, PATCH_JUMP); //InjectHook(0x494E50, `global constructor keyed to'Pad.cpp, PATCH_JUMP);
//InjectHook(0x494EB0, sub_494EB0, PATCH_JUMP); //InjectHook(0x494EB0, sub_494EB0, PATCH_JUMP);
//InjectHook(0x494ED0, &CPad::~CPad, PATCH_JUMP); //InjectHook(0x494ED0, &CPad::~CPad, PATCH_JUMP);

View file

@ -292,7 +292,7 @@ public:
// keyboard // keyboard
inline bool GetCharJustDown(char c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); } inline bool GetCharJustDown(int32 c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); }
inline bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); } inline bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); }
inline bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); } inline bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); }
inline bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); } inline bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); }

View file

@ -236,7 +236,7 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP
if(((CPed*)e)->UseGroundColModel()) if(((CPed*)e)->UseGroundColModel())
colmodel = &CTempColModels::ms_colModelPedGroundHit; colmodel = &CTempColModels::ms_colModelPedGroundHit;
else else
colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(); colmodel = ((CPedModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex()))->GetHitColModel();
}else }else
colmodel = nil; colmodel = nil;
}else if(e->bUsesCollision) }else if(e->bUsesCollision)

View file

@ -388,8 +388,7 @@ void
CPed::RemoveBodyPart(PedNode nodeId, int8 unk) CPed::RemoveBodyPart(PedNode nodeId, int8 unk)
{ {
RwFrame *frame; RwFrame *frame;
RwFrame *fp; RwV3d pos;
RwV3d zero;
frame = GetNodeFrame(nodeId); frame = GetNodeFrame(nodeId);
if (frame) { if (frame) {
@ -398,20 +397,20 @@ CPed::RemoveBodyPart(PedNode nodeId, int8 unk)
CPed::SpawnFlyingComponent(nodeId, unk); CPed::SpawnFlyingComponent(nodeId, unk);
RecurseFrameChildrenVisibilityCB(frame, 0); RecurseFrameChildrenVisibilityCB(frame, 0);
zero.x = 0.0f; pos.x = 0.0f;
zero.z = 0.0f; pos.z = 0.0f;
zero.y = 0.0f; pos.y = 0.0f;
for (fp = RwFrameGetParent(frame); fp; fp = RwFrameGetParent(frame)) for (frame = RwFrameGetParent(frame); frame; frame = RwFrameGetParent(frame))
RwV3dTransformPoints(&zero, &zero, 1, &fp->modelling); RwV3dTransformPoints(&pos, &pos, 1, RwFrameGetMatrix(frame));
if (CEntity::GetIsOnScreen()) { if (CEntity::GetIsOnScreen()) {
CParticle::AddParticle(PARTICLE_TEST, zero, CParticle::AddParticle(PARTICLE_TEST, pos,
CVector(0.0f, 0.0f, 0.0f), CVector(0.0f, 0.0f, 0.0f),
nil, 0.2f, 0, 0, 0, 0); nil, 0.2f, 0, 0, 0, 0);
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, CParticle::AddParticle(PARTICLE_BLOOD_SMALL,
zero, pos,
CVector(0.0f, 0.0f, 0.03f), CVector(0.0f, 0.0f, 0.03f),
nil, 0.0f, 0, 0, 0, 0); nil, 0.0f, 0, 0, 0, 0);
} }
@ -642,10 +641,9 @@ CPed::Attack(void)
CAnimBlendAssociation *weaponAnimAssoc; CAnimBlendAssociation *weaponAnimAssoc;
int32 weaponAnim; int32 weaponAnim;
float animStart; float animStart;
RwFrame *f; RwFrame *frame;
eWeaponType ourWeaponType; eWeaponType ourWeaponType;
float weaponAnimTime; float weaponAnimTime;
RwFrame *i;
eWeaponFire ourWeaponFire; eWeaponFire ourWeaponFire;
float animEnd; float animEnd;
CWeaponInfo *ourWeapon; CWeaponInfo *ourWeapon;
@ -718,14 +716,12 @@ CPed::Attack(void)
firePos = GetMatrix() * firePos; firePos = GetMatrix() * firePos;
} else if (ourWeaponType != WEAPONTYPE_UNARMED) { } else if (ourWeaponType != WEAPONTYPE_UNARMED) {
if (weaponAnimAssoc->animId == ANIM_KICK_FLOOR) if (weaponAnimAssoc->animId == ANIM_KICK_FLOOR)
f = GetNodeFrame(PED_FOOTR); frame = GetNodeFrame(PED_FOOTR);
else else
f = GetNodeFrame(PED_HANDR); frame = GetNodeFrame(PED_HANDR);
while (f) { for (; frame; frame = RwFrameGetParent(frame))
RwV3dTransformPoints((RwV3d*)firePos, (RwV3d*)firePos, 1, &f->modelling); RwV3dTransformPoints((RwV3d*)firePos, (RwV3d*)firePos, 1, RwFrameGetMatrix(frame));
f = RwFrameGetParent(f);
}
} else { } else {
firePos = GetMatrix() * firePos; firePos = GetMatrix() * firePos;
} }
@ -773,8 +769,8 @@ CPed::Attack(void)
firePos = ourWeapon->m_vecFireOffset; firePos = ourWeapon->m_vecFireOffset;
if (weaponAnimTime > 1.0f && weaponAnimTime - weaponAnimAssoc->timeStep <= 1.0f && weaponAnimAssoc->IsRunning()) { if (weaponAnimTime > 1.0f && weaponAnimTime - weaponAnimAssoc->timeStep <= 1.0f && weaponAnimAssoc->IsRunning()) {
for (i = GetNodeFrame(PED_HANDR); i; i = RwFrameGetParent(i)) for (frame = GetNodeFrame(PED_HANDR); frame; frame = RwFrameGetParent(frame))
RwV3dTransformPoints((RwV3d*)firePos, (RwV3d*)firePos, 1, &i->modelling); RwV3dTransformPoints((RwV3d*)firePos, (RwV3d*)firePos, 1, RwFrameGetMatrix(frame));
CVector gunshellPos( CVector gunshellPos(
firePos.x - 0.6f * GetForward().x, firePos.x - 0.6f * GetForward().x,

View file

@ -1790,7 +1790,7 @@ CPhysical::ProcessCollision(void)
if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){ if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){
if(ped->IsPlayer()) if(ped->IsPlayer())
n = min(NUMSTEPS(0.2f), 2.0); n = max(NUMSTEPS(0.2f), 2.0);
else else
n = NUMSTEPS(0.3f); n = NUMSTEPS(0.3f);
step = savedTimeStep / n; step = savedTimeStep / n;

View file

@ -38,6 +38,7 @@ public:
void SetLowDetailClump(RpClump*); void SetLowDetailClump(RpClump*);
void CreateHitColModel(void); void CreateHitColModel(void);
CColModel *GetHitColModel(void) { return m_hitColModel; }
void DeleteRwObject_(void) { this->CPedModelInfo::DeleteRwObject(); } void DeleteRwObject_(void) { this->CPedModelInfo::DeleteRwObject(); }