1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 07:20:02 +00:00

fixed shoot through collision

This commit is contained in:
aap 2021-01-13 20:39:00 +01:00
parent 7994b80dcf
commit 3a6935f126
2 changed files with 13 additions and 4 deletions

View file

@ -507,12 +507,14 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
for(i = 0; i < model.numSpheres; i++){ for(i = 0; i < model.numSpheres; i++){
if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue; if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue;
if(ignoreShootThrough && IsShootThrough(model.spheres[i].surface)) continue;
if(TestLineSphere(*(CColLine*)newline, model.spheres[i])) if(TestLineSphere(*(CColLine*)newline, model.spheres[i]))
return true; return true;
} }
for(i = 0; i < model.numBoxes; i++){ for(i = 0; i < model.numBoxes; i++){
if(ignoreSeeThrough && IsSeeThrough(model.boxes[i].surface)) continue; if(ignoreSeeThrough && IsSeeThrough(model.boxes[i].surface)) continue;
if(ignoreShootThrough && IsShootThrough(model.boxes[i].surface)) continue;
if(TestLineBox(*(CColLine*)newline, model.boxes[i])) if(TestLineBox(*(CColLine*)newline, model.boxes[i]))
return true; return true;
} }
@ -522,6 +524,7 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
VuTriangle vutri; VuTriangle vutri;
for(i = 0; i < model.numTriangles; i++){ for(i = 0; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue; if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i]; CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0); model.vertices[tri->a].Unpack(vutri.v0);
@ -539,6 +542,7 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
#endif #endif
for(; i < model.numTriangles; i++){ for(; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue; if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i]; CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0); model.vertices[tri->a].Unpack(vutri.v0);
@ -1333,6 +1337,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
float coldist = 1.0f; float coldist = 1.0f;
for(i = 0; i < model.numSpheres; i++){ for(i = 0; i < model.numSpheres; i++){
if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue; if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue;
if(ignoreShootThrough && IsShootThrough(model.spheres[i].surface)) continue;
if(ProcessLineSphere(*(CColLine*)newline, model.spheres[i], point, coldist)) if(ProcessLineSphere(*(CColLine*)newline, model.spheres[i], point, coldist))
point.Set(0, 0, model.spheres[i].surface, model.spheres[i].piece); point.Set(0, 0, model.spheres[i].surface, model.spheres[i].piece);
} }
@ -1348,6 +1353,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
CColTriangle *lasttri = nil; CColTriangle *lasttri = nil;
for(i = 0; i < model.numTriangles; i++){ for(i = 0; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue; if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i]; CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0); model.vertices[tri->a].Unpack(vutri.v0);
@ -1367,6 +1373,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
float dist; float dist;
for(; i < model.numTriangles; i++){ for(; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue; if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i]; CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0); model.vertices[tri->a].Unpack(vutri.v0);
@ -1466,13 +1473,13 @@ CCollision::ProcessVerticalLine(const CColLine &line,
float coldist = 1.0f; float coldist = 1.0f;
for(i = 0; i < model.numSpheres; i++){ for(i = 0; i < model.numSpheres; i++){
if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue; if(ignoreSeeThrough && IsSeeThroughVertical(model.spheres[i].surface)) continue;
if(ProcessLineSphere(*(CColLine*)newline, model.spheres[i], point, coldist)) if(ProcessLineSphere(*(CColLine*)newline, model.spheres[i], point, coldist))
point.Set(0, 0, model.spheres[i].surface, model.spheres[i].piece); point.Set(0, 0, model.spheres[i].surface, model.spheres[i].piece);
} }
for(i = 0; i < model.numBoxes; i++){ for(i = 0; i < model.numBoxes; i++){
if(ignoreSeeThrough && IsSeeThrough(model.boxes[i].surface)) continue; if(ignoreSeeThrough && IsSeeThroughVertical(model.boxes[i].surface)) continue;
if(ProcessLineBox(*(CColLine*)newline, model.boxes[i], point, coldist)) if(ProcessLineBox(*(CColLine*)newline, model.boxes[i], point, coldist))
point.Set(0, 0, model.boxes[i].surface, model.boxes[i].piece); point.Set(0, 0, model.boxes[i].surface, model.boxes[i].piece);
} }
@ -1484,7 +1491,7 @@ CCollision::ProcessVerticalLine(const CColLine &line,
CColTriangle *lasttri = nil; CColTriangle *lasttri = nil;
VuTriangle vutri; VuTriangle vutri;
for(i = 0; i < model.numTriangles; i++){ for(i = 0; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue; if(ignoreSeeThrough && IsSeeThroughVertical(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i]; CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0); model.vertices[tri->a].Unpack(vutri.v0);
@ -1503,7 +1510,7 @@ CCollision::ProcessVerticalLine(const CColLine &line,
CVuVector pnt, normal; CVuVector pnt, normal;
float dist; float dist;
for(; i < model.numTriangles; i++){ for(; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue; if(ignoreSeeThrough && IsSeeThroughVertical(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i]; CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0); model.vertices[tri->a].Unpack(vutri.v0);
@ -2289,6 +2296,7 @@ CCollision::DrawColModel(const CMatrix &mat, const CColModel &colModel)
} }
for(i = 0; i < colModel.numBoxes; i++){ for(i = 0; i < colModel.numBoxes; i++){
if(IsShootThrough(colModel.boxes[i].surface)) continue;
min = colModel.boxes[i].min; min = colModel.boxes[i].min;
max = colModel.boxes[i].max; max = colModel.boxes[i].max;

View file

@ -81,6 +81,7 @@ inline bool
IsShootThrough(uint8 surfType) IsShootThrough(uint8 surfType)
{ {
switch(surfType) switch(surfType)
case SURFACE_TRANSPARENT_CLOTH:
case SURFACE_METAL_CHAIN_FENCE: case SURFACE_METAL_CHAIN_FENCE:
case SURFACE_TRANSPARENT_STONE: case SURFACE_TRANSPARENT_STONE:
case SURFACE_SCAFFOLD_POLE: case SURFACE_SCAFFOLD_POLE: