From f318416a53b7170342db87e4587dcad9938e7d81 Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Wed, 4 Jan 2023 20:44:40 -0800 Subject: [PATCH] Only show undiscovered platonic artifacts --- flight.rdbg | Bin 1190 -> 1141 bytes gamestate.c | 24 ++++++++++++++++++------ types.h | 4 ++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/flight.rdbg b/flight.rdbg index b273924ce2d56b707f9535ac32b6f88c7051eb9e..2ea14a837c90e45569df3597557eefec02868c78 100644 GIT binary patch delta 121 zcmZ3+`ITcr$>ax&9+M|C`c6(_G-TA6xKWioH!(9$FWGY9MuW*(j64%Jcrsc5+1$nX z+4(u~>1h>u8Iv`b9Hkf;7#M_rxU@Jmz9b{FI6ft{BsIAtGe2+hOr|_WM#jm4EXq90 SKovkX2Z#a+s7x+nF#rH?zamEf delta 180 zcmey$v5a#<38TeieP-3kJ&c0P>1h>{7czP?T0%v{88yJH1V%PST`)_Zk(<#ID$70b ztqh|Jf+NW0l%Gsun_is_safe) + if (i.sun->sun_is_safe) { bool is_entity_dangerous = false; is_entity_dangerous |= e->is_missile; @@ -3281,24 +3281,36 @@ void process(struct GameState *gs, double dt) for (int i = 0; i < MAX_BOX_TYPES; 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); double length_to_cur = cpvlength(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 } } qsort(detections, MAX_BOX_TYPES, sizeof(detections[0]), platonic_detection_compare); for (int i = 0; i < SCANNER_MAX_PLATONICS; i++) { - cur_box->detected_platonics[i] = detections[i]; - if (cur_box->detected_platonics[i].intensity > 0.0) + for (int detections_i = 0; detections_i < MAX_BOX_TYPES; detections_i++) { - cur_box->detected_platonics[i].intensity = max(0.1, 1.0 - clamp01(cur_box->detected_platonics[i].intensity / 100.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)); + } } } + // after the above logic detections has been modified, do not use + circle_query(gs->space, entity_pos(cur_box), SCANNER_MAX_RANGE); cpBody *body_results[512] = {0}; size_t cur_results_len = 0; diff --git a/types.h b/types.h index 3416536..100a121 100644 --- a/types.h +++ b/types.h @@ -257,8 +257,12 @@ typedef struct InputFrame typedef struct PlatonicDetection { + // only these two are serialized cpVect direction; double intensity; + + enum BoxType of_type; + bool used_in_scanner_closest_lightning_bolts; } PlatonicDetection; typedef struct Entity