} else Breakpoint();
} else gwin->activate_item(761); break; case SDLK_f: gwin->activate_item(377);
static void Handle_keystroke	(	SDLKey sym,	int shift,        int alt,	int ctrl	)	{	static int inventory_page = -1, stats_page = -1;	int stepping = 1;		if(alt)		stepping = 10;	// If the user is pressing alt, use a				// larger stepping when cycling shapes	switch (sym)		{	case SDLK_RALT:			// Right alt.	case SDLK_RMETA:		altkeys |= 1;		// Set flag.		break;	case SDLK_LALT:	case SDLK_LMETA:		altkeys |= 2;		break;	case SDLK_PLUS:			// Brighten.	case SDLK_KP_PLUS:		if(cheat&&alt) {			current_res++;			if(current_res>=num_res)				current_res = 0;			gwin->resized(res_list[current_res].x,res_list[current_res].y,					res_list[current_res].scale);		} else			gwin->brighten(20);		break;	case SDLK_MINUS:		// Darken.	case SDLK_KP_MINUS:		if(cheat&&alt) {			current_res--;			if(current_res<0)				current_res = num_res-1;			gwin->resized(res_list[current_res].x,res_list[current_res].y,					res_list[current_res].scale);		} else			gwin->brighten(-20);		break;	case SDLK_b:		if(cheat&&ctrl) {			browser->browse_shapes();			gwin->paint();			gwin->set_palette(-1,-1);		} else				Breakpoint();		break;	case SDLK_i:		{		// Show Inventory		if (gwin->get_mode() != Game_window::gump)			inventory_page = stats_page = -1;		if(inventory_page<gwin->get_usecode()->get_party_count())			++inventory_page;		else			inventory_page = 0;		Actor *actor = Get_party_member(inventory_page);		if (actor)			actor->activate(gwin->get_usecode());		if (gwin->get_mode() == Game_window::gump)			mouse->set_shape(Mouse::hand);		break;		}	case SDLK_z:			// Show stats.		{		if (gwin->get_mode() != Game_window::gump)			stats_page = -1;		if (stats_page < gwin->get_usecode()->get_party_count())			++stats_page;		else			stats_page = 0;		Actor *actor = Get_party_member(stats_page);		if (actor)			gwin->show_gump(actor, Game::get_game()->get_shape("gumps/statsdisplay"));		if (gwin->get_mode() == Game_window::gump)			mouse->set_shape(Mouse::hand);		break;		}	case SDLK_c:		{		if (ctrl)		// Create last shape viewed.			{			int current_shape = 0;			int current_frame = 0;			if(browser->get_shape(current_shape, current_frame))				gwin->get_main_actor()->add(					new Ireg_game_object(current_shape,					current_frame, 0, 0), 1);			else				gwin->center_text("Can only create from 'shapes.vga'");			break;			}		gwin->toggle_combat();	// Go into combat mode		gwin->paint();		int mx, my;		// Update mouse.		SDL_GetMouseState(&mx, &my);		Set_mouse_and_speed(mx, my);		break;		}	case SDLK_d:			// ctrl-d:  delete what mouse is on.		{		if (ctrl&&cheat)			{			int x, y;			SDL_GetMouseState(&x, &y);			x = x>>scale;			y = y>>scale;			Game_object *obj = gwin->find_object(x, y);			if (obj)				{				obj->remove_this();				gwin->paint();				}			}		}	case SDLK_h:	// Help keys, ctrl = cheat keys		{		char buf[1024];		if (!ctrl)			{			sprintf(buf, "Keyboard commands\n"				"  +/- - Higher/Lower brightness\n"				"  c - Combat mode\n"				"  i - Show inventory\n"				"  m - Turn on/off music\n"				"  p - Repaint screen\n"				"  ctrl-s/r - Quick Save/Restore\n"				"  s - Show save box\n"				"  z - Show stats\n"				"  F4 - Toggle fullscreen\n"				"  alt-x, F10, ESC - Exit\n"				"  ctrl-h - Cheat Commands\n"			);			}		else			{			sprintf(buf, "Cheat commands\n"				"  Arrow keys - scroll map\n"				"  alt-+/- - Switch resolution\n"				"  ctrl-b - Shape Browser\n"				"  ctrl-c - Create Object\n"				"  ctrl-d - Delete Object\n"				"  alt-g - Toggle God Mode\n"				"  g - Change Avatar gender\n"				"  ctrl-m - Get 100 gold coins\n"				"  alt-n  - Toggle Naked flag (SI)\n"				"  alt-p  - Toggle Petra mode (SI)\n"				"  alt-s - Change skin color (SI)\n"				"  ctrl-t - Fake time period change\n"				"  alt-t  - Teleport\n"				"  ctrl-w - Test weather\n"			);			}		gwin->paint_text_box(MAINSHP_FONT1, buf, 			5, 5, 300, 400);		gwin->get_win()->show();		break;		}	case SDLK_ESCAPE:		// ESC key.		inventory_page = stats_page = -1;		if (gwin->get_mode() == Game_window::gump)			gwin->end_gump_mode();		else			// For now, quit.			Okay_to_quit();		break;	case SDLK_m:		if (ctrl&&cheat) {	// CTRL-m:  get 100 gold coins!			gwin->get_main_actor()->add_quantity(100, 644);			gwin->center_text("Added 100 gold coins");			break;		} else {			static int mnum = 0;			if (shift && mnum > 0)				audio->start_music(--mnum, 0);			else				audio->start_music(mnum++, 0);		}		break;	case SDLK_l:			// Decrement skip_lift.		if(!cheat)			break;		if (gwin->skip_lift == 16)			gwin->skip_lift = 11;		else			gwin->skip_lift--;		if (gwin->skip_lift <= 0)			gwin->skip_lift = 16;#if DEBUG		cout << "Skip_lift = " << gwin->skip_lift << endl;#endif					// FALL THROUGH.	case SDLK_p:			// Rerender image.		// Toggle petra mode		if(alt && cheat && (Game::get_game_type() != BLACK_GATE))		{			if (gwin->get_main_actor()->get_siflag(Actor::petra))				gwin->get_main_actor()->clear_siflag(Actor::petra);			else				gwin->get_main_actor()->set_siflag(Actor::petra);			gwin->set_all_dirty();			break;		}		gwin->paint();		break;	case SDLK_e:		if(!cheat)			break;		gwin->paint_eggs = !gwin->paint_eggs;		if(gwin->paint_eggs)			gwin->center_text("Eggs display enabled");		else			gwin->center_text("Eggs display disabled");		gwin->paint();		break;	case SDLK_g:		if (alt) {	// toggle god-mode			if (cheat) {				god_mode = 1 - god_mode;				if (god_mode)					gwin->center_text("God Mode Enabled");				else					gwin->center_text("God Mode Disabled");			}		} else {	// Change Avatars gender			if(!cheat)				break;			if (gwin->get_main_actor()->get_type_flag(Actor::tf_sex))				gwin->get_main_actor()->clear_type_flag(Actor::tf_sex);			else				gwin->get_main_actor()->set_type_flag(Actor::tf_sex);			gwin->set_all_dirty();		}		break;	case SDLK_n:		// Toggle Naked flag		if(!cheat || (Game::get_game_type() == BLACK_GATE))			break;		if (gwin->get_main_actor()->get_siflag(Actor::naked))			gwin->get_main_actor()->clear_siflag(Actor::naked);		else			gwin->get_main_actor()->set_siflag(Actor::naked);		gwin->set_all_dirty();		break;	case SDLK_r:		if (ctrl)		// Restore from 'gamedat'.			{			if (gwin->read())				gwin->center_text("Game restored");			gwin->paint();			break;			}		break;	case SDLK_s:		if (ctrl)		// Save to 'gamedat'.			{			if (gwin->write())				gwin->center_text("Game saved");			}		else if (alt)		// Change skin color			{			int color = gwin->get_main_actor()->get_skin_color();			if (color < 0 || color > 2)				break;			color = (color + 4) %3;			gwin->get_main_actor()->set_skin_color(color);			gwin->set_all_dirty();			}		else			{			File_gump_object *fileio = new File_gump_object();			Modal_gump(fileio, Mouse::hand);			delete fileio;			}		break;	case SDLK_t:			// 'Target' mode.		{		if (ctrl&&cheat)		// 'T':  Fake next time change.			{			gwin->fake_next_period();			gwin->center_text("Game clock incremented");			break;			}		int x, y;		if (alt&&cheat)		// Teleport.			{			SDL_GetMouseState(&x, &y);			x = x>>scale;			y = y>>scale;			Tile_coord t(gwin->get_scrolltx() + x/tilesize,				gwin->get_scrollty() + y/tilesize, 0);			gwin->teleport_party(t);			gwin->center_text("Teleport!!!");			break;			}		if (!Get_click(x, y, Mouse::greenselect))			break;		gwin->double_clicked(x, y);		if (gwin->get_mode() == Game_window::gump)			mouse->set_shape(Mouse::hand);		break;		}	case SDLK_w:			// Test weather.		if (ctrl&&cheat)		// Duration is 4*number secs.			{			static int wcnt = 0, wmax = 1;			if (wcnt == 0)				gwin->add_effect(new Clouds_effect(15));			else if (wcnt == 1)				gwin->add_effect(						new Lightning_effect(2));			wcnt = (wcnt + 1)%wmax;			}		break;	case SDLK_x:			// Alt-x means quit.		if (alt)			Okay_to_quit();		break;	case SDLK_RIGHT:		if(!cheat)			break;		for (int i = 16; i; i--)			gwin->view_right();		break;	case SDLK_LEFT:		if(!cheat)			break;		for (int i = 16; i; i--)			gwin->view_left();		break;	case SDLK_DOWN:		if(!cheat)			break;		for (int i = 16; i; i--)			gwin->view_down();		break;	case SDLK_UP:		if(!cheat)			break;		for (int i = 16; i; i--)			gwin->view_up();		break;	case SDLK_HOME:		if(!cheat)			break;		gwin->center_view(gwin->get_main_actor()->get_abs_tile_coord());		gwin->paint();		break;	case SDLK_F4:		gwin->get_win()->toggle_fullscreen();		gwin->paint();		break;	case SDLK_F10:		if(!cheat)			break;		{			Game::get_game()->end_game(shift==0);			gwin->set_palette(0);			gwin->paint();			gwin->fade_palette (50, 1, 0);		}		break;	case SDLK_F11:		if(!cheat && Game::get_game_type() != SERPENT_ISLE)			break;		{			Game::get_game()->set_jive();			Game::get_game()->play_intro();			Game::get_game()->clear_jive();			gwin->set_palette(0);			gwin->paint();			gwin->fade_palette (50, 1, 0);		}		break;	default:		break;	}}