예제 #1
0
bool Disasm::ParsePJL() {
	if (!Expect("\033%-12345X") || !SkipTo(") HP-PCL XL;")) return false;
	// version";"minor";" ... \n
	int32 version, minor;
	if (ReadNumber(version) && Expect(";") && ReadNumber(minor) && Expect(";") && SkipTo("\n")) {
		printf("PCL XL %d ; %d\n", (int)version, (int)minor);
		return true;
	}
	return false;	
}
예제 #2
0
bool Game_Interpreter_Map::ContinuationEnemyEncounter(RPG::EventCommand const& com) {
	continuation = NULL;

	switch (Game_Temp::battle_result) {
	case Game_Temp::BattleVictory:
		if ((Game_Temp::battle_defeat_mode == 0 && Game_Temp::battle_escape_mode != 2) || !SkipTo(Cmd::VictoryHandler, Cmd::EndBattle)) {
			index++;
			return false;
		}
		index++;
		return true;
	case Game_Temp::BattleEscape:
		switch (Game_Temp::battle_escape_mode) {
		case 0:	// disallowed - shouldn't happen
			return true;
		case 1:
			return CommandEndEventProcessing(com);
		case 2:
			if (!SkipTo(Cmd::EscapeHandler, Cmd::EndBattle)) {
				index++;
				return false;
			}
			index++;
			return true;
		default:
			return false;
		}
	case Game_Temp::BattleDefeat:
		switch (Game_Temp::battle_defeat_mode) {
		case 0:
			return CommandGameOver(com);
		case 1:
			if (!SkipTo(Cmd::DefeatHandler, Cmd::EndBattle)) {
				index++;
				return false;
			}
			index++;
			return true;
		default:
			return false;
		}
	case Game_Temp::BattleAbort:
		if (!SkipTo(Cmd::EndBattle)) {
			index++;
			return false;
		}
		index++;
		return true;
	default:
		return false;
	}
}
예제 #3
0
bool Game_Interpreter_Map::ContinuationShowInnStart(RPG::EventCommand const& /* com */) {
	if (Game_Message::visible) {
		return false;
	}
	continuation = NULL;

	bool inn_stay = Game_Message::choice_result == 0;

	Game_Temp::inn_calling = false;

	if (inn_stay) {
		Main_Data::game_party->GainGold(-Game_Temp::inn_price);

		// Full heal
		std::vector<Game_Actor*> actors = Main_Data::game_party->GetActors();
		for (Game_Actor* actor : actors) {
			actor->RemoveAllStates();
			actor->ChangeHp(actor->GetMaxHp());
			actor->SetSp(actor->GetMaxSp());
		}
		Graphics::GetTransition().Init(Transition::TransitionFadeOut, Scene::instance.get(), 36, true);
		Game_System::BgmFade(800);
		SetContinuation(static_cast<ContinuationFunction>(&Game_Interpreter_Map::ContinuationShowInnContinue));
		return false;
	}

	if (Game_Temp::inn_handlers)
		SkipTo(Cmd::NoStay, Cmd::EndInn);
	index++;
	return true;
}
예제 #4
0
파일: fgeXML.cpp 프로젝트: dengchao000/fge
	//元素结束 />    
	const char* CXML::parseEndEmptyElment(const char* xml)
	{
		if(m_pcr)
			m_pcr = m_pcr->parentElement;
		else
			throw XMLException("元素不匹配.");
		return SkipTo(xml,"/>");
	}
예제 #5
0
파일: fgeXML.cpp 프로젝트: dengchao000/fge
	//解析右括号 >
	const char* CXML::parseRf(const char* xml)
	{
		//if(m_pcr)
		//    m_pcr = m_pcr->parentElement;
		//else
		//    throw XMLException(" > 不匹配.");

		return SkipTo(xml,">");
	}
