2021-07-05 17:47:30 +02:00
|
|
|
#include "../include/psx.h"
|
2021-06-23 19:25:12 +02:00
|
|
|
#include "../include/graphics.h"
|
|
|
|
#include "../include/math.h"
|
2021-07-10 12:08:52 +02:00
|
|
|
#include "../include/CPUMAC.H"
|
|
|
|
|
|
|
|
// Declare registers 16 19 23
|
|
|
|
//~ register ulong ur0 asm("$16");
|
|
|
|
//~ register ulong ur1 asm("$19");
|
|
|
|
//~ register ulong ur2 asm("$20");
|
|
|
|
//~ register ulong ur3 asm("$23");
|
|
|
|
//~ register ulong ur4 asm("$21");
|
|
|
|
//~ register ulong ur5 asm("$22");
|
2021-07-05 17:47:30 +02:00
|
|
|
|
2021-06-28 17:45:18 +02:00
|
|
|
void enlightMesh(LEVEL * curLvl, MESH * mesh, SVECTOR * lgtang){
|
|
|
|
// Update light rotation on actor
|
2021-07-10 12:08:52 +02:00
|
|
|
//~ MATRIX rotlgt, rotmesh, light;
|
2021-06-28 17:45:18 +02:00
|
|
|
// Find rotmat from actor angle
|
2021-07-10 12:08:52 +02:00
|
|
|
RotMatrix_gte(&mesh->rot, dc_wrkmatp);
|
|
|
|
RotMatrix_gte(lgtang, dc_retmatp);
|
|
|
|
gte_MulMatrix0(dc_wrkmatp, dc_retmatp, dc_retmatp);
|
|
|
|
gte_MulMatrix0(curLvl->lgtmat, dc_retmatp, dc_retmatp);
|
|
|
|
gte_SetLightMatrix(dc_retmatp);
|
2021-06-28 17:45:18 +02:00
|
|
|
};
|
2021-06-23 19:25:12 +02:00
|
|
|
void transformMesh(CAMERA * camera, MESH * mesh){
|
2021-07-10 12:08:52 +02:00
|
|
|
//~ MATRIX mat;
|
2021-07-05 17:47:30 +02:00
|
|
|
// Find rotation matrix
|
2021-07-10 12:08:52 +02:00
|
|
|
RotMatrix_gte(&mesh->rot, dc_wrkmatp);
|
2021-07-05 17:47:30 +02:00
|
|
|
// Find translation matrix
|
2021-07-10 12:08:52 +02:00
|
|
|
TransMatrix(dc_wrkmatp, &mesh->pos);
|
2021-06-28 17:45:18 +02:00
|
|
|
// Compose matrix with cam
|
2021-07-10 12:08:52 +02:00
|
|
|
gte_CompMatrix(dc_camMat, dc_wrkmatp, dc_wrkmatp);
|
|
|
|
//gte_MulMatrix0(&camera->mat, &mat, &mat);
|
|
|
|
//~ gte_SetRotMatrix(&camera->mat);
|
|
|
|
//~ gte_ldclmv(&mat);
|
|
|
|
//~ gte_rtir();
|
|
|
|
//~ gte_stclmv(&mat);
|
|
|
|
//~ gte_ldclmv((char*)&mat+2);
|
|
|
|
//~ gte_rtir();
|
|
|
|
//~ gte_stclmv((char*)&mat+2);
|
|
|
|
//~ gte_ldclmv((char*)&mat+4);
|
|
|
|
//~ gte_rtir();
|
|
|
|
//~ gte_stclmv((char*)&mat+4);
|
|
|
|
//~ //
|
|
|
|
//~ gte_SetTransMatrix(&camera->mat);
|
|
|
|
//~ gte_ldlv0((char*)&mat+20);
|
|
|
|
//~ gte_rt();
|
|
|
|
//~ gte_stlvnl((char*)&mat+20);
|
2021-06-28 17:45:18 +02:00
|
|
|
// Set default rotation and translation matrices
|
2021-07-10 12:08:52 +02:00
|
|
|
gte_SetRotMatrix(dc_wrkmatp);
|
|
|
|
gte_SetTransMatrix(dc_wrkmatp);
|
2021-06-28 17:45:18 +02:00
|
|
|
//~ }
|
2021-06-23 19:25:12 +02:00
|
|
|
};
|
2021-07-10 12:08:52 +02:00
|
|
|
void drawPoly(MESH * mesh, int atime, int * camMode, char ** nextpri, u_long * ot, char * db, DRAWENV * draw) {
|
|
|
|
long t = 0;
|
2021-06-23 19:25:12 +02:00
|
|
|
// mesh is POLY_GT3 ( triangle )
|
2021-07-03 11:57:06 +02:00
|
|
|
for (int i = 0; i < (mesh->totalVerts) && (mesh->totalVerts - i) > 2;) {
|
2021-06-29 16:30:44 +02:00
|
|
|
if (mesh->index[t].code == 4) {
|
2021-07-10 12:08:52 +02:00
|
|
|
t = drawTri(mesh, atime, camMode, nextpri, ot, db, draw, t, i);
|
2021-06-29 16:30:44 +02:00
|
|
|
i += 3;
|
|
|
|
}
|
|
|
|
// If mesh is quad
|
|
|
|
if (mesh->index[t].code == 8) {
|
2021-07-10 12:08:52 +02:00
|
|
|
t = drawQuad(mesh, atime, camMode, nextpri, ot, db, draw, t, i);
|
2021-06-29 16:30:44 +02:00
|
|
|
i += 4;
|
|
|
|
}
|
2021-06-25 17:01:35 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
void set3VertexLerPos(MESH * mesh, long t){
|
|
|
|
// Find and set 3 interpolated vertex value
|
2021-07-02 14:49:47 +02:00
|
|
|
// TODO : Fix artifacts at meshes seams.
|
2021-07-05 17:47:30 +02:00
|
|
|
// TODO : Pre-calculate lerp positions at runtime (for i in nframes, do calc)
|
2021-06-25 17:01:35 +02:00
|
|
|
// Fixed point math precision
|
|
|
|
short precision = 12;
|
|
|
|
// Vertex 1
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vx ].vx = lerpD( mesh->anim->data[mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[t].order.vx].vx << precision , mesh->anim->data[(mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[t].order.vx].vx << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vx ].vz = lerpD( mesh->anim->data[mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[t].order.vx].vz << precision , mesh->anim->data[(mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[t].order.vx].vz << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vx ].vy = lerpD( mesh->anim->data[mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[t].order.vx].vy << precision , mesh->anim->data[(mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[t].order.vx].vy << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
// Vertex 2
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vz ].vx = lerpD( mesh->anim->data[mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[t].order.vz].vx << precision , mesh->anim->data[(mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[t].order.vz].vx << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vz ].vz = lerpD( mesh->anim->data[mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[t].order.vz].vz << precision , mesh->anim->data[(mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[t].order.vz].vz << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vz ].vy = lerpD( mesh->anim->data[mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[t].order.vz].vy << precision , mesh->anim->data[(mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[t].order.vz].vy << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
// Vertex 3
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vy ].vx = lerpD( mesh->anim->data[mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[t].order.vy].vx << precision , mesh->anim->data[(mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[t].order.vy].vx << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vy ].vz = lerpD( mesh->anim->data[mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[t].order.vy].vz << precision , mesh->anim->data[(mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[t].order.vy].vz << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vy ].vy = lerpD( mesh->anim->data[mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[t].order.vy].vy << precision , mesh->anim->data[(mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[t].order.vy].vy << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->anim->cursor += 24 * mesh->anim->dir;
|
|
|
|
};
|
|
|
|
void set4VertexLerPos(MESH * mesh, long t){
|
|
|
|
// Find and set 4 interpolated vertex value
|
|
|
|
short precision = 12;
|
|
|
|
// Vertex 1
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vx ].vx = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.vx ].vx << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.vx ].vx << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vx ].vz = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.vx ].vz << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.vx ].vz << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vx ].vy = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.vx ].vy << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.vx ].vy << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
// Vertex 2
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vz ].vx = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.vz ].vx << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.vz ].vx << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vz ].vz = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.vz ].vz << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.vz ].vz << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vz ].vy = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.vz ].vy << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.vz ].vy << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
// Vertex 3
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vy ].vx = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.vy ].vx << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.vy ].vx << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vy ].vz = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.vy ].vz << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.vy ].vz << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.vy ].vy = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.vy ].vy << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.vy ].vy << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
// Vertex 4
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.pad ].vx = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.pad ].vx << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.pad ].vx << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.pad ].vz = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.pad ].vz << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.pad ].vz << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->tmesh->v[ mesh->index[ t ].order.pad ].vy = lerpD( mesh->anim->data[ mesh->anim->lerpCursor * mesh->anim->nvert + mesh->index[ t ].order.pad ].vy << precision , mesh->anim->data[ (mesh->anim->lerpCursor + 1) * mesh->anim->nvert + mesh->index[ t ].order.pad ].vy << precision, mesh->anim->cursor << precision) >> precision;
|
|
|
|
mesh->anim->cursor += 2 * mesh->anim->dir;
|
|
|
|
}
|
2021-07-10 12:08:52 +02:00
|
|
|
long interpolateTri(POLY_GT3 * poly, MESH * mesh, long t){
|
|
|
|
long Flag, nclip = 0;
|
2021-06-25 17:01:35 +02:00
|
|
|
// Ping pong
|
|
|
|
//~ //if (mesh->anim->cursor > 4096 || mesh->anim->cursor < 0){
|
|
|
|
//~ // mesh->anim->dir *= -1;
|
|
|
|
//~ //}
|
|
|
|
// Find next keyframe
|
|
|
|
if (mesh->anim->cursor > (1 << 12)) {
|
|
|
|
// There are still keyframes to interpolate between
|
|
|
|
if ( mesh->anim->lerpCursor < mesh->anim->nframes - 1 ) {
|
|
|
|
mesh->anim->lerpCursor ++;
|
|
|
|
mesh->anim->cursor = 0;
|
|
|
|
}
|
|
|
|
// We've reached last frame, go back to first frame
|
|
|
|
if ( mesh->anim->lerpCursor == mesh->anim->nframes - 1 ) {
|
|
|
|
mesh->anim->lerpCursor = 0;
|
|
|
|
mesh->anim->cursor = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Find and set interpolated vertex value
|
|
|
|
set3VertexLerPos(mesh, t);
|
|
|
|
// Coord transformation from world space to screen space
|
2021-07-05 17:47:30 +02:00
|
|
|
gte_RotAverageNclip3(
|
2021-06-25 17:01:35 +02:00
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vx ],
|
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vz ],
|
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vy ],
|
|
|
|
( long* ) &poly->x0, ( long* ) &poly->x1, ( long* ) &poly->x2,
|
|
|
|
&mesh->p,
|
|
|
|
&mesh->OTz,
|
2021-07-05 17:47:30 +02:00
|
|
|
&Flag,
|
|
|
|
&nclip
|
2021-06-25 17:01:35 +02:00
|
|
|
);
|
|
|
|
return nclip;
|
|
|
|
};
|
2021-07-10 12:08:52 +02:00
|
|
|
long interpolateQuad(POLY_GT4 * poly4, MESH * mesh, long t){
|
|
|
|
long Flag, nclip = 0;
|
2021-06-25 17:01:35 +02:00
|
|
|
// ping pong
|
|
|
|
//~ if (mesh->anim->cursor > 4096 || mesh->anim->cursor < 0){
|
|
|
|
//~ mesh->anim->dir *= -1;
|
|
|
|
//~ }
|
|
|
|
short precision = 12;
|
|
|
|
if ( mesh->anim->cursor > 1<<precision ) {
|
|
|
|
if ( mesh->anim->lerpCursor < mesh->anim->nframes - 1 ) {
|
|
|
|
mesh->anim->lerpCursor ++;
|
|
|
|
mesh->anim->cursor = 0;
|
|
|
|
}
|
|
|
|
if ( mesh->anim->lerpCursor == mesh->anim->nframes - 1 ) {
|
|
|
|
mesh->anim->lerpCursor = 0;
|
|
|
|
mesh->anim->cursor = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Find and set interpolated vertex value
|
|
|
|
set4VertexLerPos(mesh, t);
|
|
|
|
// Coord transformations
|
2021-07-05 17:47:30 +02:00
|
|
|
gte_RotAverageNclip4(
|
2021-06-25 17:01:35 +02:00
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.pad ],
|
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vz],
|
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vx ],
|
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vy ],
|
|
|
|
( long* )&poly4->x0, ( long* )&poly4->x1, ( long* )&poly4->x2, ( long* )&poly4->x3,
|
|
|
|
&mesh->p,
|
|
|
|
&mesh->OTz,
|
2021-07-05 17:47:30 +02:00
|
|
|
&Flag,
|
|
|
|
&nclip
|
2021-06-25 17:01:35 +02:00
|
|
|
);
|
|
|
|
return nclip;
|
|
|
|
};
|
2021-07-02 14:49:47 +02:00
|
|
|
void set3Prism(POLY_GT3 * poly, MESH * mesh, DRAWENV * draw, char * db, int i){
|
2021-06-25 17:01:35 +02:00
|
|
|
// Transparency effect :
|
|
|
|
// Use current DRAWENV clip as TPAGE instead of regular textures
|
2021-07-02 14:49:47 +02:00
|
|
|
//
|
|
|
|
// FIXME : Fixed BGs : find a way to know we're using em.
|
|
|
|
// With pre-rendered background, just set the tpage to bpp, x, y of the image in vram : 8bpp, 320, 0 by default for now
|
|
|
|
// But how do we now fixed BGs are used ?
|
|
|
|
//~ if (fixed_BGS){
|
|
|
|
//~ ( (POLY_GT3 *) poly )->tpage = getTPage( 0, 0, 320, 0 );
|
|
|
|
//~ }
|
2021-06-25 17:01:35 +02:00
|
|
|
( (POLY_GT3 *) poly )->tpage = getTPage( 2, 0,
|
2021-07-02 14:49:47 +02:00
|
|
|
draw[*db].clip.x,
|
|
|
|
draw[*db].clip.y
|
2021-06-25 17:01:35 +02:00
|
|
|
);
|
|
|
|
// Use projected coordinates (results from RotAverage...) as UV coords and clamp them to 0-255,0-224 -> 240 - 16
|
|
|
|
setUV3( poly,
|
|
|
|
(poly->x0 < 0 ? 0 : poly->x0 > 255 ? 255 : poly->x0),
|
|
|
|
(poly->y0 < 0 ? 0 : poly->y0 > 224 ? 224 : poly->y0),
|
|
|
|
(poly->x1 < 0 ? 0 : poly->x1 > 255 ? 255 : poly->x1),
|
|
|
|
(poly->y1 < 0 ? 0 : poly->y1 > 224 ? 224 : poly->y1),
|
|
|
|
(poly->x2 < 0 ? 0 : poly->x2 > 255 ? 255 : poly->x2),
|
|
|
|
(poly->y2 < 0 ? 0 : poly->y2 > 224 ? 224 : poly->y2)
|
|
|
|
);
|
|
|
|
|
|
|
|
setRGB0(poly, mesh->tmesh->c[i].r, mesh->tmesh->c[i].g, mesh->tmesh->c[i].b);
|
|
|
|
setRGB1(poly, mesh->tmesh->c[i+2].r, mesh->tmesh->c[i+2].g, mesh->tmesh->c[i+2].b);
|
|
|
|
setRGB2(poly, mesh->tmesh->c[i+1].r, mesh->tmesh->c[i+1].g, mesh->tmesh->c[i+1].b);
|
|
|
|
};
|
2021-07-02 14:49:47 +02:00
|
|
|
void set4Prism(POLY_GT4 * poly4, MESH * mesh, DRAWENV * draw, char * db, int i){
|
2021-06-25 17:01:35 +02:00
|
|
|
( (POLY_GT4 *) poly4)->tpage = getTPage( 2, 0,
|
2021-07-02 14:49:47 +02:00
|
|
|
draw[*db].clip.x,
|
|
|
|
draw[*db].clip.y
|
2021-06-25 17:01:35 +02:00
|
|
|
);
|
|
|
|
// Use projected coordinates
|
|
|
|
setUV4( poly4,
|
|
|
|
(poly4->x0 < 0? 0 : poly4->x0 > 255? 255 : poly4->x0),
|
|
|
|
(poly4->y0 < 0? 0 : poly4->y0 > 224? 224 : poly4->y0),
|
|
|
|
(poly4->x1 < 0? 0 : poly4->x1 > 255? 255 : poly4->x1),
|
|
|
|
(poly4->y1 < 0? 0 : poly4->y1 > 224? 224 : poly4->y1),
|
|
|
|
(poly4->x2 < 0? 0 : poly4->x2 > 255? 255 : poly4->x2),
|
|
|
|
(poly4->y2 < 0? 0 : poly4->y2 > 224? 224 : poly4->y2),
|
|
|
|
(poly4->x3 < 0? 0 : poly4->x3 > 255? 255 : poly4->x3),
|
|
|
|
(poly4->y3 < 0? 0 : poly4->y3 > 224? 224 : poly4->y3)
|
|
|
|
);
|
|
|
|
|
|
|
|
setRGB0(poly4, mesh->tmesh->c[i+3].r, mesh->tmesh->c[i+3].g, mesh->tmesh->c[i+3].b);
|
|
|
|
setRGB1(poly4, mesh->tmesh->c[i+2].r, mesh->tmesh->c[i+2].g, mesh->tmesh->c[i+2].b);
|
|
|
|
setRGB2(poly4, mesh->tmesh->c[i+0].r, mesh->tmesh->c[i+0].g, mesh->tmesh->c[i+0].b);
|
|
|
|
setRGB3(poly4, mesh->tmesh->c[i+1].r, mesh->tmesh->c[i+1].g, mesh->tmesh->c[i+1].b);
|
|
|
|
};
|
|
|
|
void set3Tex(POLY_GT3 * poly, MESH * mesh, DRAWENV * draw, long t, int i){
|
|
|
|
CVECTOR outCol = { 0,0,0,0 };
|
|
|
|
CVECTOR outCol1 = { 0,0,0,0 };
|
|
|
|
CVECTOR outCol2 = { 0,0,0,0 };
|
|
|
|
// Use regular TPAGE
|
2021-07-01 17:35:08 +02:00
|
|
|
if (mesh->tim){
|
|
|
|
( (POLY_GT3 *) poly )->tpage = getTPage(mesh->tim->mode&0x3, 0,
|
|
|
|
mesh->tim->prect->x,
|
|
|
|
mesh->tim->prect->y
|
|
|
|
);
|
|
|
|
setUV3(poly, mesh->tmesh->u[i].vx , mesh->tmesh->u[i].vy + mesh->tim->prect->y,
|
|
|
|
mesh->tmesh->u[i+2].vx, mesh->tmesh->u[i+2].vy + mesh->tim->prect->y,
|
|
|
|
mesh->tmesh->u[i+1].vx, mesh->tmesh->u[i+1].vy + mesh->tim->prect->y);
|
|
|
|
} else {
|
|
|
|
( (POLY_GT3 *) poly)->tpage = getTPage( 2,0,0,0 );
|
|
|
|
setUV3(poly, 0,0,0,0,0,0);
|
|
|
|
}
|
2021-07-05 17:47:30 +02:00
|
|
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vx ], &mesh->tmesh->c[ i+0 ], mesh->p, &outCol);
|
|
|
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vz ], &mesh->tmesh->c[ i+2 ], mesh->p, &outCol1);
|
|
|
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vy ], &mesh->tmesh->c[ i+1 ], mesh->p, &outCol2);
|
2021-06-25 17:01:35 +02:00
|
|
|
setRGB0(poly, outCol.r, outCol.g , outCol.b);
|
|
|
|
setRGB1(poly, outCol1.r, outCol1.g, outCol1.b);
|
|
|
|
setRGB2(poly, outCol2.r, outCol2.g, outCol2.b);
|
|
|
|
};
|
|
|
|
void set4Tex(POLY_GT4 * poly4, MESH * mesh, DRAWENV * draw, long t, int i){
|
|
|
|
|
2021-07-01 17:35:08 +02:00
|
|
|
CVECTOR outCol = {255,255,255,0};
|
|
|
|
CVECTOR outCol1 = {255,255,255,0};
|
|
|
|
CVECTOR outCol2 = {255,255,255,0};
|
|
|
|
CVECTOR outCol3 = {255,255,255,0};
|
2021-06-25 17:01:35 +02:00
|
|
|
// Use regular TPAGE
|
2021-07-01 17:35:08 +02:00
|
|
|
if (mesh->tim){
|
|
|
|
( (POLY_GT4 *) poly4)->tpage = getTPage(
|
|
|
|
mesh->tim->mode&0x3, 0,
|
|
|
|
mesh->tim->prect->x,
|
|
|
|
mesh->tim->prect->y
|
|
|
|
);
|
|
|
|
|
|
|
|
// Use model UV coordinates
|
|
|
|
setUV4( poly4,
|
|
|
|
mesh->tmesh->u[i+3].vx, mesh->tmesh->u[i+3].vy + mesh->tim->prect->y,
|
|
|
|
mesh->tmesh->u[i+2].vx, mesh->tmesh->u[i+2].vy + mesh->tim->prect->y,
|
|
|
|
mesh->tmesh->u[i+0].vx, mesh->tmesh->u[i+0].vy + mesh->tim->prect->y,
|
|
|
|
mesh->tmesh->u[i+1].vx, mesh->tmesh->u[i+1].vy + mesh->tim->prect->y
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
( (POLY_GT4 *) poly4)->tpage = getTPage( 2,0,0,0 );
|
|
|
|
setUV4(poly4, 0,0,0,0,0,0,0,0);
|
|
|
|
}
|
2021-07-05 17:47:30 +02:00
|
|
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.pad ] , &mesh->tmesh->c[ i+3 ], mesh->p, &outCol);
|
|
|
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vz ] , &mesh->tmesh->c[ i+2 ], mesh->p, &outCol1);
|
|
|
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vx ] , &mesh->tmesh->c[ i+0 ], mesh->p, &outCol2);
|
|
|
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vy ] , &mesh->tmesh->c[ i+1 ], mesh->p, &outCol3);
|
2021-06-25 17:01:35 +02:00
|
|
|
setRGB0(poly4, outCol.r, outCol.g , outCol.b);
|
|
|
|
setRGB1(poly4, outCol1.r, outCol1.g, outCol1.b);
|
|
|
|
setRGB2(poly4, outCol2.r, outCol2.g, outCol2.b);
|
|
|
|
setRGB3(poly4, outCol3.r, outCol3.g, outCol3.b);
|
|
|
|
};
|
2021-07-05 17:47:30 +02:00
|
|
|
int set4Subdiv(MESH * mesh, POLY_GT4 * poly4, u_long * ot, long t, int i, char ** nextpri){
|
|
|
|
//~ // FIXME : Poly subdiv
|
2021-06-25 17:01:35 +02:00
|
|
|
//~ DIVPOLYGON4 div4 = { 0 };
|
|
|
|
//~ div4.pih = SCREENXRES;
|
|
|
|
//~ div4.piv = SCREENYRES;
|
2021-07-05 17:47:30 +02:00
|
|
|
//~ div4.ndiv = 1;
|
|
|
|
|
|
|
|
//~ long OTc = mesh->OTz >> 4;
|
2021-06-25 17:01:35 +02:00
|
|
|
//~ FntPrint("OTC:%d", OTc);
|
|
|
|
//~ if (OTc < 4) {
|
2021-07-05 17:47:30 +02:00
|
|
|
//~ // if (OTc > 1) div4.ndiv = 1; else div4.ndiv = 2;
|
2021-06-25 17:01:35 +02:00
|
|
|
//~ DivideGT4(
|
|
|
|
//~ // Vertex coord
|
2021-07-05 17:47:30 +02:00
|
|
|
//~ mesh->tmesh->v[ mesh->index[t].order.pad ],
|
|
|
|
//~ mesh->tmesh->v[ mesh->index[t].order.vz ],
|
|
|
|
//~ mesh->tmesh->v[ mesh->index[t].order.vx ],
|
|
|
|
//~ mesh->tmesh->v[ mesh->index[t].order.vy ],
|
2021-06-25 17:01:35 +02:00
|
|
|
//~ // UV coord
|
|
|
|
//~ mesh->tmesh->u[i+3],
|
|
|
|
//~ mesh->tmesh->u[i+2],
|
|
|
|
//~ mesh->tmesh->u[i+0],
|
|
|
|
//~ mesh->tmesh->u[i+1],
|
|
|
|
//~ // Color
|
|
|
|
//~ mesh->tmesh->c[i+3],
|
2021-07-05 17:47:30 +02:00
|
|
|
//~ mesh->tmesh->c[i+2],
|
|
|
|
//~ mesh->tmesh->c[i+0],
|
|
|
|
//~ mesh->tmesh->c[i+1],
|
2021-06-25 17:01:35 +02:00
|
|
|
//~ // Gpu packet
|
|
|
|
//~ poly4,
|
2021-07-05 17:47:30 +02:00
|
|
|
//~ &ot[ mesh->OTz-4],
|
2021-06-25 17:01:35 +02:00
|
|
|
//~ &div4);
|
|
|
|
//~ // Increment primitive list pointer
|
2021-07-05 17:47:30 +02:00
|
|
|
//~ // *nextpri += ( (sizeof(POLY_GT4) + 3) / 4 ) * (( 1 << ( div4.ndiv )) << ( div4.ndiv ));
|
|
|
|
//~ return ( (sizeof(POLY_GT4) * 4) );
|
|
|
|
//~ // triCount = ((1<<(div4.ndiv))<<(div4.ndiv));
|
|
|
|
//~ }
|
|
|
|
//~ else if (OTc < 48) {
|
|
|
|
//~ return (sizeof( POLY_GT4 ));
|
2021-06-25 17:01:35 +02:00
|
|
|
//~ }
|
2021-07-05 17:47:30 +02:00
|
|
|
return 0;
|
2021-06-25 17:01:35 +02:00
|
|
|
};
|
2021-07-10 12:08:52 +02:00
|
|
|
long drawQuad(MESH * mesh, int atime, int * camMode, char ** nextpri, u_long * ot, char * db, DRAWENV * draw, int t, int i) {
|
|
|
|
long Flag, nclip = 0;
|
2021-07-05 17:47:30 +02:00
|
|
|
int subSkip = 0;
|
2021-06-25 17:01:35 +02:00
|
|
|
// If mesh is quad
|
2021-06-29 16:30:44 +02:00
|
|
|
POLY_GT4 * poly4;
|
|
|
|
//~ for (int i = 0; i < (mesh->tmesh->len * 4); i += 4) {
|
2021-06-25 17:01:35 +02:00
|
|
|
// if mesh is not part of BG, draw them, else, discard
|
|
|
|
if ( !(mesh->isBG) || *camMode != 2 ) {
|
|
|
|
poly4 = (POLY_GT4 *)*nextpri;
|
|
|
|
|
|
|
|
// Vertex Anim
|
|
|
|
if (mesh->isAnim){
|
|
|
|
// with interpolation
|
|
|
|
if ( mesh->anim->interpolate ){
|
2021-07-10 12:08:52 +02:00
|
|
|
interpolateQuad(poly4, mesh, t);
|
2021-06-23 19:25:12 +02:00
|
|
|
} else {
|
2021-06-25 17:01:35 +02:00
|
|
|
// No interpolation, use all vertices coordinates in anim data
|
2021-07-05 17:47:30 +02:00
|
|
|
gte_RotAverageNclip4(
|
2021-06-25 17:01:35 +02:00
|
|
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.pad ],
|
|
|
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vz ],
|
|
|
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vx ],
|
|
|
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vy ],
|
|
|
|
( long* )&poly4->x0, ( long* )&poly4->x1, ( long* )&poly4->x2, ( long* )&poly4->x3,
|
2021-06-23 19:25:12 +02:00
|
|
|
&mesh->p,
|
|
|
|
&mesh->OTz,
|
2021-07-05 17:47:30 +02:00
|
|
|
&Flag,
|
|
|
|
&nclip
|
2021-06-23 19:25:12 +02:00
|
|
|
);
|
|
|
|
}
|
2021-06-25 17:01:35 +02:00
|
|
|
} else {
|
2021-07-01 11:01:39 +02:00
|
|
|
// Mesh is sprite
|
|
|
|
if (mesh->isSprite){
|
|
|
|
// Find inverse rotation matrix so that sprite always faces camera
|
|
|
|
MATRIX rot, invRot;
|
2021-07-05 17:47:30 +02:00
|
|
|
gte_ReadRotMatrix(&rot);
|
2021-07-01 11:01:39 +02:00
|
|
|
TransposeMatrix(&rot, &invRot);
|
2021-07-05 17:47:30 +02:00
|
|
|
//~ SetMulRotMatrix(&invRot);
|
|
|
|
gte_MulMatrix0(&rot, &invRot, &invRot);
|
|
|
|
gte_SetRotMatrix(&invRot);
|
2021-07-01 11:01:39 +02:00
|
|
|
}
|
2021-06-25 17:01:35 +02:00
|
|
|
// Use regular vertex coords
|
2021-07-05 17:47:30 +02:00
|
|
|
gte_RotAverageNclip4(
|
2021-06-25 17:01:35 +02:00
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.pad ],
|
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vz],
|
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vx ],
|
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vy ],
|
|
|
|
(long*)&poly4->x0, (long*)&poly4->x1, (long*)&poly4->x2, (long*)&poly4->x3,
|
|
|
|
&mesh->p,
|
|
|
|
&mesh->OTz,
|
2021-07-05 17:47:30 +02:00
|
|
|
&Flag,
|
|
|
|
&nclip
|
2021-06-23 19:25:12 +02:00
|
|
|
);
|
2021-06-25 17:01:35 +02:00
|
|
|
}
|
|
|
|
if (nclip > 0 && mesh->OTz > 0 && (mesh->p < 4096)) {
|
|
|
|
SetPolyGT4(poly4);
|
2021-07-02 19:21:09 +02:00
|
|
|
if (mesh->tim){
|
|
|
|
// If tim mode == 0 | 1, set CLUT coordinates
|
|
|
|
if ( (mesh->tim->mode & 0x3) < 2 ) {
|
|
|
|
setClut(poly4,
|
|
|
|
mesh->tim->crect->x,
|
|
|
|
mesh->tim->crect->y
|
|
|
|
);
|
|
|
|
}
|
2021-06-25 17:01:35 +02:00
|
|
|
}
|
|
|
|
if (mesh->isSprite){
|
2021-07-01 11:01:39 +02:00
|
|
|
// Turn off shading on sprite
|
2021-06-25 17:01:35 +02:00
|
|
|
SetShadeTex( poly4, 1 );
|
2021-06-23 19:25:12 +02:00
|
|
|
}
|
2021-06-25 17:01:35 +02:00
|
|
|
// Transparency effect
|
|
|
|
if (mesh->isPrism){
|
2021-07-02 14:49:47 +02:00
|
|
|
set4Prism(poly4, mesh, draw, db, i);
|
2021-06-25 17:01:35 +02:00
|
|
|
} else {
|
|
|
|
set4Tex(poly4, mesh, draw, t, i);
|
|
|
|
}
|
|
|
|
if ( (mesh->OTz > 0) /*&& (*mesh->OTz < OTLEN)*/ && (mesh->p < 4096) ) {
|
|
|
|
AddPrim( &ot[ mesh->OTz-3 ], poly4 );
|
|
|
|
}
|
|
|
|
*nextpri += sizeof( POLY_GT4 );
|
2021-06-23 19:25:12 +02:00
|
|
|
}
|
2021-06-29 16:30:44 +02:00
|
|
|
t++;
|
|
|
|
return t;
|
2021-06-23 19:25:12 +02:00
|
|
|
}
|
2021-06-29 16:30:44 +02:00
|
|
|
//~ }
|
2021-06-25 17:01:35 +02:00
|
|
|
};
|
2021-07-10 12:08:52 +02:00
|
|
|
long drawTri(MESH * mesh, int atime, int * camMode, char ** nextpri, u_long * ot, char * db, DRAWENV * draw, int t, int i) {
|
|
|
|
long Flag, nclip = 0;
|
2021-06-25 17:01:35 +02:00
|
|
|
// mesh is POLY_GT3 ( triangle )
|
|
|
|
POLY_GT3 * poly;
|
|
|
|
// len member == # vertices, but here it's # of triangle... So, for each tri * 3 vertices ...
|
2021-06-29 16:30:44 +02:00
|
|
|
//~ for ( int i = 0; i < (mesh->tmesh->len * 3); i += 3 ) {
|
2021-06-25 17:01:35 +02:00
|
|
|
// If mesh is not part of precalculated background, draw them, else, discard
|
|
|
|
if ( !( mesh->isBG ) || *camMode != 2) {
|
|
|
|
poly = (POLY_GT3 *)*nextpri;
|
|
|
|
// If Vertex Anim flag is set, use it
|
|
|
|
if (mesh->isAnim){
|
|
|
|
// If interpolation flag is set, use it
|
|
|
|
if(mesh->anim->interpolate){
|
2021-07-10 12:08:52 +02:00
|
|
|
nclip = interpolateTri(poly, mesh, t);
|
2021-06-25 17:01:35 +02:00
|
|
|
} else {
|
|
|
|
// No interpolation
|
|
|
|
// Use the pre-calculated vertices coordinates from the animation data
|
2021-07-05 17:47:30 +02:00
|
|
|
gte_RotAverageNclip3(
|
|
|
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vx ],
|
|
|
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vz ],
|
|
|
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vy ],
|
|
|
|
( long* ) &poly->x0, ( long* ) &poly->x1, ( long* ) &poly->x2,
|
|
|
|
&mesh->p,
|
|
|
|
&mesh->OTz,
|
|
|
|
&Flag,
|
|
|
|
&nclip
|
|
|
|
);
|
2021-06-23 19:25:12 +02:00
|
|
|
}
|
2021-06-25 17:01:35 +02:00
|
|
|
} else {
|
|
|
|
// No animation
|
2021-07-01 11:01:39 +02:00
|
|
|
if (mesh->isSprite){
|
|
|
|
// Find inverse rotation matrix so that sprite always faces camera
|
2021-07-10 12:08:52 +02:00
|
|
|
//~ MATRIX rot, invRot;
|
|
|
|
// Use scratchpad dc_wrkmatp and dc_retmatp
|
|
|
|
gte_ReadRotMatrix(dc_wrkmatp);
|
|
|
|
TransposeMatrix(dc_wrkmatp, dc_retmatp);
|
2021-07-05 17:47:30 +02:00
|
|
|
//~ SetMulRotMatrix(&invRot);
|
2021-07-10 12:08:52 +02:00
|
|
|
gte_MulMatrix0(dc_wrkmatp, dc_retmatp, dc_retmatp);
|
|
|
|
gte_SetRotMatrix(dc_retmatp);
|
2021-07-01 11:01:39 +02:00
|
|
|
}
|
2021-06-25 17:01:35 +02:00
|
|
|
// Use model's regular vertex coordinates
|
2021-07-10 12:08:52 +02:00
|
|
|
gte_RotAverageNclip3(
|
2021-06-25 17:01:35 +02:00
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vx ],
|
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vz ],
|
|
|
|
&mesh->tmesh->v[ mesh->index[t].order.vy ],
|
|
|
|
( long * ) &poly->x0, ( long * ) &poly->x1, ( long * ) &poly->x2,
|
|
|
|
&mesh->p,
|
|
|
|
&mesh->OTz,
|
2021-07-10 12:08:52 +02:00
|
|
|
&Flag,
|
|
|
|
&nclip
|
2021-06-23 19:25:12 +02:00
|
|
|
);
|
2021-06-25 17:01:35 +02:00
|
|
|
}
|
|
|
|
// Do not draw invisible meshes
|
|
|
|
if ( nclip > 0 && mesh->OTz > 0 && (mesh->p < 4096) ) {
|
|
|
|
SetPolyGT3( poly );
|
2021-07-02 19:21:09 +02:00
|
|
|
if (mesh->tim){
|
|
|
|
// CLUT setup
|
|
|
|
// If tim mode == 0 | 1 (4bits/8bits image), set CLUT coordinates
|
|
|
|
if ( (mesh->tim->mode & 0x3 ) < 2){
|
|
|
|
setClut(poly,
|
|
|
|
mesh->tim->crect->x,
|
|
|
|
mesh->tim->crect->y);
|
|
|
|
}
|
|
|
|
if ( mesh->isSprite ) {
|
|
|
|
SetShadeTex( poly, 1 );
|
|
|
|
}
|
2021-06-25 17:01:35 +02:00
|
|
|
}
|
|
|
|
// If isPrism flag is set, use it
|
|
|
|
if ( mesh->isPrism ) {
|
2021-07-02 14:49:47 +02:00
|
|
|
set3Prism(poly, mesh, draw, db, i);
|
2021-06-25 17:01:35 +02:00
|
|
|
} else {
|
|
|
|
set3Tex(poly, mesh, draw, t, i);
|
|
|
|
}
|
|
|
|
if ( (mesh->OTz > 0) /*&& (*mesh->OTz < OTLEN)*/ && (mesh->p < 4096) ) {
|
2021-07-10 12:08:52 +02:00
|
|
|
AddPrim(&ot[ mesh->OTz-4 ], poly);
|
2021-06-25 17:01:35 +02:00
|
|
|
}
|
|
|
|
*nextpri += sizeof(POLY_GT3);
|
2021-06-23 19:25:12 +02:00
|
|
|
}
|
2021-06-29 16:30:44 +02:00
|
|
|
t++;
|
|
|
|
return t;
|
2021-06-23 19:25:12 +02:00
|
|
|
}
|
2021-06-29 16:30:44 +02:00
|
|
|
//~ }
|
2021-06-23 19:25:12 +02:00
|
|
|
};
|
|
|
|
void drawBG(CAMANGLE * camPtr, char ** nextpri, u_long * otdisc, char * db) {
|
|
|
|
// Draw BG image in two SPRT since max width == 256 px
|
|
|
|
SPRT * sprt;
|
|
|
|
DR_TPAGE * tpage;
|
|
|
|
// Left part
|
|
|
|
sprt = ( SPRT * ) *nextpri;
|
|
|
|
setSprt( sprt );
|
|
|
|
setRGB0( sprt, 128, 128, 128 );
|
|
|
|
setXY0( sprt, 0, 0 );
|
|
|
|
setWH( sprt, 256, SCREENYRES );
|
|
|
|
setUV0( sprt, 0, 0 );
|
|
|
|
setClut( sprt,
|
|
|
|
camPtr->BGtim->crect->x,
|
|
|
|
camPtr->BGtim->crect->y
|
|
|
|
);
|
|
|
|
addPrim( otdisc[ OT2LEN - 1 ], sprt );
|
|
|
|
*nextpri += sizeof( SPRT );
|
|
|
|
// Change TPAGE
|
|
|
|
tpage = (DR_TPAGE *) *nextpri;
|
|
|
|
setDrawTPage(
|
|
|
|
tpage, 0, 1,
|
|
|
|
getTPage(
|
|
|
|
camPtr->BGtim->mode & 0x3, 0,
|
|
|
|
camPtr->BGtim->prect->x,
|
|
|
|
camPtr->BGtim->prect->y
|
|
|
|
)
|
|
|
|
);
|
|
|
|
addPrim( otdisc[OT2LEN-1], tpage);
|
|
|
|
*nextpri += sizeof(DR_TPAGE);
|
|
|
|
// Right part
|
|
|
|
sprt = ( SPRT * ) *nextpri;
|
|
|
|
setSprt( sprt );
|
|
|
|
setRGB0( sprt, 128, 128, 128 );
|
|
|
|
setXY0( sprt, SCREENXRES - ( SCREENXRES - 256 ), 0 );
|
|
|
|
setWH( sprt, SCREENXRES - 256, SCREENYRES );
|
|
|
|
setUV0( sprt, 0, 0 );
|
|
|
|
setClut( sprt,
|
|
|
|
camPtr->BGtim->crect->x,
|
|
|
|
camPtr->BGtim->crect->y
|
|
|
|
);
|
|
|
|
addPrim( otdisc[ OT2LEN-1 ], sprt );
|
|
|
|
*nextpri += sizeof( SPRT );
|
|
|
|
tpage = ( DR_TPAGE * ) *nextpri;
|
|
|
|
// Change TPAGE
|
|
|
|
setDrawTPage(
|
|
|
|
tpage, 0, 1,
|
|
|
|
getTPage(
|
|
|
|
camPtr->BGtim->mode & 0x3, 0,
|
|
|
|
// X offset width depends on TIM's mode
|
|
|
|
camPtr->BGtim->prect->x + ( 64 << ( camPtr->BGtim->mode & 0x3 ) ),
|
|
|
|
camPtr->BGtim->prect->y
|
|
|
|
)
|
|
|
|
);
|
|
|
|
addPrim( otdisc[ OT2LEN-1 ], tpage );
|
|
|
|
*nextpri += sizeof( DR_TPAGE );
|
|
|
|
};
|