if (scale)
if (gwin->get_win()->is_palettized())
static void Handle_events	(	unsigned char *stop	)	{	uint32 last_repaint = 0;	// For insuring animation repaints.	uint32 last_rotate = 0;	/*	 *	Main event loop.	 */	while (!*stop)		{#ifdef XWIN		Server_delay();		// Handle requests.#else		Delay();		// Wait a fraction of a second.#endif		Mouse::mouse->hide();		// Turn off mouse.		Mouse::mouse_update = false;		SDL_Event event;		while (!*stop && SDL_PollEvent(&event))			Handle_event(event);					// Get current time.		uint32 ticks = SDL_GetTicks();					// Animate unless dormant.		if (gwin->have_focus() && !dragging)			gwin->get_tqueue()->activate(ticks);					// Show animation every 1/20 sec.		if (ticks > last_repaint + 50 || gwin->was_painted())					// This avoids jumpy walking:			{			gwin->paint_dirty();			last_repaint = ticks;			int x, y;// Check for 'stuck' Avatar.			if (!gwin->is_moving() &&			    !gwin->was_teleported())				{				int ms = SDL_GetMouseState(&x, &y);				if ((SDL_BUTTON(3) & ms) &&						(Game::get_game_type() == SERPENT_ISLE ||						gwin->get_usecode()->get_global_flag(							Usecode_machine::did_first_scene)))					gwin->start_actor(x >> scale, 							  y >> scale, 							  avatar_speed);				}			}		if (show_mouse)			Mouse::mouse->show();	// Re-display mouse.					// Rotate less often if scaling.		if (ticks > last_rotate + (100<<scale))			{		// (Blits in simulated 8-bit mode.)			gwin->get_win()->rotate_colors(0xf0, 4, 0);			gwin->get_win()->rotate_colors(0xe8, 8, 0);			gwin->get_win()->rotate_colors(0xe0, 8, 1);			last_rotate = ticks;			if (scale)	// Scaled requires explicit blit.				gwin->set_painted();			}		if (!gwin->show() &&	// Blit to screen if necessary.		    Mouse::mouse_update)	// If not, did mouse change?			Mouse::mouse->blit_dirty();		}	}