Fix actor/prop respawn
This commit is contained in:
parent
1dd7405244
commit
0a1ab4b51d
@ -5,8 +5,8 @@ THISDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
|||||||
|
|
||||||
SRCS += $(THISDIR)thirdparty/nugget/common/crt0/crt0.s
|
SRCS += $(THISDIR)thirdparty/nugget/common/crt0/crt0.s
|
||||||
|
|
||||||
CPPFLAGS += -I$(THISDIR)thirdparty/nugget/psyq/include -I$(THISDIR)psyq-4_7-converted/include -I$(THISDIR)psyq-4.7-converted-full/include -I$(THISDIR)psyq/include
|
CPPFLAGS += -I$(THISDIR)thirdparty/nugget/psyq/include -I$(THISDIR)psyq-4_7-converted/include -I$(THISDIR)psyq-4.7-converted-full/include -I$(THISDIR)psyq/include -I$(THISDIR)../psyq/include
|
||||||
LDFLAGS += -L$(THISDIR)thirdparty/nugget/psyq/lib -L$(THISDIR)psyq-4_7-converted/lib -L$(THISDIR)psyq-4.7-converted-full/lib -L$(THISDIR)psyq/lib
|
LDFLAGS += -L$(THISDIR)thirdparty/nugget/psyq/lib -L$(THISDIR)psyq-4_7-converted/lib -L$(THISDIR)psyq-4.7-converted-full/lib -L$(THISDIR)psyq/lib -L$(THISDIR)../psyq/lib
|
||||||
# add support for NDR008's VScode setup
|
# add support for NDR008's VScode setup
|
||||||
CPPFLAGS += -I$(THISDIR)../third_party/psyq/include
|
CPPFLAGS += -I$(THISDIR)../third_party/psyq/include
|
||||||
LDFLAGS += -L$(THISDIR)../third_party/psyq/lib
|
LDFLAGS += -L$(THISDIR)../third_party/psyq/lib
|
||||||
|
@ -165,6 +165,7 @@ void set3Prism(POLY_GT3 * poly, MESH * mesh, DRAWENV * draw, char * db, int i, i
|
|||||||
//~ }
|
//~ }
|
||||||
// Use Drawenv's Tpages 0,0 and 0,256
|
// Use Drawenv's Tpages 0,0 and 0,256
|
||||||
setTPage( poly, 2, 0, 0, !(*db)<<8);
|
setTPage( poly, 2, 0, 0, !(*db)<<8);
|
||||||
|
//~ setShadeTex(poly, 1);
|
||||||
// Use projected coordinates (results from RotAverage...) as UV coords and clamp them to 0-255,0-224 -> 240 - 16
|
// Use projected coordinates (results from RotAverage...) as UV coords and clamp them to 0-255,0-224 -> 240 - 16
|
||||||
// ( 256 * 4096 ) / 320 ) => 3277
|
// ( 256 * 4096 ) / 320 ) => 3277
|
||||||
// ( 240 * 4096 ) / 256 ) => 3840
|
// ( 240 * 4096 ) / 256 ) => 3840
|
||||||
@ -177,7 +178,7 @@ void set3Prism(POLY_GT3 * poly, MESH * mesh, DRAWENV * draw, char * db, int i, i
|
|||||||
((poly->y2 * 3840) >> 12) - (!(*db) << 4)
|
((poly->y2 * 3840) >> 12) - (!(*db) << 4)
|
||||||
);
|
);
|
||||||
// Add color tint
|
// Add color tint
|
||||||
CVECTOR prismCol = {0,70,255, 0};
|
CVECTOR prismCol = {0x40,0x40,0xff,0x0};
|
||||||
// work color vectors
|
// work color vectors
|
||||||
CVECTOR outCol, outCol1, outCol2;
|
CVECTOR outCol, outCol1, outCol2;
|
||||||
// Find local color from normal and prismCol
|
// Find local color from normal and prismCol
|
||||||
|
49
src/main.c
49
src/main.c
@ -83,7 +83,14 @@ VECTOR fVecActor = {0,0,0,0};
|
|||||||
u_long triCount = 0;
|
u_long triCount = 0;
|
||||||
LEVEL curLvl = {0};
|
LEVEL curLvl = {0};
|
||||||
LEVEL * loadLvl;
|
LEVEL * loadLvl;
|
||||||
VECTOR lvlStartPos = {0};
|
// Actor start position
|
||||||
|
VECTOR actorStartPos = {0};
|
||||||
|
VECTOR actorStartRot = {0};
|
||||||
|
NODE * actorStartNode;
|
||||||
|
// Prop start position
|
||||||
|
VECTOR propStartPos = {0};
|
||||||
|
VECTOR propStartRot = {0};
|
||||||
|
NODE * propStartNode;
|
||||||
// Callback function is used for pads
|
// Callback function is used for pads
|
||||||
void callback();
|
void callback();
|
||||||
// variable FPS
|
// variable FPS
|
||||||
@ -154,7 +161,13 @@ int main() {
|
|||||||
triCount += curLvl.meshes[k]->tmesh->len;
|
triCount += curLvl.meshes[k]->tmesh->len;
|
||||||
}
|
}
|
||||||
// Save actor starting pos
|
// Save actor starting pos
|
||||||
copyVector(&lvlStartPos, &curLvl.actorPtr->body->position);
|
copyVector(&actorStartPos, &curLvl.actorPtr->body->position);
|
||||||
|
copyVector(&actorStartRot, &curLvl.actorPtr->rot);
|
||||||
|
actorStartNode = curLvl.curNode;
|
||||||
|
// Save prop starting pos
|
||||||
|
copyVector(&propStartPos, &curLvl.propPtr->body->position);
|
||||||
|
copyVector(&propStartRot, &curLvl.propPtr->rot);
|
||||||
|
propStartNode = curLvl.propPtr->node;
|
||||||
// Set camera starting pos
|
// Set camera starting pos
|
||||||
setCameraPos(&camera, &curLvl.camPtr->campos->pos, &curLvl.camPtr->campos->rot);
|
setCameraPos(&camera, &curLvl.camPtr->campos->pos, &curLvl.camPtr->campos->rot);
|
||||||
|
|
||||||
@ -198,6 +211,15 @@ int main() {
|
|||||||
LoadLevelCD( overlayFile, &load_all_overlays_here );
|
LoadLevelCD( overlayFile, &load_all_overlays_here );
|
||||||
#endif
|
#endif
|
||||||
SwitchLevel( &curLvl, loadLvl);
|
SwitchLevel( &curLvl, loadLvl);
|
||||||
|
// Save actor starting pos
|
||||||
|
copyVector(&actorStartPos, &curLvl.actorPtr->body->position);
|
||||||
|
copyVector(&actorStartRot, &curLvl.actorPtr->rot);
|
||||||
|
actorStartNode = curLvl.curNode;
|
||||||
|
// Save prop starting pos
|
||||||
|
copyVector(&propStartPos, &curLvl.propPtr->body->position);
|
||||||
|
copyVector(&propStartRot, &curLvl.propPtr->rot);
|
||||||
|
propStartNode = curLvl.propPtr->node;
|
||||||
|
// Set level lighting
|
||||||
setLightEnv(draw, curLvl.BGc, curLvl.BKc);
|
setLightEnv(draw, curLvl.BGc, curLvl.BKc);
|
||||||
levelWas = level;
|
levelWas = level;
|
||||||
}
|
}
|
||||||
@ -208,18 +230,35 @@ int main() {
|
|||||||
if (time % timediv == 0){
|
if (time % timediv == 0){
|
||||||
atime ++;
|
atime ++;
|
||||||
}
|
}
|
||||||
|
// Reset player pos
|
||||||
|
if(curLvl.actorPtr->pos.vy >= 200){
|
||||||
|
copyVector(&curLvl.actorPtr->body->position, &actorStartPos );
|
||||||
|
copyVector(&curLvl.actorPtr->rot, &actorStartRot );
|
||||||
|
curLvl.curNode = actorStartNode;
|
||||||
|
curLvl.levelPtr = curLvl.curNode->plane;
|
||||||
|
}
|
||||||
|
if(curLvl.propPtr->pos.vy >= 200){
|
||||||
|
copyVector(&curLvl.propPtr->body->position, &propStartPos );
|
||||||
|
copyVector(&curLvl.propPtr->rot, &propStartRot );
|
||||||
|
curLvl.propPtr->node = propStartNode;
|
||||||
|
}
|
||||||
// Spatial partitioning
|
// Spatial partitioning
|
||||||
if (curLvl.curNode){
|
if (curLvl.curNode){
|
||||||
for ( int msh = 0; msh < curLvl.curNode->siblings->index; msh ++ ) {
|
for ( int msh = 0; msh < curLvl.curNode->siblings->index; msh ++ ) {
|
||||||
// Actor
|
// Set Actor node
|
||||||
|
// If actor is out of plane's X,Z coordinates...
|
||||||
if ( !getIntCollision( *curLvl.actorPtr->body , *curLvl.curNode->siblings->list[msh]->plane->body).vx &&
|
if ( !getIntCollision( *curLvl.actorPtr->body , *curLvl.curNode->siblings->list[msh]->plane->body).vx &&
|
||||||
!getIntCollision( *curLvl.actorPtr->body , *curLvl.curNode->siblings->list[msh]->plane->body).vz )
|
!getIntCollision( *curLvl.actorPtr->body , *curLvl.curNode->siblings->list[msh]->plane->body).vz )
|
||||||
{
|
{
|
||||||
|
// if current node is not already pointing to a sibling
|
||||||
if ( curLvl.curNode != curLvl.curNode->siblings->list[msh] ) {
|
if ( curLvl.curNode != curLvl.curNode->siblings->list[msh] ) {
|
||||||
|
// make it point to siblings
|
||||||
curLvl.curNode = curLvl.curNode->siblings->list[msh];
|
curLvl.curNode = curLvl.curNode->siblings->list[msh];
|
||||||
|
// set current plane
|
||||||
curLvl.levelPtr = curLvl.curNode->plane;
|
curLvl.levelPtr = curLvl.curNode->plane;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Set Prop node
|
||||||
if ( !getIntCollision( *curLvl.propPtr->body , *curLvl.curNode->plane->body).vx &&
|
if ( !getIntCollision( *curLvl.propPtr->body , *curLvl.curNode->plane->body).vx &&
|
||||||
!getIntCollision( *curLvl.propPtr->body , *curLvl.curNode->plane->body).vz ) {
|
!getIntCollision( *curLvl.propPtr->body , *curLvl.curNode->plane->body).vz ) {
|
||||||
curLvl.propPtr->node = curLvl.curNode;
|
curLvl.propPtr->node = curLvl.curNode;
|
||||||
@ -266,10 +305,6 @@ int main() {
|
|||||||
ClearOTagR(otdisc[db], OT2LEN);
|
ClearOTagR(otdisc[db], OT2LEN);
|
||||||
// Clear Secondary OT
|
// Clear Secondary OT
|
||||||
ClearOTagR(ot[db], OTLEN);
|
ClearOTagR(ot[db], OTLEN);
|
||||||
|
|
||||||
if(curLvl.actorPtr->pos.vy >= 200){
|
|
||||||
copyVector(&curLvl.actorPtr->body->position, &lvlStartPos );
|
|
||||||
}
|
|
||||||
// Set camera according to mode
|
// Set camera according to mode
|
||||||
setCameraMode(&curLvl, &camera, &posToActor, &angle, &angleCam, curCamAngle, camMode, &lerping);
|
setCameraMode(&curLvl, &camera, &posToActor, &angle, &angleCam, curCamAngle, camMode, &lerping);
|
||||||
// Render scene
|
// Render scene
|
||||||
|
Loading…
Reference in New Issue
Block a user