mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	rogueviz::ads:: adjusted to new action_states
This commit is contained in:
		| @@ -53,11 +53,15 @@ void change_default_key(int key, int val) { | ||||
|  | ||||
| void set_default_keys() { | ||||
|   clear_config(scfg_ads); | ||||
|   change_default_key('s', 16 + 0); | ||||
|   change_default_key('a', 16 + 1); | ||||
|   change_default_key('w', 16 + 2); | ||||
|   change_default_key('d', 16 + 3); | ||||
|   change_default_key('f', 16 + 4); | ||||
|  | ||||
|   /* these are shared with the default config */ | ||||
|   // change_default_key('s', 16 + 0); | ||||
|   // change_default_key('a', 16 + 1); | ||||
|   // change_default_key('w', 16 + 2); | ||||
|   // change_default_key('d', 16 + 3); | ||||
|   // change_default_key('f', 16 + 4); | ||||
|  | ||||
|   /* these are ADS-specific */ | ||||
|   change_default_key('p', 16 + 5); | ||||
|   change_default_key('t', 16 + 6); | ||||
|   change_default_key('o', 16 + 7); | ||||
|   | ||||
| @@ -4,7 +4,12 @@ namespace ads_game { | ||||
|  | ||||
| multi::config scfg_ads; | ||||
|  | ||||
| vector<string> move_names = { "acc down", "acc left", "acc up", "acc right", "fire", "pause", "display times", "switch spin", "menu", "[paused] future", "(paused] past", "[paused] move switch" }; | ||||
| enum pcmds_extra { | ||||
|   pcPause=9, pcDisplayTimes=10, pcSwitchSpin=11, pcMenu=12, | ||||
|   pcPauseFuture=13, pcPausePast=14, pcPauseMoveSwitch=15 | ||||
|   }; | ||||
|  | ||||
| vector<string> move_names = { "", "", "", "", "acc down", "acc left", "acc up", "acc right", "fire", "pause", "display times", "switch spin", "menu", "[paused] future", "[paused] past", "[paused] move switch" }; | ||||
|  | ||||
| void fire() { | ||||
|   if(!pdata.ammo) return; | ||||
| @@ -98,8 +103,10 @@ void apply_lorentz(transmatrix lor) { | ||||
|  | ||||
| ld read_movement() { | ||||
|  | ||||
|   ld mdx = multi::axespressed[4]/30000.; | ||||
|   ld mdy = multi::axespressed[5]/30000.; | ||||
|   auto& axes = multi::axes_for(0); | ||||
|  | ||||
|   ld mdx = axes[0]/30000.; | ||||
|   ld mdy = axes[1]/30000.; | ||||
|   #if CAP_VR | ||||
|   if(vrhr::active()) { | ||||
|     mdy -= vrhr::vrgo_y; | ||||
| @@ -111,11 +118,11 @@ ld read_movement() { | ||||
|     return hypot(mdx, mdy); | ||||
|     } | ||||
|  | ||||
|   auto& a = multi::actionspressed; | ||||
|   bool left = a[16+1]; | ||||
|   bool right = a[16+3]; | ||||
|   bool up = a[16+2]; | ||||
|   bool down = a[16]; | ||||
|   auto& act = multi::action_states[1]; | ||||
|   bool left = act[multi::pcMoveLeft]; | ||||
|   bool right = act[multi::pcMoveRight]; | ||||
|   bool up = act[multi::pcMoveUp]; | ||||
|   bool down = act[multi::pcMoveDown]; | ||||
|  | ||||
|   int clicks = (left?1:0) + (right?1:0) + (up?1:0) + (down?1:0); | ||||
|  | ||||
| @@ -151,14 +158,13 @@ bool ads_turn(int idelta) { | ||||
|  | ||||
|   handle_crashes(); | ||||
|  | ||||
|   auto& a = multi::actionspressed; | ||||
|   auto& la = multi::lactionpressed; | ||||
|   auto& act = multi::action_states[1]; | ||||
|  | ||||
|   if(a[16+4] && !la[16+4] && !paused) fire(); | ||||
|   if(a[16+5] && !la[16+5]) switch_pause(); | ||||
|   if(a[16+6] && !la[16+6]) view_proper_times = !view_proper_times; | ||||
|   if(a[16+7] && !la[16+7]) auto_rotate = !auto_rotate; | ||||
|   if(a[16+8] && !la[16+8]) pushScreen(game_menu); | ||||
|   if(act[multi::pcFire].pressed() && !paused) fire(); | ||||
|   if(act[pcPause].pressed()) switch_pause(); | ||||
|   if(act[pcDisplayTimes].pressed()) view_proper_times = !view_proper_times; | ||||
|   if(act[pcSwitchSpin].pressed()) auto_rotate = !auto_rotate; | ||||
|   if(act[pcMenu].pressed()) pushScreen(game_menu); | ||||
|  | ||||
|   if(auto_angle) pconf.mori().get() = spin(ang) * pconf.mori().get(); | ||||
|  | ||||
| @@ -170,7 +176,8 @@ bool ads_turn(int idelta) { | ||||
|     ld mul = read_movement(); | ||||
|     ld dv = pt * ads_accel * mul; | ||||
|  | ||||
|     if(paused && a[16+11]) { | ||||
|  | ||||
|     if(paused && act[pcPauseMoveSwitch]) { | ||||
|       current = ads_matrix(spin(ang*degree) * xpush(mul*delta*-pause_speed) * spin(-ang*degree), 0) * current; | ||||
|       } | ||||
|     else | ||||
| @@ -183,8 +190,8 @@ bool ads_turn(int idelta) { | ||||
|  | ||||
|     ld tc = 0; | ||||
|     if(!paused) tc = pt; | ||||
|     else if(a[16+9]) tc = pt; | ||||
|     else if(a[16+10]) tc = -pt; | ||||
|     else if(act[pcPauseFuture]) tc = pt; | ||||
|     else if(act[pcPausePast]) tc = -pt; | ||||
|  | ||||
|     if(!paused && !game_over) { | ||||
|       shipstate ss; | ||||
|   | ||||
| @@ -341,14 +341,13 @@ bool ds_turn(int idelta) { | ||||
|  | ||||
|   ds_handle_crashes(); | ||||
|  | ||||
|   auto& a = multi::actionspressed; | ||||
|   auto& la = multi::lactionpressed; | ||||
|   auto& act = multi::action_states[1]; | ||||
|  | ||||
|   if(a[16+4] && !la[16+4] && !paused) ds_fire(); | ||||
|   if(a[16+5] && !la[16+5]) switch_pause(); | ||||
|   if(a[16+6] && !la[16+6]) view_proper_times = !view_proper_times; | ||||
|   if(a[16+7] && !la[16+7]) auto_rotate = !auto_rotate; | ||||
|   if(a[16+8] && !la[16+8]) pushScreen(game_menu); | ||||
|   if(act[multi::pcFire].pressed() && !paused) ds_fire(); | ||||
|   if(act[pcPause].pressed()) switch_pause(); | ||||
|   if(act[pcDisplayTimes].pressed()) view_proper_times = !view_proper_times; | ||||
|   if(act[pcSwitchSpin].pressed()) auto_rotate = !auto_rotate; | ||||
|   if(act[pcMenu].pressed()) pushScreen(game_menu); | ||||
|    | ||||
|   if(true) { | ||||
|     dynamicval<eGeometry> g(geometry, gSpace435); | ||||
| @@ -357,7 +356,7 @@ bool ds_turn(int idelta) { | ||||
|     ld mul = read_movement(); | ||||
|     ld dv = pt * ds_accel * mul; | ||||
|  | ||||
|     if(paused && a[16+11]) { | ||||
|     if(paused && act[pcPauseMoveSwitch]) { | ||||
|       current.T = spin(ang*degree) * cspin(0, 2, mul*delta*-pause_speed) * spin(-ang*degree) * current.T; | ||||
|       } | ||||
|     else { | ||||
| @@ -371,8 +370,8 @@ bool ds_turn(int idelta) { | ||||
|  | ||||
|     ld tc = 0; | ||||
|     if(!paused) tc = pt; | ||||
|     else if(a[16+9]) tc = pt; | ||||
|     else if(a[16+10]) tc = -pt; | ||||
|     else if(act[pcPauseFuture]) tc = pt; | ||||
|     else if(act[pcPausePast]) tc = -pt; | ||||
|  | ||||
|     if(!paused && !game_over) { | ||||
|       shipstate ss; | ||||
| @@ -410,7 +409,7 @@ bool ds_turn(int idelta) { | ||||
|       } | ||||
|     else view_pt += tc; | ||||
|  | ||||
|     if(a[16+4] && !la[16+4] && false) { | ||||
|     if(act[multi::pcFire].pressed()&& false) { | ||||
|       if(history.size()) | ||||
|         history.back().duration = HUGE_VAL; | ||||
|       current = random_spin3(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue