1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-27 03:47:40 +00:00

ads:: turrets

This commit is contained in:
Zeno Rogue
2024-09-17 17:41:23 +02:00
parent ce7058de5f
commit eba9dd5624
5 changed files with 269 additions and 65 deletions

View File

@@ -149,4 +149,75 @@ int spacetime_qty = 30;
color_t ghost_color = 0x800080FF;
/* types */
enum eObjType { oRock, oMissile, oParticle, oResource, oMainRock, oTurret, oTurretMissile };
enum eResourceType { rtNone, rtHull, rtGold, rtAmmo, rtFuel, rtOxygen };
enum eWalltype { wtNone, wtDestructible, wtSolid, wtGate };
PPR obj_prio[7] = { PPR::MONSTER_BODY, PPR::ITEMa, PPR::ITEM_BELOW, PPR::ITEM, PPR::MONSTER_HEAD, PPR::MONSTER_BODY, PPR::ITEMa };
struct cell_to_draw {
cross_result center;
ld d;
cell *c;
ads_matrix V;
bool operator < (const cell_to_draw& c2) const { return d > c2.d; }
};
/** all cell_to_draw drawn currently */
std::unordered_map<cell*, cell_to_draw> cds, cds_last;
struct turret_state {
ld angle, dist;
int index;
ld err;
};
struct ads_object {
eObjType type;
eResourceType resource;
cell *owner;
ads_matrix at;
color_t col;
int expire;
vector<ld>* shape;
ld last_shot;
int hlast;
map<ld, turret_state> turret_states;
ld life_start, life_end;
cross_result pt_main;
vector<cross_result> pts;
ads_object(eObjType t, cell *_owner, const ads_matrix& T, color_t _col) : type(t), owner(_owner), at(T), col(_col) {
life_start = -HUGE_VAL;
life_end = HUGE_VAL;
}
};
struct shipstate {
ads_matrix at;
ads_matrix current;
ld start;
ld duration;
ld ang;
ads_matrix vctrV;
cell *vctr;
};
struct cellinfo {
int mpd_terrain; /* 0 = fully generated terrain */
int rock_dist; /* rocks generated in this radius */
vector<std::unique_ptr<ads_object>> rocks;
vector<shipstate> shipstates;
eWalltype type;
cellinfo() {
mpd_terrain = 4;
rock_dist = -1;
type = wtNone;
}
};
}}