Finda a face that connects to the specified face Starts looking at startface Returns the attached facenum, or -1 if found none
| 3017 | // Starts looking at startface |
| 3018 | // Returns the attached facenum, or -1 if found none |
| 3019 | int FindConnectedFace(room *rp, int facenum, int edgenum, int startface) { |
| 3020 | face *fp0 = &rp->faces[facenum], *fp1; |
| 3021 | int a0, b0, a1, b1; |
| 3022 | int f; |
| 3023 | |
| 3024 | // Get edge verts - <a0,b0> is edge on first face |
| 3025 | a0 = fp0->face_verts[edgenum]; |
| 3026 | b0 = fp0->face_verts[(edgenum + 1) % fp0->num_verts]; |
| 3027 | |
| 3028 | for (f = startface, fp1 = &rp->faces[startface]; f < rp->num_faces; f++, fp1++) { |
| 3029 | |
| 3030 | if (f == facenum) |
| 3031 | continue; |
| 3032 | |
| 3033 | for (int e = 0; e < fp1->num_verts; e++) { |
| 3034 | |
| 3035 | // Get edge verts - <a1,b1> is edge on second face |
| 3036 | a1 = fp1->face_verts[e]; |
| 3037 | b1 = fp1->face_verts[(e + 1) % fp1->num_verts]; |
| 3038 | |
| 3039 | //@@if ((a0==a1) && (b0==b1)) |
| 3040 | //@@ Int3(); //If you hit this, you probably have a duplicate |
| 3041 | //or overlapping face |
| 3042 | |
| 3043 | if ((a0 == b1) && (b0 == a1)) { // found match! |
| 3044 | return f; |
| 3045 | } |
| 3046 | } |
| 3047 | } |
| 3048 | |
| 3049 | return -1; // no match |
| 3050 | } |
| 3051 | |
| 3052 | // Shell flags |
| 3053 | #define SHELL_NONE 0 |
no outgoing calls
no test coverage detected