Files
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

159 lines
3.6 KiB
C++

#include "MAXProxyHeaders.hpp"
//
//############################################################################
//########################## MAXIndex ###########################
//############################################################################
//
MemoryBlock*
MAXIndex::AllocatedMemory = NULL;
MAXIndex::ClassData*
MAXIndex::DefaultData = NULL;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
MAXIndex::InitializeClass()
{
Verify(!AllocatedMemory);
AllocatedMemory =
new MemoryBlock(
sizeof(MAXIndex),
10,
10,
"MAXIndex"
);
Register_Object(AllocatedMemory);
Verify(!DefaultData);
DefaultData =
new ClassData(
MAXIndexClassID,
"MAXIndex",
IndexProxy::DefaultData
);
Register_Object(DefaultData);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
MAXIndex::TerminateClass()
{
Unregister_Object(DefaultData);
delete DefaultData;
DefaultData = NULL;
Unregister_Object(AllocatedMemory);
delete AllocatedMemory;
AllocatedMemory = NULL;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
MAXIndex::Destroy()
{
Check_Object(this);
Verify(referenceCount == 1);
DetachReference();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MAXIndex::MAXIndex(
MAXPolygon *polygon,
MAXVertex *vertex
):
Proxies::IndexProxy(DefaultData, polygon, vertex)
{
Check_Pointer(this);
Check_Object(polygon);
Check_Object(vertex);
Check_Object(this);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MAXIndex::~MAXIndex()
{
Check_Object(this);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
MAXIndex::TestInstance() const
{
Verify(IsDerivedFrom(DefaultData));
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Proxies::IndexProxy*
MAXIndex::UseNextIndexProxy()
{
Check_Object(this);
Check_Object(vertexProxy);
MAXVertex *vertex = GetVertexProxy();
Check_Object(vertex);
int current_index = vertex->GetVertexIndex();
MAXPolygonMesh *mesh_proxy = vertex->GetPolygonMeshProxy();
Check_Pointer(mesh_proxy);
int number_verts = mesh_proxy->GetNumVertices();
if (current_index+1 < number_verts)
{
vertex = MAXVertex::MakeProxy(vertex->GetPolygonMeshProxy(),
current_index+1,
0,
mesh_proxy->GetVertex(current_index+1),-1);
Register_Object(vertex);
Proxies::IndexProxy *proxy = MakeProxy(GetPolygonProxy(), vertex);
Register_Object(proxy);
Verify(vertex->GetReferenceCount() == 2);
vertex->DetachReference();
return proxy;
}
return NULL;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Proxies::IndexProxy*
MAXIndex::UsePreviousIndexProxy()
{
Check_Object(this);
Check_Object(vertexProxy);
MAXVertex *vertex = GetVertexProxy();
Check_Object(vertex);
int current_index = vertex->GetVertexIndex();
MAXPolygonMesh *mesh_proxy = vertex->GetPolygonMeshProxy();
Check_Pointer(mesh_proxy);
int number_verts = mesh_proxy->GetNumVertices();
if (current_index-1 > -1)
{
vertex = MAXVertex::MakeProxy(vertex->GetPolygonMeshProxy(),
current_index-1,
0,
mesh_proxy->GetVertex(current_index-1),-1);
Register_Object(vertex);
Proxies::IndexProxy *proxy = MakeProxy(GetPolygonProxy(), vertex);
Register_Object(proxy);
Verify(vertex->GetReferenceCount() == 2);
vertex->DetachReference();
return proxy;
}
return NULL;
}