Esempio n. 1
0
void ReturnTitile(BOOL bForce)
{
	ESC_InitEOprFlag();
	ESC_InitFlag();
	InitRestartData();
	if(cgmodeWnd && scene_play_mode==cgmodeWnd->GetMode() && FALSE==bForce){
		changeExecMode(scene_play_mode);
	}else{
		my_delete(cgmodeWnd);
		my_delete(titleWnd);
		titleWnd = new TitleWnd;
	}
}
Esempio n. 2
0
BOOL SAV_Load( int load_no )
{
	char		fname[256];
	DWORD		rsize;
	int			i;
	char		*msgBuf;
	MySaveHead	saveHead;

	if(load_no>=0) { wsprintf( fname, "save_%02d.sav", load_no ); }
	else		   { wsprintf( fname, "save___.sav" );			  }
	exec_mode tmp_back_mode = sysInf.execMode;
	InitRestartData();
	if(sysInf.execMode!=tmp_back_mode)changeExecMode(tmp_back_mode);
	if(load_no!=98){
		HANDLE hFile = CreateFile(fname, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0L ,NULL);
		if(INVALID_HANDLE_VALUE==hFile){
			return FALSE;
		}
		ReadFile(hFile,saveWnd->saveBmp.pBuf,thumbnailW*thumbnailH*3,&rsize,NULL);
		ReadFile(hFile,&saveHead,sizeof(MySaveHead),&rsize,NULL);

		if(saveHead.ver!=MAKEWORD(SaveVerMajor,SaveVerMinor) || 0!=strnicmp(saveHead.head,"LSAV",4)){
			MessageBox(sysInf.hWnd,"セーブデータ形式が異常です。このセーブデータは使用できません","データエラー",MB_OK|MB_ICONWARNING);
			return FALSE;
		}
		ReadFile(hFile,&SaveStruct, sizeof(SaveStruct), &rsize,NULL);
		ReadFile(hFile,&saveInf,sizeof(SaveInfo),&rsize,NULL);
		ReadFile(hFile,setBmpInf,sizeof(SetBmpInf)*STBMP_MAX,&rsize,NULL);
		ReadFile(hFile,&backSelectStruct, sizeof(SaveStruct), &rsize,NULL);
		ReadFile(hFile,&backSelectInf,sizeof(BackSelectInf),&rsize,NULL);
		CloseHandle(hFile);
	}else{
		CopyMemory(&SaveStruct,&backSelectStruct,sizeof(SaveStruct));
		CopyMemory(&saveInf,&backSelectInf.saveInf,sizeof(SaveInfo));
		CopyMemory(&setBmpInf,&bak_setBmpInf,sizeof(SetBmpInf)*STBMP_MAX);
	}
	SAV_LoadScript();
	memcpy( ESC_FlagBuf, SaveStruct.ESC_FlagBuf, sizeof(int)*ESC_FLAG_MAX ); 
	toneConvert.ChangeTable( saveInf.tone_type[0], saveInf.tone_type[1], saveInf.tone_backOnly);
	SHORT	tmp_shakeSize = saveInf.shakeSize;
	g_disp(saveInf.bak_no, _BAK_DIRECT, saveInf.cg_type, 0, saveInf.btRect.left, saveInf.btRect.top);
	saveInf.shakeSize = tmp_shakeSize; 
	if(saveInf.shakeSize){
		backColorBuf.RollBlt(&bgInf.colorBuf, saveInf.shakeSize*180.0f);
		bgInf.colorBuf.BltFast(0,0,&backColorBuf,NULL,FALSE);
	}
	for(i=0;i<STCHAR_MAX;i++){
		if(saveInf.charSave[i].char_no){
			c_disp(saveInf.charSave[i].char_no-1, saveInf.charSave[i].pose, saveInf.charSave[i].locate, _CHR_DIRECT, saveInf.charSave[i].layer,saveInf.charSave[i].alpha,0,saveInf.charSave[i].bright);
		}
	}
	for(i=0;i<STBMP_MAX;i++){
		setBmpInf[i].Reload();
	}
	if(saveInf.selectNum){
		for(i=0;i<saveInf.selectNum;i++){
			selectWnd.addSelect(&backSelectInf.selectMsg[i*60]);
		}
		sysInf.bMsgAtOnce = on;
		msgWnd.DisplayMessage((BYTE *)backSelectInf.msgBuf);
		backLog.SetBackLog(backSelectInf.msgBuf,backSelectInf.msgLine);
		sysInf.bMsgCLS = on;
	}
	if(saveInf.musicNum>=0){
		lpSoundDS->ChangeMusic(bgmHandle, saveInf.musicNum,TRUE,0, 30,saveInf.musicVol);
	}else{
		lpSoundDS->FadeOut( bgmHandle );
	}
	for(i=0;i<hEvtSndMax;i++){
		if(saveInf.loopSeNum[i]==0)continue;
		CreateEffect(evtHandle[i],saveInf.loopSeNum[i]-1);
		PlayEffect(evtHandle[i],saveInf.loopSeVol[i],TRUE);
	}
	if(backSelectInf.saveInf.selectNum){
		EnableMenuItem( sysInf.hMenu, ID_BACKSELECT, MF_ENABLED );
	}else{
		EnableMenuItem( sysInf.hMenu, ID_BACKSELECT, MF_GRAYED );
	}
	sysInf.FontSize = mainFontSize;	
	lpSoundDS->voiceCnt = saveInf.voiceCnt;
	lpSoundDS->scriptNo = saveInf.voiceScriptNo;
	BOOL bPlayVoice = FALSE;
	if(saveInf.RestartVoice[0]>0){
		char	voicefile[32];
		saveInf.RestartVoice[0] --;
		int charNo = checkPlayVoice(saveInf.RestartVoice[0]);
		if(charNo >= 0){
			wsprintf(voicefile,"%05d_%03d_%03d",saveInf.RestartVoice[2], saveInf.RestartVoice[1], charNo);
			if(!keyState.data_skip && !sysInf.bReadSkip){
				bPlayVoice = TRUE;
			}
		}else{
			wsprintf(voicefile,"%05d_%03d_%03d",saveInf.RestartVoice[2], saveInf.RestartVoice[1], saveInf.RestartVoice[0]);
		}
		backLog.SetVoice(voicefile);
		saveInf.RestartVoice[0] = 0;

		if(saveWnd){
			strcpy(saveWnd->voicefile,voicefile);
		}
	}
	if(FALSE==bPlayVoice){
		if(saveWnd)saveWnd->voicefile[0] = '\0';
	}
	return TRUE;
} // SAV_Load