[openjk] 60/130: JO: Disable GHOUL2 gore and ragdoll
Simon McVittie
smcv at debian.org
Fri Oct 28 11:09:18 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository openjk.
commit b48f21e28523b5a733fe53c99c99e2b18f7a13e9
Author: bibendovsky <bibendovsky at hotmail.com>
Date: Sun Jul 31 14:07:06 2016 +0300
JO: Disable GHOUL2 gore and ragdoll
---
code/game/G_Timer.cpp | 11 +-
code/game/ghoul2_shared.h | 16 +++
code/icarus/IcarusImplementation.cpp | 27 ++--
code/qcommon/q_shared.h | 10 ++
code/rd-vanilla/G2_API.cpp | 97 ++++++++++++++-
code/rd-vanilla/G2_bones.cpp | 9 +-
code/rd-vanilla/G2_misc.cpp | 225 +++-------------------------------
code/rd-vanilla/tr_ghoul2.cpp | 59 ++++++++-
code/server/sv_savegame.cpp | 17 ++-
code/server/sv_snapshot.cpp | 2 +
codeJK2/game/g_savegame.cpp | 6 +
shared/qcommon/ojk_i_saved_game.h | 21 ++++
shared/qcommon/ojk_i_saved_game_fwd.h | 22 +++-
shared/qcommon/ojk_saved_game.cpp | 23 +++-
shared/qcommon/ojk_saved_game.h | 24 +++-
15 files changed, 327 insertions(+), 242 deletions(-)
diff --git a/code/game/G_Timer.cpp b/code/game/G_Timer.cpp
index b835174..e66ae8c 100644
--- a/code/game/G_Timer.cpp
+++ b/code/game/G_Timer.cpp
@@ -234,11 +234,14 @@ void TIMER_Load( void )
::gi.saved_game->read_chunk(
INT_ID('T','M','I','D'));
- auto& sg_buffer = ::gi.saved_game->get_buffer();
+ auto sg_buffer_data = static_cast<const char*>(
+ ::gi.saved_game->get_buffer_data());
- std::uninitialized_copy(
- sg_buffer.cbegin(),
- sg_buffer.cend(),
+ const auto sg_buffer_size = ::gi.saved_game->get_buffer_size();
+
+ std::uninitialized_copy_n(
+ sg_buffer_data,
+ sg_buffer_size,
tempBuffer);
::gi.saved_game->read_chunk<int32_t>(
diff --git a/code/game/ghoul2_shared.h b/code/game/ghoul2_shared.h
index 29e9536..21eb846 100644
--- a/code/game/ghoul2_shared.h
+++ b/code/game/ghoul2_shared.h
@@ -127,6 +127,7 @@ struct boneInfo_t
int boneBlendStart; // time bone angle blend with normal animation began
mdxaBone_t newMatrix; // This is the lerped matrix that Ghoul2 uses on the client side - does not go across the network
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
int lastTimeUpdated; // if non-zero this is all intialized
int lastContents;
@@ -191,6 +192,7 @@ struct boneInfo_t
int airTime; //base is in air, be more quick and sensitive about collisions
//rww - RAGDOLL_END
+#endif // !JK2_MODE
boneInfo_t():
boneNumber(-1),
@@ -231,6 +233,8 @@ boneInfo_t():
saved_game->write<int32_t>(boneBlendTime);
saved_game->write<int32_t>(boneBlendStart);
saved_game->write(newMatrix);
+
+#ifndef JK2_MODE
saved_game->write<int32_t>(lastTimeUpdated);
saved_game->write<int32_t>(lastContents);
saved_game->write<float>(lastPosition);
@@ -284,6 +288,7 @@ boneInfo_t():
saved_game->write<>(animFrameMatrix);
saved_game->write<int32_t>(hasAnimFrameMatrix);
saved_game->write<int32_t>(airTime);
+#endif // !JK2_MODE
}
void sg_import(
@@ -304,6 +309,8 @@ boneInfo_t():
saved_game->read<int32_t>(boneBlendTime);
saved_game->read<int32_t>(boneBlendStart);
saved_game->read(newMatrix);
+
+#ifndef JK2_MODE
saved_game->read<int32_t>(lastTimeUpdated);
saved_game->read<int32_t>(lastContents);
saved_game->read<float>(lastPosition);
@@ -357,6 +364,7 @@ boneInfo_t():
saved_game->read<>(animFrameMatrix);
saved_game->read<int32_t>(hasAnimFrameMatrix);
saved_game->read<int32_t>(airTime);
+#endif // JK2_MODE
}
};
//we save from top to boltUsed here. Don't bother saving the position, it gets rebuilt every frame anyway
@@ -511,7 +519,11 @@ public:
ojk::ISavedGame* saved_game) const
{
saved_game->write<int32_t>(mModelindex);
+
+#ifndef JK2_MODE
saved_game->write<int32_t>(animModelIndexOffset);
+#endif // !JK2_MODE
+
saved_game->write<int32_t>(mCustomShader);
saved_game->write<int32_t>(mCustomSkin);
saved_game->write<int32_t>(mModelBoltLink);
@@ -535,7 +547,11 @@ public:
ojk::ISavedGame* saved_game)
{
saved_game->read<int32_t>(mModelindex);
+
+#ifndef JK2_MODE
saved_game->read<int32_t>(animModelIndexOffset);
+#endif // !JK2_MODE
+
saved_game->read<int32_t>(mCustomShader);
saved_game->read<int32_t>(mCustomSkin);
saved_game->read<int32_t>(mModelBoltLink);
diff --git a/code/icarus/IcarusImplementation.cpp b/code/icarus/IcarusImplementation.cpp
index a93fdc6..e0b1c5b 100644
--- a/code/icarus/IcarusImplementation.cpp
+++ b/code/icarus/IcarusImplementation.cpp
@@ -709,11 +709,14 @@ int CIcarus::Load()
saved_game->read_chunk(
INT_ID('I','S','E','Q'));
- auto& sg_buffer = saved_game->get_buffer();
+ auto sg_buffer_data = static_cast<const unsigned char*>(
+ saved_game->get_buffer_data());
- std::uninitialized_copy(
- sg_buffer.cbegin(),
- sg_buffer.cend(),
+ const auto sg_buffer_size = saved_game->get_buffer_size();
+
+ std::uninitialized_copy_n(
+ sg_buffer_data,
+ sg_buffer_size,
m_byBuffer);
//Load all signals
@@ -829,14 +832,20 @@ void CIcarus::BufferRead( void *pDstBuff, unsigned long ulNumBytesToRead )
{// We've tried to read past the buffer...
IGameInterface::GetGame()->DebugPrint( IGameInterface::WL_ERROR, "BufferRead: Buffer underflow, Looking for new block." );
// Read in the next block.
- IGameInterface::GetGame()->get_saved_game()->read_chunk(
+
+ auto saved_game = IGameInterface::GetGame()->get_saved_game();
+
+ saved_game->read_chunk(
INT_ID('I','S','E','Q'));
- auto& sg_buffer = IGameInterface::GetGame()->get_saved_game()->get_buffer();
+ auto sg_buffer_data = static_cast<const unsigned char*>(
+ saved_game->get_buffer_data());
+
+ const auto sg_buffer_size = saved_game->get_buffer_size();
- std::uninitialized_copy(
- sg_buffer.cbegin(),
- sg_buffer.cend(),
+ std::uninitialized_copy_n(
+ sg_buffer_data,
+ sg_buffer_size,
m_byBuffer);
m_ulBytesRead = 0; //reset buffer
diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
index e20d577..ed87688 100644
--- a/code/qcommon/q_shared.h
+++ b/code/qcommon/q_shared.h
@@ -2704,6 +2704,7 @@ public:
saved_game->write<int16_t>(leanStopDebounceTime);
#ifdef JK2_MODE
+ saved_game->skip(2);
saved_game->write<float>(saberLengthOld);
#endif // JK2_MODE
@@ -2872,6 +2873,7 @@ public:
saved_game->read<int16_t>(leanStopDebounceTime);
#ifdef JK2_MODE
+ saved_game->skip(2);
saved_game->read<float>(saberLengthOld);
#endif // JK2_MODE
@@ -3162,7 +3164,9 @@ Ghoul2 Insert Start
Ghoul2 Insert End
*/
+#ifndef JK2_MODE
qboolean isPortalEnt;
+#endif // !JK2_MODE
void sg_export(
@@ -3215,7 +3219,10 @@ Ghoul2 Insert End
saved_game->write<float>(modelScale);
saved_game->write<int32_t>(radius);
saved_game->write<int32_t>(boltInfo);
+
+#ifndef JK2_MODE
saved_game->write<int32_t>(isPortalEnt);
+#endif // !JK2_MODE
}
void sg_import(
@@ -3268,7 +3275,10 @@ Ghoul2 Insert End
saved_game->read<float>(modelScale);
saved_game->read<int32_t>(radius);
saved_game->read<int32_t>(boltInfo);
+
+#ifndef JK2_MODE
saved_game->read<int32_t>(isPortalEnt);
+#endif // !JK2_MODE
}
} entityState_t;
diff --git a/code/rd-vanilla/G2_API.cpp b/code/rd-vanilla/G2_API.cpp
index 2129aab..ccff8dc 100644
--- a/code/rd-vanilla/G2_API.cpp
+++ b/code/rd-vanilla/G2_API.cpp
@@ -41,9 +41,11 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#endif
#endif
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
#include "../ghoul2/ghoul2_gore.h"
//rww - RAGDOLL_END
+#endif // !JK2_MODE
extern mdxaBone_t worldMatrix;
extern mdxaBone_t worldMatrixInv;
@@ -972,10 +974,12 @@ qboolean G2API_RemoveGhoul2Model(CGhoul2Info_v &ghlInfo, const int modelIndex)
return qtrue;
}
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
#define GHOUL2_RAG_STARTED 0x0010
#define GHOUL2_RAG_FORCESOLVE 0x1000 //api-override, determine if ragdoll should be forced to continue solving even if it thinks it is settled
//rww - RAGDOLL_END
+#endif // !JK2_MODE
int G2API_GetAnimIndex(CGhoul2Info *ghlInfo)
{
@@ -1018,12 +1022,14 @@ qboolean G2API_SetAnimIndex(CGhoul2Info *ghlInfo, const int index)
qboolean G2API_SetBoneAnimIndex(CGhoul2Info *ghlInfo, const int index, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int AcurrentTime, const float setFrame, const int blendTime)
{
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
if (ghlInfo && (ghlInfo->mFlags & GHOUL2_RAG_STARTED))
{
return qfalse;
}
//rww - RAGDOLL_END
+#endif // !JK2_MODE
qboolean ret=qfalse;
if (G2_SetupModelPointers(ghlInfo))
@@ -1070,12 +1076,14 @@ qboolean G2API_SetBoneAnimIndex(CGhoul2Info *ghlInfo, const int index, const int
qboolean G2API_SetBoneAnim(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int AcurrentTime, const float setFrame, const int blendTime)
{
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
if (ghlInfo && ghlInfo->mFlags & GHOUL2_RAG_STARTED)
{
return qfalse;
}
//rww - RAGDOLL_END
+#endif // !JK2_MODE
qboolean ret=qfalse;
G2ERROR(boneName,"NULL boneName");
@@ -1288,12 +1296,14 @@ qboolean G2API_SetBoneAnglesIndex(CGhoul2Info *ghlInfo, const int index, const v
const Eorientations yaw, const Eorientations pitch, const Eorientations roll,
qhandle_t *, int blendTime, int AcurrentTime)
{
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
if (ghlInfo && ghlInfo->mFlags & GHOUL2_RAG_STARTED)
{
return qfalse;
}
//rww - RAGDOLL_END
+#endif // !JK2_MODE
qboolean ret=qfalse;
if (G2_SetupModelPointers(ghlInfo))
@@ -1315,12 +1325,14 @@ qboolean G2API_SetBoneAngles(CGhoul2Info *ghlInfo, const char *boneName, const v
const Eorientations up, const Eorientations left, const Eorientations forward,
qhandle_t *, int blendTime, int AcurrentTime )
{
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
if (ghlInfo && ghlInfo->mFlags & GHOUL2_RAG_STARTED)
{
return qfalse;
}
//rww - RAGDOLL_END
+#endif // !JK2_MODE
qboolean ret=qfalse;
G2ERROR(boneName,"NULL boneName");
@@ -1401,6 +1413,15 @@ qboolean G2API_StopBoneAngles(CGhoul2Info *ghlInfo, const char *boneName)
return ret;
}
+#ifdef JK2_MODE
+void G2API_SetRagDoll(
+ CGhoul2Info_v& ghoul2,
+ CRagDollParams* parms)
+{
+ static_cast<void>(ghoul2);
+ static_cast<void>(parms);
+}
+#else
//rww - RAGDOLL_BEGIN
class CRagDollParams;
void G2_SetRagDoll(CGhoul2Info_v &ghoul2V,CRagDollParams *parms);
@@ -1409,6 +1430,7 @@ void G2API_SetRagDoll(CGhoul2Info_v &ghoul2,CRagDollParams *parms)
G2_SetRagDoll(ghoul2,parms);
}
//rww - RAGDOLL_END
+#endif // JK2_MODE
qboolean G2API_RemoveBone(CGhoul2Info *ghlInfo, const char *boneName)
{
@@ -1425,18 +1447,22 @@ qboolean G2API_RemoveBone(CGhoul2Info *ghlInfo, const char *boneName)
return ret;
}
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
#ifdef _DEBUG
extern int ragTraceTime;
extern int ragSSCount;
extern int ragTraceCount;
#endif
+#endif // !JK2_MODE
void G2API_AnimateG2Models(CGhoul2Info_v &ghoul2, int AcurrentTime,CRagDollUpdateParams *params)
{
#ifdef JK2_MODE
- return; // handled elsewhere
-#endif
+ static_cast<void>(ghoul2);
+ static_cast<void>(AcurrentTime);
+ static_cast<void>(params);
+#else
int model;
int currentTime=G2API_GetTime(AcurrentTime);
@@ -1460,9 +1486,11 @@ void G2API_AnimateG2Models(CGhoul2Info_v &ghoul2, int AcurrentTime,CRagDollUpdat
// assert(ragTraceTime < 15);
//assert(ragTraceCount < 600);
#endif
+#endif // JK2_MODE
}
//rww - RAGDOLL_END
+#ifndef JK2_MODE
int G2_Find_Bone_Rag(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneName);
#define RAG_PCJ (0x00001)
#define RAG_EFFECTOR (0x00100)
@@ -1493,9 +1521,18 @@ static inline boneInfo_t *G2_GetRagBoneConveniently(CGhoul2Info_v &ghoul2, const
return bone;
}
+#endif // !JK2_MODE
qboolean G2API_RagPCJConstraint(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t min, vec3_t max)
{
+#ifdef JK2_MODE
+ static_cast<void>(ghoul2);
+ static_cast<void>(boneName);
+ static_cast<void>(min);
+ static_cast<void>(max);
+
+ return false;
+#else
boneInfo_t *bone = G2_GetRagBoneConveniently(ghoul2, boneName);
if (!bone)
@@ -1512,10 +1549,18 @@ qboolean G2API_RagPCJConstraint(CGhoul2Info_v &ghoul2, const char *boneName, vec
VectorCopy(max, bone->maxAngles);
return qtrue;
+#endif // JK2_MODE
}
qboolean G2API_RagPCJGradientSpeed(CGhoul2Info_v &ghoul2, const char *boneName, const float speed)
{
+#ifdef JK2_MODE
+ static_cast<void>(ghoul2);
+ static_cast<void>(boneName);
+ static_cast<void>(speed);
+
+ return false;
+#else
boneInfo_t *bone = G2_GetRagBoneConveniently(ghoul2, boneName);
if (!bone)
@@ -1531,10 +1576,18 @@ qboolean G2API_RagPCJGradientSpeed(CGhoul2Info_v &ghoul2, const char *boneName,
bone->overGradSpeed = speed;
return qtrue;
+#endif // JK2_MODE
}
qboolean G2API_RagEffectorGoal(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t pos)
{
+#ifdef JK2_MODE
+ static_cast<void>(ghoul2);
+ static_cast<void>(boneName);
+ static_cast<void>(pos);
+
+ return false;
+#else
boneInfo_t *bone = G2_GetRagBoneConveniently(ghoul2, boneName);
if (!bone)
@@ -1557,6 +1610,7 @@ qboolean G2API_RagEffectorGoal(CGhoul2Info_v &ghoul2, const char *boneName, vec3
bone->hasOverGoal = true;
}
return qtrue;
+#endif // JK2_MODE
}
qboolean G2API_GetRagBonePos(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t pos, vec3_t entAngles, vec3_t entPos, vec3_t entScale)
@@ -1566,6 +1620,13 @@ qboolean G2API_GetRagBonePos(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t
qboolean G2API_RagEffectorKick(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t velocity)
{
+#ifdef JK2_MODE
+ static_cast<void>(ghoul2);
+ static_cast<void>(boneName);
+ static_cast<void>(velocity);
+
+ return false;
+#else
boneInfo_t *bone = G2_GetRagBoneConveniently(ghoul2, boneName);
if (!bone)
@@ -1583,10 +1644,17 @@ qboolean G2API_RagEffectorKick(CGhoul2Info_v &ghoul2, const char *boneName, vec3
bone->physicsSettled = false;
return qtrue;
+#endif // JK2_MODE
}
qboolean G2API_RagForceSolve(CGhoul2Info_v &ghoul2, qboolean force)
{
+#ifdef JK2_MODE
+ static_cast<void>(ghoul2);
+ static_cast<void>(force);
+
+ return false;
+#else
assert(ghoul2.size());
CGhoul2Info *ghlInfo = &ghoul2[0];
@@ -1605,18 +1673,43 @@ qboolean G2API_RagForceSolve(CGhoul2Info_v &ghoul2, qboolean force)
}
return qtrue;
+#endif // JK2_MODE
}
+#ifndef JK2_MODE
qboolean G2_SetBoneIKState(CGhoul2Info_v &ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params);
+#endif // !JK2_MODE
+
qboolean G2API_SetBoneIKState(CGhoul2Info_v &ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params)
{
+#ifdef JK2_MODE
+ static_cast<void>(ghoul2);
+ static_cast<void>(time);
+ static_cast<void>(boneName);
+ static_cast<void>(ikState);
+ static_cast<void>(params);
+
+ return false;
+#else
return G2_SetBoneIKState(ghoul2, time, boneName, ikState, params);
+#endif // JK2_MODE
}
+#ifndef JK2_MODE
qboolean G2_IKMove(CGhoul2Info_v &ghoul2, int time, sharedIKMoveParams_t *params);
+#endif // !JK2_MODE
+
qboolean G2API_IKMove(CGhoul2Info_v &ghoul2, int time, sharedIKMoveParams_t *params)
{
+#ifdef JK2_MODE
+ static_cast<void>(ghoul2);
+ static_cast<void>(time);
+ static_cast<void>(params);
+
+ return false;
+#else
return G2_IKMove(ghoul2, time, params);
+#endif // !JK2_MODE
}
qboolean G2API_RemoveBolt(CGhoul2Info *ghlInfo, const int index)
diff --git a/code/rd-vanilla/G2_bones.cpp b/code/rd-vanilla/G2_bones.cpp
index a710d20..8ab9a43 100644
--- a/code/rd-vanilla/G2_bones.cpp
+++ b/code/rd-vanilla/G2_bones.cpp
@@ -39,10 +39,12 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "../ghoul2/G2.h"
#endif
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
#include <float.h>
#include "../ghoul2/ghoul2_gore.h"
//rww - RAGDOLL_END
+#endif // !JK2_MODE
extern cvar_t *r_Ghoul2BlendMultiplier;
@@ -94,9 +96,11 @@ int G2_Add_Bone (const model_t *mod, boneInfo_v &blist, const char *boneName)
mdxaSkelOffsets_t *offsets;
boneInfo_t tempBone;
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
memset(&tempBone, 0, sizeof(tempBone));
//rww - RAGDOLL_END
+#endif // !JK2_MODE
offsets = (mdxaSkelOffsets_t *)((byte *)mod->mdxa + sizeof(mdxaHeader_t));
@@ -1046,6 +1050,7 @@ qboolean G2_Stop_Bone_Angles(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char
return qfalse;
}
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
/*
@@ -4755,6 +4760,7 @@ qboolean G2_IKMove(CGhoul2Info_v &ghoul2, int time, sharedIKMoveParams_t *params
#endif
return qtrue;
}
+#endif // !JK2_MODE
// set the bone list to all unused so the bone transformation routine ignores it.
void G2_Init_Bone_List(boneInfo_v &blist, int numBones)
@@ -4775,7 +4781,7 @@ int G2_Get_Bone_Index(CGhoul2Info *ghoul2, const char *boneName, qboolean bAddIf
}
}
-
+#ifndef JK2_MODE
void G2_FreeRag(void)
{
if(rag) {
@@ -4783,3 +4789,4 @@ void G2_FreeRag(void)
rag = NULL;
}
}
+#endif // !JK2_MODE
diff --git a/code/rd-vanilla/G2_misc.cpp b/code/rd-vanilla/G2_misc.cpp
index 3954c8b..6a0111c 100644
--- a/code/rd-vanilla/G2_misc.cpp
+++ b/code/rd-vanilla/G2_misc.cpp
@@ -1780,142 +1780,29 @@ const auto BOLT_SAVE_BLOCK_SIZE = static_cast<int>(sizeof(SgBoltInfo));
const auto BONE_SAVE_BLOCK_SIZE = static_cast<int>(sizeof(SgBoneInfo));
#endif
-#if 0
-void G2_SaveGhoul2Models(CGhoul2Info_v &ghoul2)
-{
- char *pGhoul2Data = NULL;
- int iGhoul2Size = 0;
-
- // is there anything to save?
- if (!ghoul2.IsValid()||!ghoul2.size())
- {
- uint32_t empty_value = 0;
-
- ::ri.saved_game->write_chunk<uint32_t>(
- INT_ID('G','H','L','2'),
- empty_value); //write out a zero buffer
-
- return;
- }
-
- // this one isn't a define since I couldn't work out how to figure it out at compile time
- constexpr auto ghoul2BlockSize = static_cast<int>(sizeof(SgCGhoul2Info));
-
- // add in count for number of ghoul2 models
- iGhoul2Size += 4;
- // start out working out the total size of the buffer we need to allocate
- for (int i=0; i<ghoul2.size();i++)
- {
- iGhoul2Size += ghoul2BlockSize;
- // add in count for number of surfaces
- iGhoul2Size += 4;
- iGhoul2Size += (ghoul2[i].mSlist.size() * SURFACE_SAVE_BLOCK_SIZE);
- // add in count for number of bones
- iGhoul2Size += 4;
- iGhoul2Size += (ghoul2[i].mBlist.size() * BONE_SAVE_BLOCK_SIZE);
- // add in count for number of bolts
- iGhoul2Size += 4;
- iGhoul2Size += (ghoul2[i].mBltlist.size() * BOLT_SAVE_BLOCK_SIZE);
- }
-
- // ok, we should know how much space we need now
- pGhoul2Data = (char*)R_Malloc(iGhoul2Size, TAG_GHOUL2, qfalse);
-
- // now lets start putting the data we care about into the buffer
- char *tempBuffer = pGhoul2Data;
-
- // save out how many ghoul2 models we have
- *(int32_t*)tempBuffer = static_cast<int32_t>(ghoul2.size());
- tempBuffer +=4;
-
- for (int i = 0; i<ghoul2.size();i++)
- {
- // first save out the ghoul2 details themselves
-// OutputDebugString(va("G2_SaveGhoul2Models(): ghoul2[%d].mModelindex = %d\n",i,ghoul2[i].mModelindex));
-#if 0
- memcpy(tempBuffer, &ghoul2[i].mModelindex, ghoul2BlockSize);
-#else
- ::sg_export(
- ghoul2[i],
- *reinterpret_cast<SgCGhoul2Info*>(tempBuffer));
-#endif
- tempBuffer += ghoul2BlockSize;
-
- // save out how many surfaces we have
- *(int32_t*)tempBuffer = static_cast<int32_t>(ghoul2[i].mSlist.size());
- tempBuffer +=4;
-
- // now save the all the surface list info
- for (size_t x=0; x<ghoul2[i].mSlist.size(); x++)
- {
-#if 0
- memcpy(tempBuffer, &ghoul2[i].mSlist[x], SURFACE_SAVE_BLOCK_SIZE);
-#else
- ::sg_export(
- ghoul2[i].mSlist[x],
- *reinterpret_cast<SgSurfaceInfo*>(tempBuffer));
-#endif
- tempBuffer += SURFACE_SAVE_BLOCK_SIZE;
- }
-
- // save out how many bones we have
- *(int32_t*)tempBuffer = static_cast<int32_t>(ghoul2[i].mBlist.size());
- tempBuffer +=4;
-
- // now save the all the bone list info
- for (size_t x = 0; x<ghoul2[i].mBlist.size(); x++)
- {
-#if 0
- memcpy(tempBuffer, &ghoul2[i].mBlist[x], BONE_SAVE_BLOCK_SIZE);
-#else
- ::sg_export(
- ghoul2[i].mBlist[x],
- *reinterpret_cast<SgBoneInfo*>(tempBuffer));
-#endif
- tempBuffer += BONE_SAVE_BLOCK_SIZE;
- }
-
- // save out how many bolts we have
- *(int32_t*)tempBuffer = static_cast<int32_t>(ghoul2[i].mBltlist.size());
- tempBuffer +=4;
-
- // lastly save the all the bolt list info
- for (size_t x = 0; x<ghoul2[i].mBltlist.size(); x++)
- {
-#if 0
- memcpy(tempBuffer, &ghoul2[i].mBltlist[x], BOLT_SAVE_BLOCK_SIZE);
-#else
- ::sg_export(
- ghoul2[i].mBltlist[x],
- *reinterpret_cast<SgBoltInfo*>(tempBuffer));
-#endif
- tempBuffer += BOLT_SAVE_BLOCK_SIZE;
- }
- }
- ::ri.saved_game->write_chunk(
- INT_ID('G','H','L','2'),
- pGhoul2Data,
- iGhoul2Size);
-
- R_Free(pGhoul2Data);
-}
-#else
void G2_SaveGhoul2Models(
CGhoul2Info_v& ghoul2)
{
+ ::ri.saved_game->reset_buffer();
+
// is there anything to save?
if (!ghoul2.IsValid() || ghoul2.size() == 0) {
- auto empty_value = 0;
+#ifdef JK2_MODE
+ ::ri.saved_game->write_chunk_and_size<int32_t>(
+ INT_ID('G', 'L', 'S', '2'),
+ INT_ID('G', 'H', 'L', '2'));
+#else
+ const int zero_size = 0;
::ri.saved_game->write_chunk<int32_t>(
INT_ID('G', 'H', 'L', '2'),
- empty_value); //write out a zero buffer
+ zero_size); //write out a zero buffer
+#endif // JK2_MODE
return;
}
- ::ri.saved_game->reset_buffer();
// save out how many ghoul2 models we have
auto model_count = ghoul2.size();
@@ -1966,93 +1853,16 @@ void G2_SaveGhoul2Models(
}
}
+#ifdef JK2_MODE
+ ::ri.saved_game->write_chunk_and_size<int32_t>(
+ INT_ID('G', 'L', 'S', '2'),
+ INT_ID('G', 'H', 'L', '2'));
+#else
::ri.saved_game->write_chunk(
INT_ID('G', 'H', 'L', '2'));
+#endif // JK2_MODE
}
-#endif
-
-#if 0
-void G2_LoadGhoul2Model(CGhoul2Info_v &ghoul2, char *buffer)
-{
- // first thing, lets see how many ghoul2 models we have, and resize our buffers accordingly
- auto newSize = *(int32_t*)buffer;
- ghoul2.resize(newSize);
- buffer += 4;
-
- // did we actually resize to a value?
- if (!newSize)
- {
- // no, ok, well, done then.
- return;
- }
-
- // this one isn't a define since I couldn't work out how to figure it out at compile time
- constexpr auto ghoul2BlockSize = static_cast<int>(sizeof(SgCGhoul2Info));
-
- // now we have enough instances, lets go through each one and load up the relevant details
- for (int i=0; i<ghoul2.size(); i++)
- {
- ghoul2[i].mSkelFrameNum = 0;
- ghoul2[i].mModelindex=-1;
- ghoul2[i].mFileName[0]=0;
- ghoul2[i].mValid=false;
- // load the ghoul2 info from the buffer
- ::sg_import(
- *reinterpret_cast<const SgCGhoul2Info*>(buffer),
- ghoul2[i]);
-
- buffer +=ghoul2BlockSize;
-
- if (ghoul2[i].mModelindex!=-1&&ghoul2[i].mFileName[0])
- {
- ghoul2[i].mModelindex = i;
- G2_SetupModelPointers(&ghoul2[i]);
- }
-
- // give us enough surfaces to load up the data
- ghoul2[i].mSlist.resize(*(int32_t*)buffer);
- buffer +=4;
- // now load all the surfaces
- for (size_t x=0; x<ghoul2[i].mSlist.size(); x++)
- {
- ::sg_import(
- *reinterpret_cast<const SgSurfaceInfo*>(buffer),
- ghoul2[i].mSlist[x]);
-
- buffer += SURFACE_SAVE_BLOCK_SIZE;
- }
-
- // give us enough bones to load up the data
- ghoul2[i].mBlist.resize(*(int32_t*)buffer);
- buffer +=4;
-
- // now load all the bones
- for (size_t x = 0; x<ghoul2[i].mBlist.size(); x++)
- {
- ::sg_import(
- *reinterpret_cast<const SgBoneInfo*>(buffer),
- ghoul2[i].mBlist[x]);
-
- buffer += BONE_SAVE_BLOCK_SIZE;
- }
-
- // give us enough bolts to load up the data
- ghoul2[i].mBltlist.resize(*(int32_t*)buffer);
- buffer +=4;
-
- // now load all the bolts
- for (size_t x = 0; x<ghoul2[i].mBltlist.size(); x++)
- {
- ::sg_import(
- *reinterpret_cast<const SgBoltInfo*>(buffer),
- ghoul2[i].mBltlist[x]);
-
- buffer += BOLT_SAVE_BLOCK_SIZE;
- }
- }
-}
-#else
// FIXME Remove 'buffer' parameter
void G2_LoadGhoul2Model(
CGhoul2Info_v& ghoul2,
@@ -2137,5 +1947,6 @@ void G2_LoadGhoul2Model(
::ri.saved_game);
}
}
+
+ ::ri.saved_game->ensure_all_data_read();
}
-#endif
diff --git a/code/rd-vanilla/tr_ghoul2.cpp b/code/rd-vanilla/tr_ghoul2.cpp
index d81e7fc..cc3cdba 100644
--- a/code/rd-vanilla/tr_ghoul2.cpp
+++ b/code/rd-vanilla/tr_ghoul2.cpp
@@ -70,9 +70,11 @@ void G2Time_ReportTimers(void)
}
#endif
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
#include <float.h>
//rww - RAGDOLL_END
+#endif // !JK2_MODE
extern cvar_t *r_Ghoul2UnSqash;
extern cvar_t *r_Ghoul2AnimSmooth;
@@ -101,18 +103,24 @@ const static mdxaBone_t identityMatrix =
class CTransformBone
{
public:
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
int touchRender;
//rww - RAGDOLL_END
+#endif // !JK2_MODE
+
mdxaBone_t boneMatrix; //final matrix
int parent; // only set once
int touch; // for minimal recalculation
CTransformBone()
{
touch=0;
+
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
touchRender = 0;
//rww - RAGDOLL_END
+#endif // !JK2_MODE
}
};
@@ -156,6 +164,8 @@ class CBoneCache
mFinalBones[index].touch=mCurrentTouch;
}
}
+
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
void SmoothLow(int index)
{
@@ -200,6 +210,8 @@ class CBoneCache
#endif// _DEBUG
}
//rww - RAGDOLL_END
+#endif // !JK2_MODE
+
public:
int frameSize;
const mdxaHeader_t *header;
@@ -219,11 +231,14 @@ public:
int incomingTime;
int mCurrentTouch;
+
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
int mCurrentTouchRender;
int mLastTouch;
int mLastLastTouch;
//rww - RAGDOLL_END
+#endif // !JK2_MODE
// for render smoothing
bool mSmoothingActive;
@@ -258,10 +273,14 @@ public:
mFinalBones[i].parent=skel->parent;
}
mCurrentTouch=3;
+
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
mLastTouch=2;
mLastLastTouch=1;
//rww - RAGDOLL_END
+#endif // !JK2_MODE
+
}
~CBoneCache ()
{
@@ -349,6 +368,8 @@ public:
}
return mFinalBones[index].boneMatrix;
}
+
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
const inline mdxaBone_t &EvalRender(int index)
{
@@ -385,13 +406,20 @@ public:
return mFinalBones[index].parent;
}
//rww - RAGDOLL_END
+#endif // !JK2_MODE
// Added by BTO (VV) - This is probably broken
// Need to add in smoothing step?
CTransformBone *EvalFull(int index)
{
+#ifdef JK2_MODE
// Eval(index);
+
+// FIXME BBi Was commented
+ Eval(index);
+#else
EvalRender(index);
+#endif // JK2_MODE
if (mSmoothingActive)
{
return mSmoothBones + index;
@@ -413,6 +441,7 @@ static inline float G2_GetVertBoneWeightNotSlow( const mdxmVertex_t *pVert, cons
return fBoneWeight;
}
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
const mdxaHeader_t *G2_GetModA(CGhoul2Info &ghoul2)
{
@@ -627,6 +656,7 @@ int G2_GetParentBoneMatrixLow(CGhoul2Info &ghoul2,int boneNum,const vec3_t scale
return parent;
}
//rww - RAGDOLL_END
+#endif // !JK2_MODE
void RemoveBoneCache(CBoneCache *boneCache)
{
@@ -1185,6 +1215,7 @@ void G2_TimingModel(boneInfo_t &bone,int currentTime,int numFramesInFile,int &cu
*/
}
+#ifndef JK2_MODE
//basically construct a seperate skeleton with full hierarchy to store a matrix
//off which will give us the desired settling position given the frame in the skeleton
//that should be used -rww
@@ -1312,6 +1343,7 @@ void G2_RagGetAnimMatrix(CGhoul2Info &ghoul2, const int boneNum, mdxaBone_t &mat
matrix = bone.animFrameMatrix;
}
+#endif // !JK2_MODE
// transform each individual bone's information - making sure to use any override information provided, both for angles and for animations, as
// well as multiplying each bone's matrix by it's parents matrix
@@ -1853,6 +1885,7 @@ void G2_TransformGhoulBones(boneInfo_v &rootBoneList,mdxaBone_t &rootMatrix, CGh
float val=r_Ghoul2AnimSmooth->value;
if (smooth&&val>0.0f&&val<1.0f)
{
+#ifndef JK2_MODE
ghoul2.mBoneCache->mLastTouch=ghoul2.mBoneCache->mLastLastTouch;
if(ghoul2.mFlags & GHOUL2_RAG_STARTED)
@@ -1880,6 +1913,7 @@ void G2_TransformGhoulBones(boneInfo_v &rootBoneList,mdxaBone_t &rootMatrix, CGh
}
}
}
+#endif // !JK2_MODE
ghoul2.mBoneCache->mSmoothFactor=val;
ghoul2.mBoneCache->mSmoothingActive=true;
@@ -1894,6 +1928,7 @@ void G2_TransformGhoulBones(boneInfo_v &rootBoneList,mdxaBone_t &rootMatrix, CGh
}
ghoul2.mBoneCache->mCurrentTouch++;
+#ifndef JK2_MODE
//rww - RAGDOLL_BEGIN
if (HackadelicOnClient)
{
@@ -1905,6 +1940,7 @@ void G2_TransformGhoulBones(boneInfo_v &rootBoneList,mdxaBone_t &rootMatrix, CGh
ghoul2.mBoneCache->mCurrentTouchRender=0;
}
//rww - RAGDOLL_END
+#endif // !JK2_MODE
// ghoul2.mBoneCache->mWraithID=0;
ghoul2.mBoneCache->frameSize = 0;// can be deleted in new G2 format //(int)( &((mdxaFrame_t *)0)->boneIndexes[ ghoul2.aHeader->numBones ] );
@@ -2984,8 +3020,12 @@ void RB_SurfaceGhoul( CRenderableSurface *surf )
const mdxaBone_t *bone2;
for ( j = 0; j < numVerts; j++, baseVertex++,v++ )
{
-
+#ifdef JK2_MODE
+ // FIXME BBi
+ bone = &bones->Eval(piBoneReferences[G2_GetVertBoneIndex( v, 0 )]);
+#else
bone = &bones->EvalRender(piBoneReferences[G2_GetVertBoneIndex( v, 0 )]);
+#endif // JK2_MODE
int iNumWeights = G2_GetVertWeights( v );
tess.normal[baseVertex][0] = DotProduct( bone->matrix[0], v->normal );
tess.normal[baseVertex][1] = DotProduct( bone->matrix[1], v->normal );
@@ -3002,7 +3042,12 @@ void RB_SurfaceGhoul( CRenderableSurface *surf )
fBoneWeight = G2_GetVertBoneWeightNotSlow( v, 0);
if (iNumWeights==2)
{
+#ifdef JK2_MODE
+ // FIXME BBi
+ bone2 = &bones->Eval(piBoneReferences[G2_GetVertBoneIndex( v, 1 )]);
+#else
bone2 = &bones->EvalRender(piBoneReferences[G2_GetVertBoneIndex( v, 1 )]);
+#endif // JK2_MODE
/*
useless transposition
tess.xyz[baseVertex][0] =
@@ -3031,7 +3076,13 @@ void RB_SurfaceGhoul( CRenderableSurface *surf )
fTotalWeight=fBoneWeight;
for (k=1; k < iNumWeights-1 ; k++)
{
+#ifdef JK2_MODE
+ // FIXME BBi
+ bone = &bones->Eval(piBoneReferences[G2_GetVertBoneIndex( v, k )]);
+#else
bone = &bones->EvalRender(piBoneReferences[G2_GetVertBoneIndex( v, k )]);
+#endif // JK2_MODE
+
fBoneWeight = G2_GetVertBoneWeightNotSlow( v, k);
fTotalWeight += fBoneWeight;
@@ -3039,7 +3090,13 @@ void RB_SurfaceGhoul( CRenderableSurface *surf )
tess.xyz[baseVertex][1] += fBoneWeight * ( DotProduct( bone->matrix[1], v->vertCoords ) + bone->matrix[1][3] );
tess.xyz[baseVertex][2] += fBoneWeight * ( DotProduct( bone->matrix[2], v->vertCoords ) + bone->matrix[2][3] );
}
+
+#ifdef JK2_MODE
+ // FIXME BBi
+ bone = &bones->Eval(piBoneReferences[G2_GetVertBoneIndex( v, k )]);
+#else
bone = &bones->EvalRender(piBoneReferences[G2_GetVertBoneIndex( v, k )]);
+#endif // JK2_MODE
fBoneWeight = 1.0f-fTotalWeight;
tess.xyz[baseVertex][0] += fBoneWeight * ( DotProduct( bone->matrix[0], v->vertCoords ) + bone->matrix[0][3] );
diff --git a/code/server/sv_savegame.cpp b/code/server/sv_savegame.cpp
index aba6ce0..167014a 100644
--- a/code/server/sv_savegame.cpp
+++ b/code/server/sv_savegame.cpp
@@ -572,7 +572,7 @@ void SG_WriteCvars(void)
void SG_ReadCvars(void)
{
int iCount;
- const char* psName;
+ std::string psName;
const char* psValue;
auto saved_game = &ojk::SavedGame::get_instance();
@@ -586,18 +586,17 @@ void SG_ReadCvars(void)
saved_game->read_chunk(
INT_ID('C','V','A','R'));
- auto name_buffer = saved_game->get_buffer();
- psName = reinterpret_cast<const char*>(name_buffer.data());
+ psName = reinterpret_cast<const char*>(
+ saved_game->get_buffer_data());
saved_game->read_chunk(
INT_ID('V','A','L','U'));
- auto value_buffer = saved_game->get_buffer();
- psValue = reinterpret_cast<const char*>(value_buffer.data());
+ psValue = reinterpret_cast<const char*>(
+ saved_game->get_buffer_data());
-
- ::Cvar_Set(psName, psValue);
+ ::Cvar_Set(psName.c_str(), psValue);
}
}
@@ -686,8 +685,8 @@ void SG_ReadServerConfigStrings( void )
saved_game->read_chunk(
INT_ID('C','S','D','A'));
- auto& sg_buffer = saved_game->get_buffer();
- psName = reinterpret_cast<const char*>(sg_buffer.data());
+ psName = reinterpret_cast<const char*>(
+ saved_game->get_buffer_data());
Com_DPrintf( "Cfg str %d = %s\n",iIndex, psName);
diff --git a/code/server/sv_snapshot.cpp b/code/server/sv_snapshot.cpp
index 16e5f3f..acc9c87 100644
--- a/code/server/sv_snapshot.cpp
+++ b/code/server/sv_snapshot.cpp
@@ -417,11 +417,13 @@ static void SV_AddEntitiesVisibleFromPoint( vec3_t origin, clientSnapshot_t *fra
continue;
}
+#ifndef JK2_MODE
if (ent->s.isPortalEnt)
{ //rww - portal entities are always sent as well
SV_AddEntToSnapshot( svEnt, ent, eNums );
continue;
}
+#endif // !JK2_MODE
#ifndef JK2_MODE
if ( sightOn )
diff --git a/codeJK2/game/g_savegame.cpp b/codeJK2/game/g_savegame.cpp
index 34b6279..71a7d0b 100644
--- a/codeJK2/game/g_savegame.cpp
+++ b/codeJK2/game/g_savegame.cpp
@@ -889,6 +889,12 @@ static void ReadGEntities(qboolean qbAutosave)
// the scary ghoul2 stuff... (fingers crossed)
//
{
+#ifdef JK2_MODE
+ // Skip GL2 data size
+ ::gi.saved_game->read_chunk(
+ INT_ID('G','L','2','S'));
+#endif // JK2_MODE
+
::gi.saved_game->read_chunk(
INT_ID('G','H','L','2'));
diff --git a/shared/qcommon/ojk_i_saved_game.h b/shared/qcommon/ojk_i_saved_game.h
index 125064c..cb83e41 100644
--- a/shared/qcommon/ojk_i_saved_game.h
+++ b/shared/qcommon/ojk_i_saved_game.h
@@ -71,6 +71,27 @@ void ISavedGame::read_chunk(
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// write_chunk
+template<typename TSize>
+void ISavedGame::write_chunk_and_size(
+ const ChunkId size_chunk_id,
+ const ChunkId data_chunk_id)
+{
+ save_buffer();
+
+ auto data_size = get_buffer_size();
+
+ reset_buffer();
+
+ write_chunk<TSize>(
+ size_chunk_id,
+ data_size);
+
+ load_buffer();
+
+ write_chunk(
+ data_chunk_id);
+}
+
template<typename TDst, typename TSrc>
void ISavedGame::write_chunk(
const ChunkId chunk_id,
diff --git a/shared/qcommon/ojk_i_saved_game_fwd.h b/shared/qcommon/ojk_i_saved_game_fwd.h
index b55fe77..91a7e61 100644
--- a/shared/qcommon/ojk_i_saved_game_fwd.h
+++ b/shared/qcommon/ojk_i_saved_game_fwd.h
@@ -10,7 +10,6 @@
#include <cstdint>
#include <string>
-#include <vector>
namespace ojk
@@ -21,7 +20,6 @@ class ISavedGame
{
public:
using ChunkId = uint32_t;
- using Buffer = std::vector<uint8_t>;
ISavedGame();
@@ -72,6 +70,13 @@ public:
virtual void write_chunk(
const ChunkId chunk_id) = 0;
+ // Writes a data-chunk into the file from the internal buffer
+ // prepended with a size-chunk that holds a size of the data-chunk.
+ template<typename TSize>
+ void write_chunk_and_size(
+ const ChunkId size_chunk_id,
+ const ChunkId data_chunk_id);
+
// Writes a value or an array of values into the file via
// the internal buffer.
template<typename TDst = void, typename TSrc = void>
@@ -134,8 +139,17 @@ public:
int count) = 0;
- // Returns an I/O buffer.
- virtual const Buffer& get_buffer() const = 0;
+ // Stores current I/O buffer and it's position.
+ virtual void save_buffer() = 0;
+
+ // Restores saved I/O buffer and it's position.
+ virtual void load_buffer() = 0;
+
+ // Returns a pointer to data in the I/O buffer.
+ virtual const void* get_buffer_data() const = 0;
+
+ // Returns a current size of the I/O buffer.
+ virtual int get_buffer_size() const = 0;
// Clears buffer and resets it's offset to the beginning.
diff --git a/shared/qcommon/ojk_saved_game.cpp b/shared/qcommon/ojk_saved_game.cpp
index 8c63d9c..d10cecc 100644
--- a/shared/qcommon/ojk_saved_game.cpp
+++ b/shared/qcommon/ojk_saved_game.cpp
@@ -12,7 +12,9 @@ namespace ojk
SavedGame::SavedGame() :
file_handle_(),
io_buffer_(),
+ saved_io_buffer_(),
io_buffer_offset_(),
+ saved_io_buffer_offset_(),
rle_buffer_(),
is_readable_(),
is_writable_(),
@@ -621,9 +623,26 @@ void SavedGame::skip(
io_buffer_offset_ = new_offset;
}
-const SavedGame::Buffer& SavedGame::get_buffer() const
+void SavedGame::save_buffer()
{
- return io_buffer_;
+ saved_io_buffer_ = io_buffer_;
+ saved_io_buffer_offset_ = io_buffer_offset_;
+}
+
+void SavedGame::load_buffer()
+{
+ io_buffer_ = saved_io_buffer_;
+ io_buffer_offset_ = saved_io_buffer_offset_;
+}
+
+const void* SavedGame::get_buffer_data() const
+{
+ return io_buffer_.data();
+}
+
+int SavedGame::get_buffer_size() const
+{
+ return static_cast<int>(io_buffer_.size());
}
void SavedGame::rename(
diff --git a/shared/qcommon/ojk_saved_game.h b/shared/qcommon/ojk_saved_game.h
index 481b71c..8b5a9b6 100644
--- a/shared/qcommon/ojk_saved_game.h
+++ b/shared/qcommon/ojk_saved_game.h
@@ -23,7 +23,6 @@ class SavedGame :
{
public:
using ChunkId = uint32_t;
- using Buffer = std::vector<uint8_t>;
SavedGame();
@@ -99,8 +98,20 @@ public:
void skip(
int count) override;
- // Returns an I/O buffer.
- const Buffer& get_buffer() const override;
+
+ // Stores current I/O buffer and it's position.
+ void save_buffer() override;
+
+ // Restores saved I/O buffer and it's position.
+ void load_buffer() override;
+
+
+ // Returns a pointer to data in the I/O buffer.
+ const void* get_buffer_data() const override;
+
+ // Returns a current size of the I/O buffer.
+ int get_buffer_size() const override;
+
// Clears buffer and resets it's offset to the beginning.
void reset_buffer() override;
@@ -130,6 +141,7 @@ protected:
private:
+ using Buffer = std::vector<uint8_t>;
using BufferOffset = Buffer::size_type;
using Paths = std::vector<std::string>;
@@ -140,9 +152,15 @@ private:
// I/O buffer.
Buffer io_buffer_;
+ // Saved copy of the I/O buffer.
+ Buffer saved_io_buffer_;
+
// A current offset inside the I/O buffer.
BufferOffset io_buffer_offset_;
+ // Saved I/O buffer offset.
+ BufferOffset saved_io_buffer_offset_;
+
// RLE codec buffer.
Buffer rle_buffer_;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git
More information about the Pkg-games-commits
mailing list