Ejemplo n.º 1
0
Archivo: np2.c Proyecto: utamaro/np2.js
static int flagload(const char *ext, const char *title, BOOL force) {

	int		ret;
	int		id;
	char	path[MAX_PATH];
	char	buf[1024];
	char	buf2[1024 + 256];

	getstatfilename(path, ext, sizeof(path));
	id = DID_YES;
	ret = statsave_check(path, buf, sizeof(buf));
#ifndef EMSCRIPTEN
	if (ret & (~STATFLAG_DISKCHG)) {
		menumbox("Couldn't restart", title, MBOX_OK | MBOX_ICONSTOP);
		id = DID_NO;
	}
	else if ((!force) && (ret & STATFLAG_DISKCHG)) {
		SPRINTF(buf2, "Conflict!\n\n%s\nContinue?", buf);
		id = menumbox(buf2, title, MBOX_YESNOCAN | MBOX_ICONQUESTION);
	}
#endif
	if (id == DID_YES) {
		statsave_load(path);
	}
	return(id);
}
Ejemplo n.º 2
0
static int flagload(const OEMCHAR *ext, const OEMCHAR *title, BOOL force) {

	int		ret;
	int		id;
	OEMCHAR	path[MAX_PATH];
	OEMCHAR	buf[1024];
	OEMCHAR	buf2[1024 + 256];

	getstatfilename(path, ext, NELEMENTS(path));
	id = DID_YES;
	ret = statsave_check(path, buf, NELEMENTS(buf));
	if (ret & (~STATFLAG_DISKCHG)) {
		menumbox(OEMTEXT("Couldn't restart"), title, MBOX_OK | MBOX_ICONSTOP);
		id = DID_NO;
	}
	else if ((!force) && (ret & STATFLAG_DISKCHG)) {
		OEMSPRINTF(buf2, OEMTEXT("Conflict!\n\n%s\nContinue?"), buf);
		id = menumbox(buf2, title, MBOX_YESNOCAN | MBOX_ICONQUESTION);
	}
	if (id == DID_YES) {
		statsave_load(path);
	}
	return(id);
}
Ejemplo n.º 3
0
static void sys_cmd(MENUID id) {

	int		val;
	BOOL	r;

	switch(id) {
#ifdef SUPPORT_FULLSCREEN
		case MID_SCREEN:
			scrnmng_fullscreen(!gamecore.gamecfg.fullscreen);
			break;
#endif

		case MID_CONFIG:
			cfgdlg_open();
			break;

		case MID_SKIP:
			val = !menusys_getcheck(MID_SKIP);
			gamecfg_setskip(val);
			break;

		case MID_READSKIP:
			val = !menusys_getcheck(MID_READSKIP);
			gamecfg_setreadskip(val);
			break;

		case MID_AUTO:
			gamecore.gamecfg.autoclick = !gamecore.gamecfg.autoclick;
			break;

		case MID_LOAD:
			r = scr_scriptcall("LOADSYS");
			if (r == SUCCESS) {
				gamecore.event = GAMEEV_SUCCESS;		// 要調整
			}
			else {
				dlgsave_load();
			}
			break;

		case MID_SAVE:
			r = scr_scriptcall("SAVESYS");
			if (r == SUCCESS) {
				gamecore.event = GAMEEV_SUCCESS;		// 要調整
			}
			else {
				dlgsave_save();
			}
			break;

		case MID_TITLE:
			if (menumbox((char *)str_titler, gamecore.suf.key,
								MBOX_YESNO | MBOX_ICONQUESTION) == DID_YES) {
				if (scr_restart("TITLE") != SUCCESS) {
					scr_restart("MAIN");			// プライベートナース
				}
			}
			break;

		case MID_EXIT:
			TRACEOUT(("title: %s", gamecore.suf.key));
			if (menumbox((char *)str_exitr, gamecore.suf.key,
								MBOX_YESNO | MBOX_ICONQUESTION) == DID_YES) {
				taskmng_exit();
			}
			break;

#if defined(MENU_TASKMINIMIZE)
		case SID_MINIMIZE:
			taskmng_minimize();
			break;
#endif

		case SID_CLOSE:
			taskmng_exit();
			break;
	}
}
Ejemplo n.º 4
0
BOOL gamecore_proc(void) {

	int		event;

#ifndef DISABLE_DIALOG
	if (gamecore.gamecfg.enablepopup) {
		int x, y;
		UINT btn;
		UINT key;
		BOOL r;
		btn = inputmng_getmouse(&x, &y);
		key = inputmng_getkey();
		if (btn & RBUTTON_DOWNBIT) {
			r = sysmenu_menuopen(TRUE, x, y);
		}
		else if (key & KEY_MENU) {
			r = sysmenu_menuopen(TRUE, 0, 0);
		}
		else {
			r = FAILURE;
		}
		if (r == SUCCESS) {
			inputmng_resetmouse(0);
			inputmng_resetkey(0);
			menubase_modalproc();
			event = gamecore.event;
			if ((event >= GAMEEV_SUCCESS) && (event < GAMEEV_FADEIN)) {
				vramdraw_setrect(mainvram, NULL);
				vramdraw_draw();
			}
		}
	}
	if (menuvram != NULL) {
		menubase_proc();
	}
#endif

	event = gamecore.event;
	if ((event >= GAMEEV_SUCCESS) && (event < GAMEEV_FADEIN)) {
		anime_exec();
	}
	switch(event) {
		case GAMEEV_SUCCESS:
			event = script_dispatch();
			break;

		case GAMEEV_TEXTOUT:
			event = textdisp_exec();
			break;

		case GAMEEV_WAITMOUSE:
			event = event_mouse();
			break;

		case GAMEEV_CMDWIN:
			event = event_cmdwin();
			break;

		case GAMEEV_WAITPCMEND:
			event = event_waitpcmend();
			break;

		case GAMEEV_MSGCLK:
			event = event_msgclk();
			break;

		case GAMEEV_IRCLK:
			event = event_irclk();
			break;

		case GAMEEV_WAIT:
			event = event_wait();
			break;

		case GAMEEV_FADEIN:
			event = effect_fadeinexec();
			break;

		case GAMEEV_FADEOUT:
			event = effect_fadeoutexec();
			break;

		case GAMEEV_EFFECT:
			event = effect_exec();
			break;

		case GAMEEV_GRAYSCALE:
			event = effect_grayscale();
			break;

		case GAMEEV_SCROLL:
			event = effect_scroll();
			break;

		case GAMEEV_QUAKE:
			event = effect_quake();
			break;

		case GAMEEV_FORCE:
			event = GAMEEV_SUCCESS;
			break;

		case GAMEEV_EXIT:
			return(FAILURE);
	}

	gamecore.event = event;
	if (event < 0) {
		const char *e;
		e = gamecore_seterrorevent(event);
#ifndef DISABLE_DIALOG
		if (e) {
			menumbox(e, gamecore.suf.key, MBOX_ICONSTOP | MBOX_OK);
			return(FAILURE);
		}
#endif
		TRACEOUT(("error: %d", event));
		TRACEOUT(("system terminate."));
	}
	return(SUCCESS);
}