static int inventory_page = -1;
static int inventory_page = -1, stats_page = -1;
static void Handle_keystroke	(	SDLKey sym,	int shift,        int alt,	int ctrl	)	{	static int current_shape = 0, current_frame = 0, current_file = 0;	Vga_file *vga_file;		static int inventory_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:		gwin->brighten(20);		break;	case SDLK_MINUS:		// Darken.	case SDLK_KP_MINUS:		gwin->brighten(-20);		break;	case SDLK_b:		Breakpoint();		break;	case SDLK_i:		// Show Inventory		if (gwin->get_mode() != Game_window::gump)			inventory_page = -1;		if(inventory_page<gwin->get_usecode()->get_party_count()) {			++inventory_page;			int npc_num = 0; // Default to Avatar			if(inventory_page>0)				npc_num = gwin->get_usecode()->					get_party_member(inventory_page-1);			Actor *actor = gwin->get_npc(npc_num);			actor->activate(gwin->get_usecode());			if (gwin->get_mode() == Game_window::gump)				mouse->set_shape(Mouse::hand);		}		break;	case SDLK_c:		gwin->toggle_combat();	// Go into combat mode		gwin->paint();		break;	case SDLK_h:		{		char buf[512];		sprintf(buf, "EXULT - Keyboard commands\n\n"			"Arrow keys - scroll map\n"			"Plus-Minus - Increment-decrement brightness\n"			"e - Toggle eggs visibility\n"			"PgUp/PgDn - Show next-previous shape file\n"			"sS - Show next-previous shape\n"			"fF - Show next-previous frame\n"			"i - Show inventory\n"			"l - Decrement lift\n"			"m - Change mouse shape\n"			"p - Repaint screen\n"			"q - Exit\n"			"ctrl-t - Fake time period change\n"		);					gwin->paint_text_box(2, buf, 			15, 15, 300, 400);		break;		}	case SDLK_q:		quitting_time = 1;		break;	case SDLK_ESCAPE:		// ESC key.		inventory_page = -1;		if (gwin->get_mode() == Game_window::gump)			gwin->end_gump_mode();		else			// For now, quit.			if (Yesno_gump_object::ask(					"Do you really want to quit?"))				quitting_time = 1;		break;	case SDLK_m:			// Show next mouse cursor.		{#ifdef MOUSE		static int mcur = 0;		mouse->set_shape(++mcur);		gwin->set_painted();#if DEBUG		cout << "Mouse cursor:  " << mcur << endl;#endif#endif		break;		}	case SDLK_l:			// Decrement skip_lift.		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.		gwin->paint();		break;	case SDLK_e:		gwin->paint_eggs = 1-gwin->paint_eggs;		gwin->paint();		break;	case SDLK_f:		// Show next frame		vga_file = gwin->get_shape_file_data(current_file);		if (!shift) {			current_frame += stepping;			if(current_frame>=vga_file->get_num_frames(current_shape))				current_frame = 0;		} else {			current_frame -= stepping;			if(current_frame<0)				current_frame = vga_file->get_num_frames(current_shape);		}		shape_showcase(current_file, current_shape, current_frame);		break;	case SDLK_r:		if (ctrl)		// Restore from 'gamedat'.			{			if (gwin->read())				cout << "Restore from 'gamedat' successful"<<endl;			gwin->paint();			break;			}		break;	case SDLK_s:		if (ctrl)		// Save to 'gamedat'.			{			if (gwin->write())				cout << "Save to 'gamedat' successful"<<endl;			break;			}					// Show next shape.		current_frame = 0;		vga_file = gwin->get_shape_file_data(current_file);		if (!shift) {			current_shape += alt ? 20 : 1;			if(current_shape>=vga_file->get_num_shapes())				current_shape = 0;		} else {			current_shape -= alt ? 20 : 1;			if(current_shape<0)				current_shape = vga_file->get_num_shapes()-1;		}		shape_showcase(current_file, current_shape, current_frame);		break;	case SDLK_t:			// 'Target' mode.		{		if (ctrl)		// 'T':  Fake next time change.			{			gwin->fake_next_period();			break;			}		int x, y;		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)		// 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 && Yesno_gump_object::ask(						"Do you really want to quit?"))			quitting_time = 1;		break;	case SDLK_PAGEUP:		current_shape=0;		current_frame=0;		--current_file;		if(current_file<0)			current_file = gwin->get_shape_file_count()-1;		shape_showcase(current_file, current_shape, current_frame);		break;	case SDLK_PAGEDOWN:		current_shape=0;		current_frame=0;		++current_file;		if(current_file==gwin->get_shape_file_count())			current_file = 0;		shape_showcase(current_file, current_shape, current_frame);		break;	case SDLK_RIGHT:		for (int i = 16; i; i--)			gwin->view_right();		break;	case SDLK_LEFT:		for (int i = 16; i; i--)			gwin->view_left();		break;	case SDLK_DOWN:		for (int i = 16; i; i--)			gwin->view_down();		break;	case SDLK_UP:		for (int i = 16; i; i--)			gwin->view_up();		break;	case SDLK_F4:		gwin->get_win()->toggle_fullscreen();		gwin->paint();		break;	case SDLK_F10:		gwin->end_game();		break;	default:		break;	}}