implemented skinned peds, no cutscene hands yet

This commit is contained in:
aap
2020-04-23 22:25:18 +02:00
parent 6467e2003a
commit f03b4eec4c
49 changed files with 1869 additions and 301 deletions

View File

@ -367,7 +367,12 @@ CAnimViewer::Update(void)
} else {
// Originally it was GetPad(1)->LeftShoulder2
if (pad->NewState.Triangle) {
CPedModelInfo::AnimatePedColModel(((CPedModelInfo*)CModelInfo::GetModelInfo(pTarget->m_modelIndex))->GetHitColModel(), RpClumpGetFrame(pTarget->GetClump()));
#ifdef PED_SKIN
if(IsClumpSkinned(pTarget->GetClump()))
((CPedModelInfo*)CModelInfo::GetModelInfo(pTarget->m_modelIndex))->AnimatePedColModelSkinned(pTarget->GetClump());
else
#endif
CPedModelInfo::AnimatePedColModel(((CPedModelInfo*)CModelInfo::GetModelInfo(pTarget->m_modelIndex))->GetHitColModel(), RpClumpGetFrame(pTarget->GetClump()));
AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString);
CMessages::AddMessage(gUString, 100, 0);
}

View File

@ -2776,17 +2776,20 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
if(CamTargetEntity->IsPed()){
// static bool FailedTestTwelveFramesAgo = false; // unused
RwV3d HeadPos = vecHeadCamOffset;
CVector HeadPos = vecHeadCamOffset;
CVector TargetCoors;
// needs fix for SKINNING
RwFrame *frm = ((CPed*)CamTargetEntity)->GetNodeFrame(PED_HEAD);
((CPed*)CamTargetEntity)->TransformToNode(HeadPos, PED_HEAD);
// This is done on PC, but checking for the clump frame is not necessary apparently
/*
RwFrame *frm = ((CPed*)CamTargetEntity)->m_pFrames[PED_HEAD]->frame;
while(frm){
RwV3dTransformPoints(&HeadPos, &HeadPos, 1, RwFrameGetMatrix(frm));
frm = RwFrameGetParent(frm);
if(frm == RpClumpGetFrame(CamTargetEntity->GetClump()))
frm = nil;
}
*/
if(ResetStatics){
Beta = TargetOrientation;
@ -2813,13 +2816,13 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
m_vecBufferedPlayerBodyOffset.z =
TheCamera.m_fGaitSwayBuffer * m_vecBufferedPlayerBodyOffset.z +
(1.0f-TheCamera.m_fGaitSwayBuffer) * HeadPos.z;
HeadPos = (CamTargetEntity->GetMatrix() * m_vecBufferedPlayerBodyOffset).toRwV3d();
HeadPos = (CamTargetEntity->GetMatrix() * m_vecBufferedPlayerBodyOffset);
}else{
float HeadDelta = (HeadPos - InitialHeadPos).Magnitude2D();
CVector Fwd = CamTargetEntity->GetForward();
Fwd.z = 0.0f;
Fwd.Normalise();
HeadPos = (HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition()).toRwV3d();
HeadPos = (HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition());
HeadPos.z += 0.59f;
}
Source = HeadPos;

View File

@ -1,5 +1,7 @@
#include "common.h"
#include "RwHelper.h"
#include "Debug.h"
#include "Lines.h"
#include "Font.h"
#include "main.h"
#include "Text.h"
@ -114,11 +116,14 @@ CDebug::DisplayScreenStrings()
CFont::SetFontStyle(FONT_BANK);
for(i = 0; i < ms_nScreenStrs; i++){
/*
AsciiToUnicode(ms_aScreenStrs[i].str, gUString);
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(ms_aScreenStrs[i].x, ms_aScreenStrs[i].y, gUString);
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::PrintString(ms_aScreenStrs[i].x+1, ms_aScreenStrs[i].y+1, gUString);
*/
ObrsPrintfString(ms_aScreenStrs[i].str, ms_aScreenStrs[i].x, ms_aScreenStrs[i].y);
}
CFont::DrawFonts();
@ -131,7 +136,35 @@ CDebug::PrintAt(const char *str, int x, int y)
if(ms_nScreenStrs >= MAX_SCREEN_STRS)
return;
strncpy(ms_aScreenStrs[ms_nScreenStrs].str, str, 256);
ms_aScreenStrs[ms_nScreenStrs].x = x*12;
ms_aScreenStrs[ms_nScreenStrs].y = y*22;
ms_aScreenStrs[ms_nScreenStrs].x = x;//*12;
ms_aScreenStrs[ms_nScreenStrs].y = y;//*22;
ms_nScreenStrs++;
}
CDebug::Line CDebug::ms_aLines[MAX_DEBUG_LINES];
int CDebug::ms_nLines;
void
CDebug::AddLine(CVector p1, CVector p2, uint32 c1, uint32 c2)
{
if(ms_nLines >= MAX_DEBUG_LINES)
return;
ms_aLines[ms_nLines].p1 = p1;
ms_aLines[ms_nLines].p2 = p2;
ms_aLines[ms_nLines].c1 = c1;
ms_aLines[ms_nLines].c2 = c2;
ms_nLines++;
}
void
CDebug::DrawLines(void)
{
int i;
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
for(i = 0; i < ms_nLines; i++){
Line *l = &ms_aLines[i];
CLines::RenderLineWithClipping(l->p1.x, l->p1.y, l->p1.z, l->p2.x, l->p2.y, l->p2.z, l->c1, l->c2);
}
ms_nLines = 0;
}

