Skip to content

Commit

Permalink
Merge pull request #187 from Michael0933/PIPE3D_HalvePlaneGetRingPoints
Browse files Browse the repository at this point in the history
[PIPE3D]: Implement PIPE3D_HalvePlaneGetRingPoints
  • Loading branch information
Gh0stBlade authored Dec 18, 2023
2 parents 4d80e3e + 5d500af commit c7fb9e1
Showing 1 changed file with 57 additions and 29 deletions.
86 changes: 57 additions & 29 deletions KAIN2/Game/PIPE3D.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "MATH3D.H"
#include "STREAM.H"
#include "LIGHT3D.H"
#include "DRAW.H"
#include "PSX/COLLIDES.H"
#include "G2/MAING2.H"
#include "G2/QUATG2.H"
Expand Down Expand Up @@ -824,37 +825,64 @@ void PIPE3D_HalvePlaneInstanceTransformAndDraw(struct _Instance* instance, MATRI
}
}

// autogenerated function stub:
// void /*$ra*/ PIPE3D_HalvePlaneGetRingPoints(struct _Instance *instance /*$a0*/, MATRIX *wcTransform /*$fp*/, struct _VertexPool *vertexPool /*$s6*/, struct _PrimPool *primPool /*$s7*/, unsigned long **ot /*stack 16*/, struct _FXHalvePlane *ring /*stack 20*/)
void PIPE3D_HalvePlaneGetRingPoints(struct _Instance *instance, MATRIX *wcTransform, struct _VertexPool *vertexPool, struct _PrimPool *primPool, unsigned long **ot, struct _FXHalvePlane *ring)
{ // line 2220, offset 0x8003c048
/* begin block 1 */
// Start line: 2221
// Start offset: 0x8003C048
// Variables:
struct Object *object; // $v1
struct _Model *model; // $s1
MATRIX *matrixPool; // $s3
//MATRIX wpTransform; // stack offset -152
//MATRIX pwTransform; // stack offset -120
//MATRIX pcTransform; // stack offset -88
struct _MVertex *vertexList; // $s4
struct _PVertex *poolVertex; // $s5
struct _SVector normalX; // stack offset -56
struct _SVector *normal; // $a1
struct _SVector translation; // stack offset -48
struct _PlaneConstants *halvePlane; // $a0
/* end block 1 */
// End offset: 0x8003C1E8
// End Line: 2278
void PIPE3D_HalvePlaneGetRingPoints(struct _Instance* instance, MATRIX* wcTransform, struct _VertexPool* vertexPool, _PrimPool* primPool, unsigned long** ot, struct _FXHalvePlane* ring) // Matching - 99.96%
{
struct Object* object;
struct _Model* model;
MATRIX* matrixPool;
MATRIX wpTransform;
MATRIX pwTransform;
MATRIX pcTransform;
struct _MVertex* vertexList;
struct _PVertex* poolVertex;
_SVector normalX;
_SVector* normal;
_SVector translation;
struct _PlaneConstants* halvePlane;

/* begin block 2 */
// Start line: 4440
/* end block 2 */
// End Line: 4441
UNIMPLEMENTED();
}
poolVertex = (struct _PVertex*)vertexPool;
object = instance->object;
normal = &normalX;

matrixPool = instance->matrix;
model = object->modelList[instance->currentModel];
vertexList = model->vertexList;

if (ring->type == 0)
{
halvePlane = &ring->ringPlane;
}
else
{
halvePlane = &instance->halvePlane;
}

normal->x = halvePlane->a;
normal->y = halvePlane->b;
normal->z = halvePlane->c;
translation.x = (short)-((normal->x * halvePlane->d) >> 12);
translation.y = (short)-((normal->y * halvePlane->d) >> 12);
translation.z = (short)-((normal->z * halvePlane->d) >> 12);

PIPE3D_CalcWorldToSplitPlaneTransform(&wpTransform, normal, &translation);
PIPE3D_InvertTransform(&pwTransform, &wpTransform);

if (ring->type == 2)
{
PIPE3D_InvertTransform(&pcTransform, &wpTransform);
}
else
{
CompMatrix(wcTransform, &pwTransform, &pcTransform);
}

if (matrixPool != 0)
{
PIPE3D_TransformSplitInstanceVertices(vertexList, poolVertex, model, &wpTransform, matrixPool, 0);
draw_belowSplit = 0;
primPool->nextPrim = (unsigned int*)DRAW_DrawRingPoints(model, vertexPool, &pcTransform, primPool, ot, ring->currentColor, ring->type);
}
}

// autogenerated function stub:
// void /*$ra*/ PIPE3D_DoGlow(struct _Instance *instance /*$s2*/, MATRIX *wcTransform /*$a1*/, struct _VertexPool *vertexPool /*$a2*/, struct _PrimPool *primPool /*$s3*/, unsigned long **ot /*stack 16*/, struct _FXGlowEffect *glow /*stack 20*/)
Expand Down

0 comments on commit c7fb9e1

Please sign in to comment.