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
|
||||
|
||||
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
|
||||
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
|
||||
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 -L$(THISDIR)../psyq/lib
|
||||
# add support for NDR008's VScode setup
|
||||
CPPFLAGS += -I$(THISDIR)../third_party/psyq/include
|
||||
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
|
||||
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
|
||||
// ( 256 * 4096 ) / 320 ) => 3277
|
||||
// ( 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)
|
||||
);
|
||||
// Add color tint
|
||||
CVECTOR prismCol = {0,70,255, 0};
|
||||
CVECTOR prismCol = {0x40,0x40,0xff,0x0};
|
||||
// work color vectors
|
||||
CVECTOR outCol, outCol1, outCol2;
|
||||
// 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;
|
||||
LEVEL curLvl = {0};
|
||||
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
|
||||
void callback();
|
||||
// variable FPS
|
||||
@ -154,7 +161,13 @@ int main() {
|
||||
triCount += curLvl.meshes[k]->tmesh->len;
|
||||
}
|
||||
// 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
|
||||
setCameraPos(&camera, &curLvl.camPtr->campos->pos, &curLvl.camPtr->campos->rot);
|
||||
|
||||
@ -198,6 +211,15 @@ int main() {
|
||||
LoadLevelCD( overlayFile, &load_all_overlays_here );
|
||||
#endif
|
||||
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);
|
||||
levelWas = level;
|
||||
}
|
||||
@ -208,18 +230,35 @@ int main() {
|
||||
if (time % timediv == 0){
|
||||
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
|
||||
if (curLvl.curNode){
|
||||
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 &&
|
||||
!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] ) {
|
||||
// make it point to siblings
|
||||
curLvl.curNode = curLvl.curNode->siblings->list[msh];
|
||||
// set current plane
|
||||
curLvl.levelPtr = curLvl.curNode->plane;
|
||||
}
|
||||
}
|
||||
// Set Prop node
|
||||
if ( !getIntCollision( *curLvl.propPtr->body , *curLvl.curNode->plane->body).vx &&
|
||||
!getIntCollision( *curLvl.propPtr->body , *curLvl.curNode->plane->body).vz ) {
|
||||
curLvl.propPtr->node = curLvl.curNode;
|
||||
@ -266,10 +305,6 @@ int main() {
|
||||
ClearOTagR(otdisc[db], OT2LEN);
|
||||
// Clear Secondary OT
|
||||
ClearOTagR(ot[db], OTLEN);
|
||||
|
||||
if(curLvl.actorPtr->pos.vy >= 200){
|
||||
copyVector(&curLvl.actorPtr->body->position, &lvlStartPos );
|
||||
}
|
||||
// Set camera according to mode
|
||||
setCameraMode(&curLvl, &camera, &posToActor, &angle, &angleCam, curCamAngle, camMode, &lerping);
|
||||
// Render scene
|
||||
|
Loading…
Reference in New Issue
Block a user