예제 #6
0
FX_BOOL CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType,
                                           const FX_WCHAR*& pStart,
                                           int32_t& iLength) {
  while (m_pCur < m_pEnd && (*m_pCur <= ' ' || *m_pCur == m_Separator)) {
    ++m_pCur;
  }
  if (m_pCur >= m_pEnd) {
    return FALSE;
  }
  eType = FDE_CSSPRIMITIVETYPE_Unknown;
  pStart = m_pCur;
  iLength = 0;
  FX_WCHAR wch = *m_pCur;
  if (wch == '#') {
    iLength = SkipTo(' ');
    if (iLength == 4 || iLength == 7) {
      eType = FDE_CSSPRIMITIVETYPE_RGB;
    }
  } else if ((wch >= '0' && wch <= '9') || wch == '.' || wch == '-' ||
             wch == '+') {
    while (m_pCur < m_pEnd && (*m_pCur > ' ' && *m_pCur != m_Separator)) {
      ++m_pCur;
    }
    iLength = m_pCur - pStart;
    if (iLength > 0) {
      eType = FDE_CSSPRIMITIVETYPE_Number;
    }
  } else if (wch == '\"' || wch == '\'') {
    pStart++;
    iLength = SkipTo(wch) - 1;
    m_pCur++;
    eType = FDE_CSSPRIMITIVETYPE_String;
  } else if (m_pEnd - m_pCur > 5 && m_pCur[3] == '(') {
    if (FX_wcsnicmp(L"url", m_pCur, 3) == 0) {
      wch = m_pCur[4];
      if (wch == '\"' || wch == '\'') {
        pStart += 5;
        iLength = SkipTo(wch) - 6;
        m_pCur += 2;
      } else {
        pStart += 4;
        iLength = SkipTo(')') - 4;
        m_pCur++;
      }
      eType = FDE_CSSPRIMITIVETYPE_URI;
    } else if (FX_wcsnicmp(L"rgb", m_pCur, 3) == 0) {
      iLength = SkipTo(')') + 1;
      m_pCur++;
      eType = FDE_CSSPRIMITIVETYPE_RGB;
    }
  } else {
    iLength = SkipTo(m_Separator, TRUE, TRUE);
    eType = FDE_CSSPRIMITIVETYPE_String;
  }
  return m_pCur <= m_pEnd && iLength > 0;
}
예제 #7
0
파일: fgeXML.cpp 프로젝트: dengchao000/fge
	//元素结束  <![CDATA[ 
	const char* CXML::parseCDataBegin(const char* xml)
	{
		xml = SkipTo(xml,"<![CDATA[");
		//读值
		const char* xmlNext = Find(xml,"]]>");
		if(!xmlNext)
			throw XMLException("CDATA未正确关闭");
		Element* pElement = new DataElement;		
		if(xmlNext > xml)
		{
			size_t n = xmlNext-xml;
			pElement->value.append(xml,n);
		}
		m_pcr->AddSubElement(pElement);
		return SkipBlank(xmlNext+3);
	}
예제 #8
0
bool Game_Interpreter::ContinuationChoices(RPG::EventCommand const& com) {
	int indent = com.indent;
	for (;;) {
		if (!SkipTo(Cmd::ShowChoiceOption, Cmd::ShowChoiceEnd, indent, indent))
			return false;
		int which = list[index].parameters[0];
		index++;
		if (which > Game_Message::choice_result)
			return false;
		if (which < Game_Message::choice_result)
			continue;
		break;
	}

	return true;
}
예제 #9
0
파일: fgeXML.cpp 프로젝트: dengchao000/fge
	//?
	const char* CXML::parseDeclaration(const char* xml)
	{
		//char szBuf[80];
		//ReadWord(xml,szBuf,80);
		xml+=2;//xml = SkipTo(xml,"<?");
		char szBuf[80];
		TAG *tag = 0;
		xml = ReadWord(xml,szBuf,80,&tag);
		if(!strcmp(szBuf,"xml"))
		{
			xml = readAttrib(m_head,xml);
			if(!StrCmp(xml,"?>"))
				throw XMLException("?>标签未正确关闭");
		}
		return SkipTo(xml,"?>");
	}
