Beispiel #1
0
bool CheckWord(){
	for(int i = 0; i < 5; ++i)
		if(!strcmp(word_may_be_input[i], input_word))
			if (!CheckNumber(i))
				return false;
	return true;
}
int GetTheSmallestPrimeWhichByReplacingPartOfTheNumberWithTheSameDigitIsPartOfAn8PrimeValueFamily()
	{
	bool* primes = new bool[1000000];
	makePrimeTable(1000000, primes);
	
	for(int i = 100001; i < 1000000; i += 2)
		if(primes[i] && CheckNumber(i, primes))
			{
			delete []primes;
			return i;
			}

	delete []primes;
	return -1;
	}
Beispiel #3
0
void FMapInfoParser::ParseMusic(FString &name, int &order)
{
	sc.MustGetString();

	order = 0;
	char *colon = strchr (sc.String, ':');
	if (colon)
	{
		order = atoi(colon+1);
		*colon = 0;
	}
	name = sc.String;
	if (!colon && CheckNumber())
	{
		order = sc.Number;
	}
}
Beispiel #4
0
void MakeNumbers(int start, int kosuu)
{
	int i;

	/* 10桁を超えた数字に開き直り数は存在しない */
	if(kosuu > 10){
		return;
	}

	/* start-9 までの数を新たに生成する */
	for(i=start; i<=9; i++){
		/* 新しい数を末尾に追加する */
		number_using[i]++;
		/* それが開き直り数になるかどうかのチェック */
		CheckNumber();
		/* 追加した数の後ろにさらに1桁追加した場合を調べる */
		MakeNumbers(i, kosuu+1);
		/* 先ほど追加した数を消す */
		number_using[i]--;
	}
}
FName FMapInfoParser::ParseEndGame()
{
	EndSequence newSeq;
	static int generated = 0;

	newSeq.EndType = -1;
	newSeq.PlayTheEnd = false;
	newSeq.MusicLooping = true;
	while (!sc.CheckString("}"))
	{
		sc.MustGetString();
		if (sc.Compare("pic"))
		{
			ParseAssign();
			sc.MustGetString();
			newSeq.EndType = END_Pic;
			newSeq.PicName = sc.String;
		}
		else if (sc.Compare("hscroll"))
		{
			ParseAssign();
			newSeq.EndType = END_Bunny;
			sc.MustGetString();
			newSeq.PicName = sc.String;
			ParseComma();
			sc.MustGetString();
			newSeq.PicName2 = sc.String;
			if (CheckNumber())
				newSeq.PlayTheEnd = !!sc.Number;
		}
		else if (sc.Compare("vscroll"))
		{
			ParseAssign();
			newSeq.EndType = END_Demon;
			sc.MustGetString();
			newSeq.PicName = sc.String;
			ParseComma();
			sc.MustGetString();
			newSeq.PicName2 = sc.String;
		}
		else if (sc.Compare("cast"))
		{
			newSeq.EndType = END_Cast;
			if (newSeq.PicName.IsEmpty()) newSeq.PicName = "$bgcastcall";
		}
		else if (sc.Compare("music"))
		{
			ParseAssign();
			sc.MustGetString();
			newSeq.Music = sc.String;
			if (CheckNumber())
			{
				newSeq.MusicLooping = !!sc.Number;
			}
		}
		else
		{
			if (format_type == FMT_New)
			{
				// Unknown
				sc.ScriptMessage("Unknown property '%s' found in endgame definition\n", sc.String);
				SkipToNext();
			}
			else
			{
				sc.ScriptError("Unknown property '%s' found in endgame definition\n", sc.String);
			}

		}
	}
	FIntermissionDescriptor *desc = new FIntermissionDescriptor;
	FIntermissionAction *action = NULL;

	switch (newSeq.EndType)
	{
	case END_Pic:
		action = new FIntermissionAction;
		break;

	case END_Bunny:
	{
		FIntermissionActionScroller *bunny = new FIntermissionActionScroller;
		bunny->mSecondPic = newSeq.PicName2;
		bunny->mScrollDir = SCROLL_Left;
		bunny->mScrollDelay = 230;
		bunny->mScrollTime = 640;
		bunny->mDuration = 1130;
		action = bunny;
		if (newSeq.PlayTheEnd) desc->mLink = "TheEnd";
		break;
	}

	case END_Demon:
	{
		FIntermissionActionScroller *demon = new FIntermissionActionScroller;
		demon->mSecondPic = newSeq.PicName2;
		demon->mScrollDir = SCROLL_Up;
		demon->mScrollDelay = 70;
		demon->mScrollTime = 600;
		action = demon;
		break;
	}

	case END_Cast:
		action = new FIntermissionAction;
		action->mDuration = 1;
		desc->mLink = "Doom2Cast";
		break;
	}

	if (action == NULL)
	{
		sc.ScriptError("Endgame type was not defined");
		return NAME_None;	// We won't really get here.
	}
	else
	{
		action->mBackground = newSeq.PicName;
		action->mMusic = newSeq.Music;
		action->mMusicLooping = newSeq.MusicLooping;
		desc->mActions.Push(action);

		FString seq;
		seq.Format("@EndSequence_%d_", generated++);
		ReplaceIntermission(seq, desc);
		return FName(seq);
	}
}
Beispiel #6
0
void FMapInfoParser::ParseNextMap(char *mapname)
{
	EndSequence newSeq;
	bool useseq = false;

	if (sc.CheckNumber())
	{
		if (HexenHack)
		{
			mysnprintf (mapname, 9, "&wt@%02d", sc.Number);
		}
		else
		{
			mysnprintf (mapname, 9, "MAP%02d", sc.Number);
		}
	}
	else
	{

		sc.MustGetString();
		if (sc.Compare("endgame"))
		{
			if (!sc.CheckString("{"))
			{
				// Make Demon Eclipse work again
				sc.UnGet();
				goto standard_endgame;
			}
			newSeq.Advanced = true;
			newSeq.EndType = END_Pic1;
			newSeq.PlayTheEnd = false;
			newSeq.MusicLooping = true;
			while (!sc.CheckString("}"))
			{
				sc.MustGetString();
				if (sc.Compare("pic"))
				{
					ParseAssign();
					sc.MustGetString();
					newSeq.EndType = END_Pic;
					newSeq.PicName = sc.String;
				}
				else if (sc.Compare("hscroll"))
				{
					ParseAssign();
					newSeq.EndType = END_Bunny;
					sc.MustGetString();
					newSeq.PicName = sc.String;
					ParseComma();
					sc.MustGetString();
					newSeq.PicName2 = sc.String;
					if (CheckNumber())
						newSeq.PlayTheEnd = !!sc.Number;
				}
				else if (sc.Compare("vscroll"))
				{
					ParseAssign();
					newSeq.EndType = END_Demon;
					sc.MustGetString();
					newSeq.PicName = sc.String;
					ParseComma();
					sc.MustGetString();
					newSeq.PicName2 = sc.String;
				}
				else if (sc.Compare("cast"))
				{
					newSeq.EndType = END_Cast;
				}
				else if (sc.Compare("music"))
				{
					ParseAssign();
					sc.MustGetString();
					newSeq.Music = sc.String;
					if (CheckNumber())
					{
						newSeq.MusicLooping = !!sc.Number;
					}
				}
				else
				{
					if (format_type == FMT_New)
					{
						// Unknown
						sc.ScriptMessage("Unknown property '%s' found in endgame definition\n", sc.String);
						SkipToNext();
					}
					else
					{
						sc.ScriptError("Unknown property '%s' found in endgame definition\n", sc.String);
					}

				}
			}
			useseq = true;
		}
		else if (strnicmp (sc.String, "EndGame", 7) == 0)
		{
			// If we're in a multiplayer game, don't do the finale, just go back to the
			// beginning.
			if ( NETWORK_GetState( ) == NETSTATE_SERVER )
			{
				switch (sc.String[7])
				{
				case '1':	sprintf (sc.String, "E1M1");	break;
				case '2':	sprintf (sc.String, "E2M1");	break;
				case '3':	sprintf (sc.String, "E3M1");	break;
				case '4':	sprintf (sc.String, "E4M1");	break;
				case 'C':	sprintf (sc.String, "MAP01");	break;
//				case 'W':	type = END_Underwater;	break;
//				case 'S':	type = END_Strife;		break;
				default:	sprintf (sc.String, "MAP01");	break;
				}

				strncpy (mapname, sc.String, 8);
			}
			else
			{
				int type;
				switch (sc.String[7])
				{
				case '1':	type = END_Pic1;		break;
				case '2':	type = END_Pic2;		break;
				case '3':	type = END_Bunny;		break;
				case 'C':	type = END_Cast;		break;
				case 'W':	type = END_Underwater;	break;
				case 'S':	type = END_Strife;		break;
		standard_endgame:
				default:	type = END_Pic3;		break;
				}
				newSeq.EndType = type;
				useseq = true;
			}
		}
		else if (sc.Compare("endpic"))
		{
			ParseComma();
			sc.MustGetString ();
			newSeq.EndType = END_Pic;
			newSeq.PicName = sc.String;
			useseq = true;
		}
		else if (sc.Compare("endbunny"))
		{
			newSeq.EndType = END_Bunny;
			useseq = true;
		}
		else if (sc.Compare("endcast"))
		{
			newSeq.EndType = END_Cast;
			useseq = true;
		}
		else if (sc.Compare("enddemon"))
		{
			newSeq.EndType = END_Demon;
			useseq = true;
		}
		else if (sc.Compare("endchess"))
		{
			newSeq.EndType = END_Chess;
			useseq = true;
		}
		else if (sc.Compare("endunderwater"))
		{
			newSeq.EndType = END_Underwater;
			useseq = true;
		}
		else if (sc.Compare("endbuystrife"))
		{
			newSeq.EndType = END_BuyStrife;
			useseq = true;
		}
		else if (sc.Compare("endtitle"))
		{
			newSeq.EndType = END_TitleScreen;
			useseq = true;
		}
		else
		{
			strncpy (mapname, sc.String, 8);
		}
		if (useseq)
		{
			int seqnum = -1;

			if (!newSeq.Advanced)
			{
				seqnum = FindEndSequence (newSeq.EndType, newSeq.PicName);
			}

			if (seqnum == -1)
			{
				seqnum = (int)EndSequences.Push (newSeq);
			}
			strcpy (mapname, "enDSeQ");
			*((WORD *)(mapname + 6)) = (WORD)seqnum;
		}
	}
}