rem: int frame = --pInputState->anim_frame_count;
add: int frame;  pInputState->anim_frame_count -= 3; if (pInputState->anim_frame_count < 0) { pInputState->anim_frame_count = 0; } frame = pInputState->anim_frame_count;
context: DoSetupMenu (PSETUP_MENU_STATE pInputState){	if (!pInputState->initialized) 	{		SetDefaultMenuRepeatDelay ();		pInputState->anim_frame_count = NUM_STEPS;		pInputState->initialized = TRUE;		pInputState->NextTime = GetTimeCounter ();		pInputState->category = 0;		pInputState->option = 0;		SetDefaults ();	}		BatchGraphics ();	if (pInputState->anim_frame_count)	{		RECT r;		COLOR bg, dark, medium;		int frame = --pInputState->anim_frame_count;				r.corner.x = ((frame * X_STEP) >> 1) + 2;		r.corner.y = ((frame * Y_STEP) >> 1) + 2;		r.extent.width = X_STEP * (NUM_STEPS - frame) - 4;		r.extent.height = Y_STEP * (NUM_STEPS - frame) - 4;		dark = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x08), 0x01);		medium = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x10), 0x01);		bg = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x1A), 0x09);		DrawShadowedBox (&r, bg, dark, medium);	}	else	{		int opt, cat;		MENU_CATEGORY *menu = cmdline_opts;		DrawMenu (pInputState);		cat = pInputState->category;		opt = pInputState->option;		if (PulsedInputState.key[KEY_MENU_UP])		{			opt -= 3;			if (opt < 0)			{				cat--;				if (cat < 0)				{					cat = NUM_OPTS-1;				}				/* Preserve column if possible */				opt = (menu[cat].numopts - (menu[cat].numopts % 3)) + ((opt + 3) % 3);				if (opt >= menu[cat].numopts)				{					opt = menu[cat].numopts - 1;				}			}		}		else if (PulsedInputState.key[KEY_MENU_DOWN])		{			opt += 3;			if ((opt - (opt % 3)) >= menu[cat].numopts)			{				cat++;				if (cat >= NUM_OPTS)				{					cat = 0;				}				/* Preserve column if possible */				opt = opt % 3;				if (opt >= menu[cat].numopts)				{					opt = menu[cat].numopts - 1;				}			}			else if (opt >= menu[cat].numopts)			{				opt = menu[cat].numopts - 1;			}		}		else if (PulsedInputState.key[KEY_MENU_LEFT])		{			opt--;			if (opt < 0)			{				cat--;				if (cat < 0)				{					cat = NUM_OPTS-1;				}				opt = menu[cat].numopts - 1;			}			}		else if (PulsedInputState.key[KEY_MENU_RIGHT])		{			opt++;			if (opt >= menu[cat].numopts)			{				cat++;				if (cat >= NUM_OPTS)				{					cat = 0;				}				opt = 0;			}			}		pInputState->category = cat;		pInputState->option = opt;		if (PulsedInputState.key[KEY_MENU_SELECT])		{			cmdline_opts[cat].selected = opt;		}	}	UnbatchGraphics ();	SleepThreadUntil (pInputState->NextTime + MENU_FRAME_RATE);	pInputState->NextTime = GetTimeCounter ();	return !((GLOBAL (CurrentActivity) & CHECK_ABORT) || 		 PulsedInputState.key[KEY_MENU_CANCEL]);}