예제 #10
0
bool Game_Interpreter_Map::ContinuationOpenShop(RPG::EventCommand const& /* com */) {
	continuation = nullptr;
	if (!Game_Temp::shop_handlers) {
		index++;
		return true;
	}

	if (!SkipTo(Game_Temp::shop_transaction
				? Cmd::Transaction
				: Cmd::NoTransaction,
				Cmd::EndShop)) {
		return false;
	}

	index++;
	return true;
}
예제 #11
0
파일: fgeXML.cpp 프로젝트: dengchao000/fge
	//!--
	const char* CXML::parseComment(const char* xml)
	{       
		////读值
		//xml = SkipTo(xml,"<!--");
		//const char* xmlNext = Find(xml,"-->");
		//if(!xmlNext)
		//	throw XMLException("注释未正确关闭");
		//Element* pElement = new CommentElement;
		//pElement->parentElement = m_pcr;
		//if(xmlNext > xml)
		//{
		//	size_t n = xmlNext-xml;
		//	pElement->value.append(xml,n);
		//}
		//m_pcr->subElement.push_back(pElement);
		//return SkipBlank(xmlNext+3);
		xml+=4;//SkipTo(xml,"<!--");
		return SkipTo(xml,"-->");
	}
// Execute Command.
bool Game_Interpreter_Battle::ExecuteCommand() {
	if (index >= list.size()) {
		return CommandEnd();
	}

	if (Game_Battle::IsBattleAnimationWaiting()) {
		return false;
	}

	RPG::EventCommand const& com = list[index];

	switch (com.code) {
		case Cmd::CallCommonEvent:
			return CommandCallCommonEvent(com);
		case Cmd::ForceFlee:
			return CommandForceFlee(com);
		case Cmd::EnableCombo:
			return CommandEnableCombo(com);
		case Cmd::ChangeMonsterHP:
			return CommandChangeMonsterHP(com);
		case Cmd::ChangeMonsterMP:
			return CommandChangeMonsterMP(com);
		case Cmd::ChangeMonsterCondition:
			return CommandChangeMonsterCondition(com);
		case Cmd::ShowHiddenMonster:
			return CommandShowHiddenMonster(com);
		case Cmd::ChangeBattleBG:
			return CommandChangeBattleBG(com);
		case Cmd::ShowBattleAnimation_B:
			return CommandShowBattleAnimation(com);
		case Cmd::TerminateBattle:
			return CommandTerminateBattle(com);
		case Cmd::ConditionalBranch_B:
			return CommandConditionalBranch(com);
		case Cmd::ElseBranch_B:
			return SkipTo(Cmd::EndBranch_B);
		case Cmd::EndBranch_B:
			return true;
		default:
			return Game_Interpreter::ExecuteCommand();
	}
}
예제 #13
0
bool Game_Interpreter_Map::ContinuationShowInnFinish(RPG::EventCommand const& /* com */) {
	if (Graphics::IsTransitionPending())
		return false;

	const RPG::Music& bgm_inn = Game_System::GetSystemBGM(Game_System::BGM_Inn);
	if (bgm_inn.name.empty() ||
		bgm_inn.name == "(OFF)" ||
		bgm_inn.name == "(Brak)" ||
		!Audio().BGM_IsPlaying() ||
		Audio().BGM_PlayedOnce()) {

		Game_System::BgmStop();
		continuation = NULL;
		Graphics::GetTransition().Init(Transition::TransitionFadeIn, Scene::instance.get(), 36, false);
		Game_System::BgmPlay(Main_Data::game_data.system.before_battle_music);

		if (Game_Temp::inn_handlers)
			SkipTo(Cmd::Stay, Cmd::EndInn);
		index++;
		return false;
	}

	return false;
}
예제 #14
0
/**
 * Execute Command.
 */