View File

@ -8,6 +8,7 @@ class CDebug
MAX_STR_LEN = 80,
MAX_SCREEN_STRS = 100,
MAX_DEBUG_LINES = 100,
};
static int16 ms_nCurrentTextLine;
@ -21,6 +22,13 @@ class CDebug
static ScreenStr ms_aScreenStrs[MAX_SCREEN_STRS];
static int ms_nScreenStrs;
struct Line {
CVector p1, p2;
uint32 c1, c2;
};
static Line ms_aLines[MAX_DEBUG_LINES];
static int ms_nLines;
public:
static void DebugInitTextBuffer();
static void DebugDisplayTextBuffer();
@ -29,6 +37,9 @@ public:
// custom
static void PrintAt(const char *str, int x, int y);
static void DisplayScreenStrings();
static void AddLine(CVector p1, CVector p2, uint32 c1, uint32 c2);
static void DrawLines(void);
};
extern bool gbDebugStuffInRelease;

View File

@ -339,6 +339,11 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP
if(e->IsPed()) {
if(e->bUsesCollision || deadPeds && ((CPed *)e)->m_nPedState == PED_DEAD) {
#ifdef PED_SKIN
if(IsClumpSkinned(e->GetClump()))
colmodel = ((CPedModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex()))->AnimatePedColModelSkinned(e->GetClump());
else
#endif
if(((CPed *)e)->UseGroundColModel())
colmodel = &CTempColModels::ms_colModelPedGroundHit;
else

View File

@ -27,9 +27,15 @@
#ifdef LIBRW
#define STREAMPOS(str) ((str)->tell())
#define STREAMFILE(str) (((rw::StreamFile*)(str))->file)
#define HIERNODEINFO(hier) ((hier)->nodeInfo)
#define HIERNODEID(hier, i) ((hier)->nodeInfo[i].id)
#define HANIMFRAMES(anim) ((anim)->keyframes)
#else
#define STREAMPOS(str) ((str)->Type.memory.position)
#define STREAMFILE(str) ((str)->Type.file.fpFile)
#define HIERNODEINFO(hier) ((hier)->pNodeInfo)
#define HIERNODEID(hier, i) ((hier)->pNodeInfo[i].nodeID)
#define HANIMFRAMES(anim) ((anim)->pFrames)
#endif
#define rwVENDORID_ROCKSTAR 0x0253F2
@ -63,6 +69,11 @@ typedef uint16_t wchar;
#include "config.h"
#ifdef PED_SKIN
#include <rphanim.h>
#include <rpskin.h>
#endif
#define ALIGNPTR(p) (void*)((((uintptr)(void*)p) + sizeof(void*)-1) & ~(sizeof(void*)-1))
// PDP-10 like byte functions

View File

@ -234,6 +234,7 @@ enum Config {
#define CAMERA_PICKUP
// Peds
#define PED_SKIN // support for skinned geometry on peds
#define ANIMATE_PED_COL_MODEL
#define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward

View File

@ -794,6 +794,7 @@ RenderDebugShit(void)
if(gbShowCollisionLines)
CRenderer::RenderCollisionLines();
ThePaths.DisplayPathData();
CDebug::DrawLines();
#endif
}