Only show undiscovered platonic artifacts

main
Cameron Murphy Reikes 2 years ago
parent bd41a64b84
commit f318416a53

Binary file not shown.

@ -3281,23 +3281,35 @@ void process(struct GameState *gs, double dt)
for (int i = 0; i < MAX_BOX_TYPES; i++) for (int i = 0; i < MAX_BOX_TYPES; i++)
{ {
cpVect cur_pos = gs->platonic_positions[i]; cpVect cur_pos = gs->platonic_positions[i];
if (cpvlength(cur_pos) > 0.0) // zero is uninitialized, the platonic solid doesn't exist (probably) @Robust do better if (cpvlengthsq(cur_pos) > 0.0) // zero is uninitialized, the platonic solid doesn't exist (probably) @Robust do better
{ {
cpVect towards = cpvsub(cur_pos, from_pos); cpVect towards = cpvsub(cur_pos, from_pos);
double length_to_cur = cpvlength(towards); double length_to_cur = cpvlength(towards);
detections[i].direction = cpvnormalize(towards); detections[i].direction = cpvnormalize(towards);
detections[i].of_type = i;
detections[i].intensity = length_to_cur; // so it sorts correctly, changed to intensity correctly after sorting detections[i].intensity = length_to_cur; // so it sorts correctly, changed to intensity correctly after sorting
} }
} }
qsort(detections, MAX_BOX_TYPES, sizeof(detections[0]), platonic_detection_compare); qsort(detections, MAX_BOX_TYPES, sizeof(detections[0]), platonic_detection_compare);
for (int i = 0; i < SCANNER_MAX_PLATONICS; i++) for (int i = 0; i < SCANNER_MAX_PLATONICS; i++)
{ {
cur_box->detected_platonics[i] = detections[i]; for (int detections_i = 0; detections_i < MAX_BOX_TYPES; detections_i++)
if (cur_box->detected_platonics[i].intensity > 0.0)
{ {
// so can be viewed in debugger what causes it not to be used
bool use_this_detection = true;
use_this_detection &= detections[detections_i].intensity > 0.0;
use_this_detection &= !detections[detections_i].used_in_scanner_closest_lightning_bolts;
use_this_detection &= !learned_boxes_has_box(cur_box->blueprints_learned, detections[detections_i].of_type);
if (use_this_detection)
{
detections[detections_i].used_in_scanner_closest_lightning_bolts = true;
cur_box->detected_platonics[i] = detections[detections_i];
cur_box->detected_platonics[i].intensity = max(0.1, 1.0 - clamp01(cur_box->detected_platonics[i].intensity / 100.0)); cur_box->detected_platonics[i].intensity = max(0.1, 1.0 - clamp01(cur_box->detected_platonics[i].intensity / 100.0));
} }
} }
}
// after the above logic detections has been modified, do not use
circle_query(gs->space, entity_pos(cur_box), SCANNER_MAX_RANGE); circle_query(gs->space, entity_pos(cur_box), SCANNER_MAX_RANGE);
cpBody *body_results[512] = {0}; cpBody *body_results[512] = {0};

@ -257,8 +257,12 @@ typedef struct InputFrame
typedef struct PlatonicDetection typedef struct PlatonicDetection
{ {
// only these two are serialized
cpVect direction; cpVect direction;
double intensity; double intensity;
enum BoxType of_type;
bool used_in_scanner_closest_lightning_bolts;
} PlatonicDetection; } PlatonicDetection;
typedef struct Entity typedef struct Entity

Loading…
Cancel
Save