bool Game_Interpreter_Map::ExecuteCommand() {
	if (index >= list.size()) {
		return CommandEnd();
	}

	RPG::EventCommand const& com = list[index];

	switch (com.code) {
		case Cmd::RecallToLocation:
			return CommandRecallToLocation(com);
		case Cmd::EnemyEncounter:
			return CommandEnemyEncounter(com);
		case Cmd::VictoryHandler:
		case Cmd::EscapeHandler:
		case Cmd::DefeatHandler:
			return SkipTo(Cmd::EndBattle);
		case Cmd::EndBattle:
			return true;
		case Cmd::OpenShop:
			return CommandOpenShop(com);
		case Cmd::Transaction:
		case Cmd::NoTransaction:
			return SkipTo(Cmd::EndShop);
		case Cmd::EndShop:
			return true;
		case Cmd::ShowInn:
			return CommandShowInn(com);
		case Cmd::Stay:
		case Cmd::NoStay:
			return SkipTo(Cmd::EndInn);
		case Cmd::EndInn:
			return true;
		case Cmd::EnterHeroName:
			return CommandEnterHeroName(com);
		case Cmd::Teleport:
			return CommandTeleport(com);
		case Cmd::EnterExitVehicle:
			return CommandEnterExitVehicle(com);
		case Cmd::PanScreen:
			return CommandPanScreen(com);
		case Cmd::ShowBattleAnimation:
			return CommandShowBattleAnimation(com);
		case Cmd::FlashSprite:
			return CommandFlashSprite(com);
		case Cmd::ProceedWithMovement:
			return CommandProceedWithMovement(com);
		case Cmd::HaltAllMovement:
			return CommandHaltAllMovement(com);
		case Cmd::PlayMovie:
			return CommandPlayMovie(com);
		case Cmd::OpenSaveMenu:
			return CommandOpenSaveMenu(com);
		case Cmd::OpenMainMenu:
			return CommandOpenMainMenu(com);
		case Cmd::OpenLoadMenu:
			return CommandOpenLoadMenu(com);
		case Cmd::ToggleAtbMode:
			return CommandToggleAtbMode(com);
		case Cmd::OpenVideoOptions:
			Output::Warning("OpenVideoOptions: Command not supported");
			return true;
		default:
			return Game_Interpreter::ExecuteCommand();
	}
}
예제 #15
0
// Execute Command.
bool Game_Interpreter::ExecuteCommand() {
	RPG::EventCommand const& com = list[index];

	switch (com.code) {
		case Cmd::ShowMessage:
			return CommandShowMessage(com);
		case Cmd::ChangeFaceGraphic:
			return CommandChangeFaceGraphic(com);
		case Cmd::ShowChoice:
			return CommandShowChoices(com);
		case Cmd::ShowChoiceOption:
			return SkipTo(Cmd::ShowChoiceEnd);
		case Cmd::ShowChoiceEnd:
			return true;
		case Cmd::InputNumber:
			return CommandInputNumber(com);
		case Cmd::ControlSwitches:
			return CommandControlSwitches(com);
		case Cmd::ControlVars:
			return CommandControlVariables(com);
		case Cmd::ChangeGold:
			return CommandChangeGold(com);
		case Cmd::ChangeItems:
			return CommandChangeItems(com);
		case Cmd::ChangePartyMembers:
			return CommandChangePartyMember(com);
		case Cmd::ChangeLevel:
			return CommandChangeLevel(com);
		case Cmd::ChangeSkills:
			return CommandChangeSkills(com);
		case Cmd::ChangeEquipment:
			return CommandChangeEquipment(com);
		case Cmd::ChangeHP:
			return CommandChangeHP(com);
		case Cmd::ChangeSP:
			return CommandChangeSP(com);
		case Cmd::ChangeCondition:
			return CommandChangeCondition(com);
		case Cmd::FullHeal:
			return CommandFullHeal(com);
		case Cmd::TintScreen:
			return CommandTintScreen(com);
		case Cmd::FlashScreen:
			return CommandFlashScreen(com);
		case Cmd::ShakeScreen:
			return CommandShakeScreen(com);
		case Cmd::Wait:
			return CommandWait(com);
		case Cmd::PlayBGM:
			return CommandPlayBGM(com);
		case Cmd::FadeOutBGM:
			return CommandFadeOutBGM(com);
		case Cmd::PlaySound:
			return CommandPlaySound(com);
		case Cmd::EndEventProcessing:
			return CommandEndEventProcessing(com);
		case Cmd::Comment:
		case Cmd::Comment_2:
			return true;
		case Cmd::GameOver:
			return CommandGameOver(com);
		default:
			return true;
	}
}
예제 #16
0
void Minfy( CHAR* dst, CHAR* src, BOOL R0932, BOOL R1310, BOOL Rcmnt, BOOL Rsmrt )
{
 CHAR c,*u, q;
 BOOL b,z;
 UINT n13=0;
 mS1 = FALSE; mS2 = FALSE; mS3 = FALSE;
 mSp=src; mTp=dst; mPre = mSp;

 CkJS(); // is javascript
 
 for(mSp=src,c=*mSp; c!=0; c=*(++mSp) )
 {
  if(!mJS && startswith_all_case("<SCRIPT"))
   {
    mJS = TRUE; SkipTo('>'); mJS=(*(mSp-1)!='/'); continue;     // here the script starts
   }
  if(mJS && startswith_all_case("</SCRIPT"))
   {
    SkipTo('>'); mJS = FALSE; continue;               // script ends
   }
  if(!mJS)	// if html then do nothing
   {
   	*(mTp++)=c;
    continue;
   }

  if(c==39 && !mS2) mS1 = !mS1;   // '
  if(c==34 && !mS1) mS2 = !mS2;   // "

  if(!(mS1 || mS2 || mS3))
    {
    if(Rsmrt)
			{
			q = *mPre;
			if( q==';' )
			 {
			 	if( c==';' ) continue;
			 	if( c=='}' && *(mTp-1)==q ) { *(mTp-1)=c; continue; }  
			 }
			}

			// remove comments
    if(startswith("//"))
			{
			for(;c!=0 && !CRLF(c); c=*(++mSp)) if(!Rcmnt) *(mTp++)=c;
			if(!Rcmnt)		
			 {
			 	if(c==13) { *(mTp++)=c; c=*(++mSp); }	// skip LFs
			 	if(c==10) { *(mTp++)=c; c=*(++mSp); }
			 }		
			mSp--;
			continue;
			}

    if(startswith("/*"))
			{
			for(;c!=0; c=*(++mSp))
			 {
			 if(!Rcmnt) *(mTp++)=c;
			 if(c=='/' && *(mSp-1)=='*') break;
			 }
			continue;
			}
		
    if(c=='/')    // try skip regexp
			{
			if(pre4regexp())
				{
				SkipTo('/'); continue;
				}
			}
	

    // end of line
    if(R1310 && CRLF(c))
     {
		u = mSp; mSp = mPre+1;
		if(comesafter("else")) *(mTp++)=32;
		mSp = u; c=*mSp;
		z = (c==13);
     	b = (z && *(++mSp)==10);
     	if((++n13)<12)
     	 {
				if(z && !b) mSp--;
				continue;
     	 }    	
     	n13=0;
     }


	if(!(CRLF(c) || TABSPC(c))) mPre = mSp;

    if(TABSPC(c) && (!testINcase()))
     {
     	if(R0932) c=32;		// no tabs in result
     	
     	u = mSp; mSp = mPre+1;
			b =
        comesafter("function") ||
        comesafter("var") ||
        comesafter("typeof") ||
        comesafter("instanceof") ||
        comesafter("return") ||
        comesafter("case") ||
        comesafter("new") ||
        comesafter("else") ||
        comesafter("throw") ||
        comesafter("break") ||
        comesafter("continue");
      if(!b)
         {
         	if((mSp==u) && comesafter("in"))
         	 {
         	 	*(mTp++)=c;
         	 	continue;
         	 }
         }
      mSp = u; c=*mSp;
      if(!b)
        	{
        	for(; TABSPC(c) && (!testINcase()) ; c=*(++mSp))
         	 if(!R0932) *(mTp++)=c;
        	mSp--;
        	continue;
        	}
     }

    }

  *(mTp++)=c;
 }
*mTp=0;
}
// Conditional branch.
bool Game_Interpreter_Battle::CommandConditionalBranch(RPG::EventCommand const& com) {
	bool result = false;
	int value1, value2;

	switch (com.parameters[0]) {
		case 0:
			// Switch
			result = Game_Switches[com.parameters[1]] == (com.parameters[2] == 0);
			break;
		case 1:
			// Variable
			value1 = Game_Variables[com.parameters[1]];
			if (com.parameters[2] == 0) {
				value2 = com.parameters[3];
			} else {
				value2 = Game_Variables[com.parameters[3]];
			}
			switch (com.parameters[4]) {
				case 0:
					// Equal to
					result = (value1 == value2);
					break;
				case 1:
					// Greater than or equal
					result = (value1 >= value2);
					break;
				case 2:
					// Less than or equal
					result = (value1 <= value2);
					break;
				case 3:
					// Greater than
					result = (value1 > value2);
					break;
				case 4:
					// Less than
					result = (value1 < value2);
					break;
				case 5:
					// Different
					result = (value1 != value2);
					break;
			}
			break;
		case 2: {
			// Hero can act
			Game_Actor* actor = Game_Actors::GetActor(com.parameters[1]);
			if (actor) {
				result = actor->CanAct();
			}
			break;
		}
		case 3:
			// Monster can act
			if (com.parameters[1] < Main_Data::game_enemyparty->GetBattlerCount()) {
				result = (*Main_Data::game_enemyparty)[com.parameters[1]].CanAct();
			}
			break;
		case 4:
			Output::Warning("Battle: Monster is target not implemented");
			// Monster is the current target
			/*result = Game_Battle::HaveTargetEnemy() &&
				Game_Battle::GetTargetEnemy().ID == com.parameters[1];*/
			break;
		case 5:
			// Hero uses the ... command
			result = Game_Actors::GetActor(com.parameters[1])->GetLastBattleAction() == com.parameters[2];
			break;
	}

	if (result)
		return true;

	return SkipTo(Cmd::ElseBranch_B, Cmd::EndBranch_B);
}
예제 #18
0
파일: fgeXML.cpp 프로젝트: dengchao000/fge
	//元素结束  ]]>
	const char* CXML::parseCDataEnd(const char* xml)
	{
		return SkipTo(xml,"]]>");
	}
