/* tests for the new dvec format */ static void testDvec (void) { short dv1 = 0x0724; CU_ASSERT_EQUAL(getDVdir(dv1), 0x07); CU_ASSERT_EQUAL(getDVflags(dv1), 0x02); CU_ASSERT_EQUAL(getDVz(dv1), 0x04); short dv2 = makeDV(6, 3); CU_ASSERT_EQUAL(dv2, 0x0603); dv2 = setDVz(dv2, 4); CU_ASSERT_EQUAL(dv2, 0x0604); }
static int G_FillDirectionTable (dvec_t *dvtab, size_t size, byte crouchingState, pos3_t pos) { int dvec; int numdv = 0; while ((dvec = gi.MoveNext(level.pathingMap, pos, crouchingState)) != ROUTING_UNREACHABLE) { const int oldZ = pos[2]; /* dvec indicates the direction traveled to get to the new cell and the original cell height. */ /* We are going backwards to the origin. */ PosSubDV(pos, crouchingState, dvec); /* Replace the z portion of the DV value so we can get back to where we were. */ dvtab[numdv++] = setDVz(dvec, oldZ); if (numdv >= size) break; } return numdv; }