summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/AnimViewer.cpp7
-rw-r--r--src/core/Cam.cpp13
-rw-r--r--src/core/Debug.cpp37
-rw-r--r--src/core/Debug.h11
-rw-r--r--src/core/Directory.cpp14
-rw-r--r--src/core/Directory.h1
-rw-r--r--src/core/Streaming.cpp6
-rw-r--r--src/core/World.cpp5
-rw-r--r--src/core/common.h11
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/main.cpp1
11 files changed, 98 insertions, 9 deletions
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp
index 20e94bf4..cf3ec5bf 100644
--- a/src/core/AnimViewer.cpp
+++ b/src/core/AnimViewer.cpp
@@ -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);
}
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index f0a60093..5cf1c8f3 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -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;
diff --git a/src/core/Debug.cpp b/src/core/Debug.cpp
index 917c99ab..e794dcaf 100644
--- a/src/core/Debug.cpp
+++ b/src/core/Debug.cpp
@@ -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;
+}
diff --git a/src/core/Debug.h b/src/core/Debug.h
index d169a0b4..4a25bf41 100644
--- a/src/core/Debug.h
+++ b/src/core/Debug.h
@@ -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;
diff --git a/src/core/Directory.cpp b/src/core/Directory.cpp
index 27539824..cc4d65d8 100644
--- a/src/core/Directory.cpp
+++ b/src/core/Directory.cpp
@@ -41,9 +41,23 @@ void
CDirectory::AddItem(const DirectoryInfo &dirinfo)
{
assert(numEntries < maxEntries);
+#ifdef FIX_BUGS
+ // don't add if already exists
+ uint32 offset, size;
+ if(FindItem(dirinfo.name, offset, size))
+ return;
+#endif
entries[numEntries++] = dirinfo;
}
+void
+CDirectory::AddItem(const DirectoryInfo &dirinfo, int32 imgId)
+{
+ DirectoryInfo di = dirinfo;
+ di.offset |= imgId<<24;
+ AddItem(di);
+}
+
bool
CDirectory::FindItem(const char *name, uint32 &offset, uint32 &size)
{
diff --git a/src/core/Directory.h b/src/core/Directory.h
index 06e6bba4..0fef080f 100644
--- a/src/core/Directory.h
+++ b/src/core/Directory.h
@@ -18,5 +18,6 @@ public:
void ReadDirFile(const char *filename);
bool WriteDirFile(const char *filename);
void AddItem(const DirectoryInfo &dirinfo);
+ void AddItem(const DirectoryInfo &dirinfo, int32 imgId);
bool FindItem(const char *name, uint32 &offset, uint32 &size);
};
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 15fe60e2..8124d11c 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -369,8 +369,12 @@ CStreaming::LoadCdDirectory(const char *dirname, int n)
lastID = modelId;
}
}else{
- // BUG: doesn't remember which cdimage this was in
+#ifdef FIX_BUGS
+ // remember which cdimage this came from
+ ms_pExtraObjectsDir->AddItem(direntry, n);
+#else
ms_pExtraObjectsDir->AddItem(direntry);
+#endif
lastID = -1;
}
}else if(!CGeneral::faststrcmp(dot+1, "TXD") || !CGeneral::faststrcmp(dot+1, "txd")){
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 404b92c0..b2a01b80 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -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
diff --git a/src/core/common.h b/src/core/common.h
index 46b4d03a..8b057efa 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -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
diff --git a/src/core/config.h b/src/core/config.h
index c52a708d..84712af3 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -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
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 77daaa01..7013b10f 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -794,6 +794,7 @@ RenderDebugShit(void)
if(gbShowCollisionLines)
CRenderer::RenderCollisionLines();
ThePaths.DisplayPathData();
+ CDebug::DrawLines();
#endif
}