void game_reset()

in procgen/src/games/plunder.cpp [116:192]


    void game_reset() override {
        BasicAbstractGame::game_reset();

        agent->image_type = SHIP;

        juice_left = 1;
        targets_hit = 0;
        target_quota = 20;
        spawn_prob = 0.06f;
        r_scale = options.distribution_mode == EasyMode ? 1.5f : 1.0f;
        int num_total_ship_types = 6;

        num_lanes = 5;
        lane_directions.clear();
        lane_vels.clear();
        target_bools.clear();

        std::vector<int> image_idxs;

        for (int i = 0; i < num_total_ship_types; i++) {
            image_idxs.push_back(i);
        }

        image_permutation = rand_gen.choose_n(image_idxs, num_total_ship_types);

        num_current_ship_types = 2;

        for (int i = 0; i < num_total_ship_types; i++) {
            target_bools.push_back(false);
        }

        for (int i = 0; i < num_current_ship_types / 2; i++) {
            target_bools[image_permutation[i]] = true;
        }

        for (int i = 0; i < num_lanes; i++) {
            lane_directions.push_back(rand_gen.rand01() < .5);
            lane_vels.push_back(.15 + .1 * rand_gen.rand01());
        }

        int num_panels = options.distribution_mode == EasyMode ? 0 : rand_gen.randn(4);
        float panel_width = 1.2f;

        if (panel_width > 0) {
            for (int i = 0; i < num_panels; i++) {
                spawn_entity_rxy(panel_width, .5, PANEL, 0, .25 * main_height, main_width, .25 * main_height);
            }
        }

        float key_scale = 1.5;
        legend_r = 2;

        add_entity(legend_r, legend_r, 0, 0, legend_r, TARGET_BACKGROUND);

        auto ent = add_entity(legend_r, legend_r, 0, 0, r_scale * key_scale, TARGET_LEGEND);
        ent->image_theme = image_permutation[0];
        ent->image_type = SHIP;
        match_aspect_ratio(ent);
        ent->rotation = PI / 2;

        last_fire_time = 0;

        options.center_agent = false;

        agent->rx = r_scale;
        agent->rotation = -1 * PI / 2;
        agent->image_theme = image_permutation[rand_gen.randn(num_current_ship_types / 2) + num_current_ship_types / 2];
        match_aspect_ratio(agent);
        reposition_agent();
        agent->y = 1 + agent->ry;

        min_agent_x = 2 * legend_r + agent->rx;

        if (agent->x < min_agent_x) {
            agent->x = min_agent_x;
        }
    }