예제 #19
0
bool cParsing::SkipTo(const std::string & _path)
{
	return SkipTo(_path.c_str());
}
예제 #20
0
파일: fgeXML.cpp 프로젝트: dengchao000/fge
	//<
	const char* CXML::parseLf(const char* xml)//解析左括号;
	{
		char szBuf[80];
		TAG *tag = 0;

		xml+=1;//xml = SkipTo(xml,"<");
		xml = ReadWord(xml,szBuf,80,&tag);
		//TAG *tag = GetTagParseFunc(szBuf);
		if(szBuf[0])
		{
			//读取一个元素,元素可以为空元素,但是必须关闭
			Element *e = new Element;
			e->name = szBuf; 

			m_pcr->AddSubElement(e);
			m_pcr = e;//&(*(--m_pcr->subElement.end()));
			//读取属性
			xml = readAttrib(*m_pcr,xml);
			//xml == ">" || "/>"
			if(StrCmp(xml,"/>"))
				return parseEndEmptyElment(xml);
			else if(StrCmp(xml,">"))
				xml++;
			else
				throw XMLException("标签未正确关闭");

			const char* xmlNext = 0;
			const char* xmlRet = 0;
			if(StrCmp(xml,"[[data"))
			{
				xml+=strlen("[[data");
				m_pcr->bDataValue = *xml;
				sprintf_s(szBuf,"%cdata]]",*xml++);
				//xmlNext = Find(xml," data]]");
				xmlNext = Find(xml,szBuf);
				xmlRet = xmlNext + strlen("[[data ");
			}
			else
			{
				xmlRet = xmlNext = Find(xml,"<");
			}

			//读值
			if(!xmlNext)
				throw XMLException("标签未正确关闭");
			if(xmlNext > xml)
			{
				int n = (int)(xmlNext-xml);

				while(n>0 && ( *xml=='\r' || *xml=='\n' || *xml=='\t') )
				{
					xml++;
					n--;
				}
				//m_pcr->value.resize(n);
				for(int i=0; i<n; i++)
				{
					if(xml[i]!='\r')
						m_pcr->value += xml[i];
				}
				//m_pcr->value[n] = '\0';
			}
			return xmlRet;
		}
		else
			throw XMLException("无元素名或关键字错误.");
		return SkipTo(xml,">");
	}