1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

ads-game:: model permanently switched to underlying geometry

This commit is contained in:
Zeno Rogue 2022-09-17 16:47:22 +02:00
parent de859c35aa
commit 22ef01964a
5 changed files with 43 additions and 27 deletions

View File

@ -47,10 +47,27 @@ void run_ads_game() {
ci_at[c].rocks.clear();
});
vctrV = new_vctrV = ads_matrix(Id, 0);
rogueviz::rv_hook(hooks_prestats, 100, view_ads_game);
rogueviz::rv_hook(hooks_frame, 100, view_ads_game);
rogueviz::rv_hook(hooks_prestats, 100, display_rsrc);
rogueviz::rv_hook(hooks_handleKey, 0, handleKey);
rogueviz::rv_hook(shmup::hooks_turn, 0, ads_turn);
init_rsrc();
cgi.use_count++;
hybrid::in_underlying_geometry([] {
cgi.use_count++;
});
auto umap = hybrid::get_umap();
hybrid::actual_geometry = geometry;
geometry = hybrid::underlying;
hybrid::underlying_cgip->single_step = cgi.single_step;
hybrid::underlying_cgip->psl_steps = cgi.psl_steps;
cgip = hybrid::underlying_cgip;
hybrid::pmap = currentmap;
currentmap = umap;
pmodel = mdDisk;
cwt.at = centerover = currentmap->gamestart();
}
auto shot_hooks =

View File

@ -108,6 +108,8 @@ bool ads_turn(int idelta) {
ld delta = idelta / anims::period;
if(!(cmode & sm::NORMAL)) return false;
hybrid::in_actual([&] {
handle_crashes();
@ -136,6 +138,8 @@ bool ads_turn(int idelta) {
if(a[16+7] && !la[16+7]) auto_rotate = !auto_rotate;
if(a[16+8] && !la[16+8]) pushScreen(game_menu);
if(auto_angle) pconf.model_orientation += ang;
if(true) {
/* proper time passed */
@ -204,9 +208,12 @@ bool ads_turn(int idelta) {
}
else view_pt += tc;
}
if(auto_angle) pconf.model_orientation -= ang;
fixmatrix_ads(current.T);
fixmatrix_ads(vctrV.T);
});
return true;
}

View File

@ -127,15 +127,18 @@ void draw_game_cell(cell *cs, ads_matrix V, ld plev) {
}
bool view_ads_game() {
auto plev = cgi.plevel; /* we are in another CGI so we have no access to that... */
gen_budget = 3;
void view_ads_game() {
ld plev;
displayed.clear();
vctr = new_vctr;
vctrV = new_vctrV;
cross_result base;
if(1) {
hybrid::in_actual([&] {
plev = cgi.plevel; /* we are in another CGI so we have no access to that... */
gen_budget = 3;
vctr = new_vctr;
vctrV = new_vctrV;
cross_result base;
// todo rebase
base = findflat(ads_point(C0, 0));
// println(hlog, base.h);
@ -161,19 +164,13 @@ bool view_ads_game() {
else { current = bcurrent; }
}
}
);
// current = current * gpushxto0(p);
// vctrV = rgpushxto0(p) * vctrV;
hybrid::in_underlying_geometry([&] {
dynamicval<eModel> p(pmodel, mdDisk);
check_cgi();
cgi.require_basics();
cgi.require_shapes();
ptds.clear();
calcparam();
clearaura();
if(1) {
make_shape();
set<cell*> visited;
queue<pair<cell*, ads_matrix>> dq;
auto visit = [&] (cell *c, const ads_matrix& V) {
@ -229,15 +226,7 @@ bool view_ads_game() {
string str = format(tformat, view_pt / TAU);
queuestr(shiftless(Id), .1, str, 0xFFFF00, 8);
}
if(false) queuepolyat(shiftless(rgpushxto0(base.h)), cgi.shGem[0], 0x2020FFFF, PPR::LINE);
drawqueue();
drawaura();
});
check_cgi();
display_rsrc();
return true;
}
}
}}

View File

@ -68,4 +68,6 @@ ld how_much_invincibility = TAU / 4;
player_data pdata, max_pdata, tank_pdata;
bool auto_angle = true;
}}

View File

@ -84,7 +84,7 @@ void display(int id, int y, ld val, ld maxv, ld tank, ld unit) {
}
}
void display_rsrc() {
bool display_rsrc() {
dynamicval<eGeometry> g(geometry, gEuclid);
dynamicval<eModel> pm(pmodel, mdDisk);
dynamicval<bool> ga(vid.always3, false);
@ -102,6 +102,7 @@ void display_rsrc() {
#undef D
quickqueue();
return true;
}
void gain_resource(eResourceType rsrc) {