mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-11-03 23:33:01 +00:00 
			
		
		
		
	ads-game:: priorities (and also main rock)
This commit is contained in:
		@@ -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<ads_object> (oMissile, c, S1, 0xC0C0FFFF);
 | 
			
		||||
  auto r = std::make_unique<ads_object> (oMissile, c, S1, rsrc_color[rtAmmo]);
 | 
			
		||||
  r->shape = &shape_missile;
 | 
			
		||||
  r->life_start = 0;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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); v<maxv+1; v++) {
 | 
			
		||||
@@ -126,7 +126,7 @@ void draw_game_cell(const cell_to_draw& cd) {
 | 
			
		||||
    queuecurve(shiftless(Id), 
 | 
			
		||||
      rock.type == oMissile ? missile_color : 
 | 
			
		||||
      rock.type == oParticle ? rock.col :
 | 
			
		||||
      0x000000FF, rock.col, PPR::LINE);
 | 
			
		||||
      0x000000FF, rock.col, obj_prio[rock.type]);
 | 
			
		||||
 | 
			
		||||
    if(view_proper_times && rock.type != oParticle) {
 | 
			
		||||
      string str = format(tformat, rock.pt_main.shift / time_unit);
 | 
			
		||||
@@ -156,7 +156,7 @@ void draw_game_cell(const cell_to_draw& cd) {
 | 
			
		||||
 | 
			
		||||
    for(auto h: pts) curvepoint(h);
 | 
			
		||||
    curvepoint(pts[0]);
 | 
			
		||||
    queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::LINE);
 | 
			
		||||
    queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::MONSTER_FOOT);
 | 
			
		||||
 | 
			
		||||
    string str = format(tformat, (cr.shift + rock.start) / time_unit);
 | 
			
		||||
    queuestr(shiftless(rgpushxto0(cr.h)), .1, str, 0xC0C0C0, 8);
 | 
			
		||||
@@ -278,7 +278,7 @@ void view_ads_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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -228,7 +228,12 @@ void init_ds_game() {
 | 
			
		||||
  /* create the main rock first */
 | 
			
		||||
  main_rock = rockgen.add(Id);
 | 
			
		||||
  main_rock->col = 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<eGeometry> 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<ads_object> (oMissile, nullptr, ads_matrix(S1, current.shift), 0xC0C0FFFF);
 | 
			
		||||
  auto r = std::make_unique<ads_object> (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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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<ld>* rsrc_shape[6] = { &shape_particle, &shape_heart, &shape_gold, &shape_weapon, &shape_fuel, &shape_airtank };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user