diff --git a/rogueviz/ads/control.cpp b/rogueviz/ads/control.cpp index aadfa28e..c70a1683 100644 --- a/rogueviz/ads/control.cpp +++ b/rogueviz/ads/control.cpp @@ -14,7 +14,7 @@ void fire() { ads_matrix S1 = S0 * lorentz(0, 2, missile_rapidity); auto& ro = ci_at[c].rocks; - auto r = std::make_unique (oMissile, c, S1, 0xC0C0FFFF); + auto r = std::make_unique (oMissile, c, S1, rsrc_color[rtAmmo]); r->shape = &shape_missile; r->life_start = 0; diff --git a/rogueviz/ads/display.cpp b/rogueviz/ads/display.cpp index a2f37709..165cd9b3 100644 --- a/rogueviz/ads/display.cpp +++ b/rogueviz/ads/display.cpp @@ -71,7 +71,7 @@ void draw_game_cell(const cell_to_draw& cd) { if(isize(slice) < 3) return; for(auto e: slice) curvepoint(e); curvepoint(slice[0]); - queuecurve(shiftless(Id), 0xFFFFFFFF, col, PPR::LINE); + queuecurve(shiftless(Id), 0xFFFFFFFF, col, PPR::WALL); }; for(int v=floor(minv); vcol = 0xFFD500FF; + main_rock->type = oMainRock; + + main_rock = rockgen.add(Id); + main_rock->col = 0xFF; main_rock->shape = &shape_gold; + main_rock->type = oMainRock; /* also create shape_disk */ shape_disk.clear(); @@ -269,7 +274,7 @@ void ds_handle_crashes() { for(auto m: displayed) { if(m->type == oMissile) dmissiles.push_back(m); - if(m->type == oRock) + if(m->type == oRock || m->type == oMainRock) drocks.push_back(m); if(m->type == oResource) dresources.push_back(m); @@ -280,10 +285,12 @@ void ds_handle_crashes() { for(auto r: drocks) { if(pointcrash(h, r->pts)) { m->life_end = m->pt_main.shift; - r->life_end = r->pt_main.shift; + if(r->type != oMainRock) + r->life_end = r->pt_main.shift; dynamicval g(geometry, gSpace435); ds_gen_particles(rpoisson(crash_particle_qty), m->at.T * lorentz(2, 3, m->life_end), m->at.shift, missile_color, crash_particle_rapidity, crash_particle_life); - ds_gen_particles(rpoisson(crash_particle_qty), r->at.T * lorentz(2, 3, r->life_end), r->at.shift, r->col, crash_particle_rapidity, crash_particle_life); + if(r->type != oMainRock) + ds_gen_particles(rpoisson(crash_particle_qty), r->at.T * lorentz(2, 3, r->life_end), r->at.shift, r->col, crash_particle_rapidity, crash_particle_life); break; } } @@ -312,7 +319,7 @@ void ds_fire() { transmatrix S1 = S0 * lorentz(0, 3, missile_rapidity); - auto r = std::make_unique (oMissile, nullptr, ads_matrix(S1, current.shift), 0xC0C0FFFF); + auto r = std::make_unique (oMissile, nullptr, ads_matrix(S1, current.shift), rsrc_color[rtAmmo]); r->shape = &shape_missile; r->life_start = 0; @@ -448,14 +455,14 @@ void view_ds_game() { draw_textures(); - main_rock->at.shift = current.shift; - if(1) { make_shape(); for(auto& r: rocks) { auto& rock = *r; poly_outline = 0xFF; + if(rock.type == oMainRock) rock.at.shift = current.shift; + if(rock.at.shift < current.shift - future_shown) continue; if(rock.at.shift > current.shift + future_shown) continue; @@ -490,12 +497,12 @@ void view_ds_game() { // queuepolyat(shiftless(rgpushxto0(cr.h)), cgi.shGem[0], 0xFFFFFFF, PPR::LINE); for(auto p: rock.pts) curvepoint(p.h); - color_t out = rock.col; - queuecurve(shiftless(Id), out, rock.col, PPR::LINE); + color_t out = rock.type == oResource ? 0xFF : rock.col; + queuecurve(shiftless(Id), out, rock.col, obj_prio[rock.type]); if(view_proper_times && rock.type != oParticle) { ld t = rock.pt_main.shift; - if(&rock == main_rock) t += current.shift; + if(rock.type == oMainRock) t += current.shift; string str = format(tformat, t / time_unit); queuestr(shiftless(rgpushxto0(rock.pt_main.h)), .1, str, 0xFFFF00, 8); } @@ -525,7 +532,7 @@ void view_ds_game() { geometry = g.backup; for(auto pt: pts) curvepoint(pt); - queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::LINE); + queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::MONSTER_FOOT); if(view_proper_times) { string str = format(tformat, (cr.shift + ss.start) / time_unit); @@ -539,7 +546,7 @@ void view_ds_game() { ld u = (invincibility_pt-ship_pt) / how_much_invincibility; poly_outline = gradient(shipcolor, rsrc_color[rtHull], 0, 0.5 + cos(5*u*TAU), 1); } - queuepolyat(shiftless(spin(ang*degree) * Id), shShip, shipcolor, PPR::LINE); + queuepolyat(shiftless(spin(ang*degree) * Id), shShip, shipcolor, PPR::MONSTER_HAIR); poly_outline = 0xFF; if(view_proper_times) { diff --git a/rogueviz/ads/map.cpp b/rogueviz/ads/map.cpp index c146191e..f55d4545 100644 --- a/rogueviz/ads/map.cpp +++ b/rogueviz/ads/map.cpp @@ -2,7 +2,9 @@ namespace hr { namespace ads_game { -enum eObjType { oRock, oMissile, oParticle, oResource }; +enum eObjType { oRock, oMissile, oParticle, oResource, oMainRock }; + +PPR obj_prio[5] = { PPR::MONSTER_BODY, PPR::ITEMa, PPR::ITEM_BELOW, PPR::ITEM, PPR::MONSTER_HEAD }; struct ads_object { eObjType type; diff --git a/rogueviz/ads/resources.cpp b/rogueviz/ads/resources.cpp index 7fbfd426..58106281 100644 --- a/rogueviz/ads/resources.cpp +++ b/rogueviz/ads/resources.cpp @@ -5,7 +5,7 @@ namespace ads_game { enum eResourceType { rtNone, rtHull, rtGold, rtAmmo, rtFuel, rtOxygen }; color_t rock_color[6] = { 0x703800FF, 0xC0A080FF, 0xC08010FF, 0xC04000FF, 0x408000FF, 0x8040A0FF, }; -color_t rsrc_color[6] = { 0x404040FF, 0xC0C0C0FF, 0xFFD500FF, 0xFF0000FF, 0x00FF00FF, 0x0000FFFF }; +color_t rsrc_color[6] = { 0x404040FF, 0x40C0C0FF, 0xFFD500FF, 0xFF0000FF, 0x00FF00FF, 0x0000FFFF }; vector* rsrc_shape[6] = { &shape_particle, &shape_heart, &shape_gold, &shape_weapon, &shape_fuel, &shape_airtank };