static void AnchorData_Create_Phase_II_Original_Method(EERIE_BACKGROUND * eb) { Vec3f pos; float count = 0; long lastper = -1; long per; float total = static_cast<float>(eb->Zsize * eb->Xsize); for(long j = 0; j < eb->Zsize; j++) for(long i = 0; i < eb->Xsize; i++) { per = count / total * 100.f; if(per != lastper) { LogInfo << "Anchor Generation: %" << per << " (Pass II)"; lastper = per; } count += 1.f; EERIE_BKG_INFO * eg = &eb->fastdata[i][j]; pos.x = (float)((float)((float)i) * (float)eb->Xdiv); pos.y = 0.f; pos.z = (float)((float)((float)j) * (float)eb->Zdiv); Cylinder currcyl; currcyl.radius = 30; currcyl.height = -150.f; currcyl.origin = pos; if(eg->nbpolyin) { long ok = 0; for(long kkk = 0; kkk < eg->nbpolyin; kkk++) { EERIEPOLY * ep = eg->polyin[kkk]; if (ep->type & POLY_PRECISE_PATH) { ok = 1; break; } } if(!ok) continue; float roof = GetTileMinY(i, j); float current_y = GetTileMaxY(i, j); while(current_y > roof) { long added = 0; for(float pposz = 0.f; pposz < 1.f; pposz += 0.1f) for(float pposx = 0.f; pposx < 1.f; pposx += 0.1f) { currcyl.origin.x = pos.x + pposx * eb->Xdiv; currcyl.origin.z = pos.z + pposz * eb->Zdiv; currcyl.origin.y = current_y; EERIEPOLY * ep2 = ANCHOR_CheckInPolyPrecis(currcyl.origin + Vec3f(0.f, -10.f, 0.f)); if(!ep2) continue; if(!(ep2->type & POLY_DOUBLESIDED) && (ep2->norm.y > 0.f)) continue; if(ep2->type & POLY_NOPATH) continue; if(ANCHOR_AttemptValidCylinderPos(currcyl, NULL, CFLAG_NO_INTERCOL | CFLAG_EXTRA_PRECISION | CFLAG_RETURN_HEIGHT | CFLAG_ANCHOR_GENERATION)) { EERIEPOLY * ep2 = ANCHOR_CheckInPolyPrecis(currcyl.origin + Vec3f(0.f, -10.f, 0.f)); if(!ep2) continue; if(!(ep2->type & POLY_DOUBLESIDED) && (ep2->norm.y > 0.f)) continue; if(ep2->type & POLY_NOPATH) continue; if(DirectAddAnchor_Original_Method(eb, eg, &currcyl.origin)) { added = 1; } } } if(added) current_y -= 160.f; current_y -= 50.f; } } } }
void AnchorData_Create_Phase_II_Original_Method(EERIE_BACKGROUND * eb) { char text[256]; EERIE_BKG_INFO * eg; EERIE_3D pos; long k; float count = 0; long lastper = -1; long per; float total = ARX_CLEAN_WARN_CAST_FLOAT(eb->Zsize * eb->Xsize); for (long j = 0; j < eb->Zsize; j++) for (long i = 0; i < eb->Xsize; i++) { float current_y = 99999999999.f; F2L((float)count / total * 100.f, &per); if (per != lastper) { sprintf(text, "Anchor Generation: %d%% (Pass II)", per); lastper = per; _ShowText(text); } count += 1.f; danaeApp.WinManageMess(); eg = &eb->Backg[i+j*eb->Xsize]; pos.x = (float)((float)((float)i) * (float)eb->Xdiv); pos.y = 0.f; pos.z = (float)((float)((float)j) * (float)eb->Zdiv); k = 0; EERIE_CYLINDER currcyl; currcyl.radius = 30; currcyl.height = -150.f; currcyl.origin.x = pos.x; currcyl.origin.y = pos.y; currcyl.origin.z = pos.z; if (eg->nbpolyin) { long ok = 0; for (long kkk = 0; kkk < eg->nbpolyin; kkk++) { EERIEPOLY * ep = eg->polyin[kkk]; if (ep->type & POLY_PRECISE_PATH) { ok = 1; break; } } if (!ok) continue; float roof = GetTileMinY(i, j); current_y = GetTileMaxY(i, j); while (current_y > roof) { long added = 0; for (float pposz = 0.f; pposz < 1.f; pposz += 0.1f) for (float pposx = 0.f; pposx < 1.f; pposx += 0.1f) { currcyl.origin.x = pos.x + pposx * eb->Xdiv; currcyl.origin.z = pos.z + pposz * eb->Zdiv; currcyl.origin.y = current_y; EERIEPOLY * ep2 = ANCHOR_CheckInPolyPrecis(currcyl.origin.x, currcyl.origin.y - 10.f, currcyl.origin.z); if (!ep2) continue; if (!(ep2->type & POLY_DOUBLESIDED) && (ep2->norm.y > 0.f)) continue; if (ep2->type & POLY_NOPATH) continue; if (ANCHOR_AttemptValidCylinderPos(&currcyl, NULL, CFLAG_NO_INTERCOL | CFLAG_EXTRA_PRECISION | CFLAG_RETURN_HEIGHT | CFLAG_ANCHOR_GENERATION)) { EERIEPOLY * ep2 = ANCHOR_CheckInPolyPrecis(currcyl.origin.x, currcyl.origin.y - 10.f, currcyl.origin.z); if (!ep2) continue; if (!(ep2->type & POLY_DOUBLESIDED) && (ep2->norm.y > 0.f)) continue; if (ep2->type & POLY_NOPATH) continue; if (DirectAddAnchor_Original_Method(eb, eg, &currcyl.origin, 0)) { added = 1; } } } if (added) current_y -= 160.f; current_y -= 50.f; } } } }