EventManager.cpp
上传用户:lian_0917
上传日期:2013-03-24
资源大小:1151k
文件大小:21k
- #include "StdAfx.h"
- #include "./eventmanager.h"
- #include "./callback_functions.h"
- #include "gamelogic.h"
- using namespace std ;
- CEventManager::CEventManager(CGameLogic* contex)
- {
- this->contex = contex ;
- is_doing_event = false ;
- wait_for_enter = false ;
-
- // 背景默认状态:不作淡入
- m_background_state = BackGround_Normal ;
- m_frame_count = 0 ;
- m_waiting_frame = 0 ;
- m_is_doing_logic_wait = false ;
- }
- CEventManager::~CEventManager(void)
- {
- }
- /*
- * 读取脚本进入缓冲,比如第一幕
- */
- void CEventManager::LoadScene(std::string scenefile)
- {
- event_lib.clear() ;
- scenefile.insert(0, ".\Scenes\") ;
- ifstream in(scenefile.c_str()) ;
- stringstream stream ;
- string ProcName ;
- int first;
- int second ;
- string Actorname ;
- string BackBmpName ;
- string MaskBmpName ;
- stream.rdbuf()->str( readin( in ) ) ;
- if ( in.is_open() )
- {
- // 读事件关系表
- stream >> first >> second ;
- while ( first != -1 )
- {
- /* 触发事件 */
- relation_lib.insert( make_pair( first, second ) ) ;
- stream.clear() ;
- stream.rdbuf()->str(readin( in ) ) ;
- stream >> first >> second ;
- }
- stream.clear() ;
- stream.rdbuf()->str(readin( in ) ) ;
- // 读默认开始事件
- stream >> now_event ;
- vector<string> temp ;
- string reserve_word ;
- // 读所有事件进入事件库
- stream.clear() ;
- stream.rdbuf()->str(readin( in ) ) ;
- stream >> reserve_word >> ProcName ;
- while ( ProcName != "END" )
- {
- stream.clear() ;
- stream.rdbuf()->str(readin( in ) ) ;
-
- while ( stream.str() != "END" )
- {
- temp.push_back( stream.str() ) ;
- stream.clear() ;
- stream.rdbuf()->str(readin( in ) ) ;
- }
- event_lib.push_back( make_pair( ProcName, temp) ) ;
- temp.clear() ;
- stream.clear() ;
- stream.rdbuf()->str(readin( in ) ) ;
- stream >> reserve_word >> ProcName ;
- }
- PosIterator( now_event, 0, pos_in_a_event ) ;
- // 初始状态:一般状态
- m_background_state = BackGround_Normal ;
- m_is_in_state = false ;
- is_doing_event = true ;
- call_record.insert(now_event) ;
- this->Continue_Doing() ;
- // 提起执行脚本初始化部分
- while ( !wait_for_enter && this->Has_something_todo() )
- {
- this->Continue_Doing() ;
- }
- }
- }
- /*
- * 从文件读入一行脚本:忽略注释
- */
- string CEventManager::readin( std::ifstream& in )
- {
- char buf[512] ;
- string ret ;
- in.getline(buf, 512) ;
- while ( buf[0] == ';' || buf[0] == ' ' )
- {
- in.getline(buf, 128) ;
- }
- ret = buf ;
- return ret ;
- }
- /*
- * 是否正在执行情节脚本
- */
- bool CEventManager::Has_something_todo()
- {
- return is_doing_event ;
- }
- /*
- * 脚本解释部分:根据脚本执行不同的操作
- */
- void CEventManager::Executer(std::stringstream& stream )
- {
- string cmd ;
- stream >> cmd ;
- if ( cmd == "SAY" )
- {
- /* 这里处理人物对话 */
- contex->m_talking_board.actived = true ;
- contex->m_GameState = CGameLogic::TALKING ;
- string talker ;
- string lisenner ;
- string words ;
- stream >> talker >> lisenner >> words ;
- contex->m_talking_board.Talker_id = contex->m_ActorManager->GetActor(talker).face_Res_id ;
- contex->m_talking_board.words = words ;
- }
- else if ( cmd == "FIND" )
- {
- string item ;
- string description ;
- string property ;
- int val ;
- /* 找到道具 */
- contex->m_discovery_board.actived = true ;
- stream >> item >> description >> property >> val ;
- contex->m_discovery_board.item = contex->m_ActorManager->GetSimpleObj( item ).ResID ;
- contex->m_discovery_board.description = description ;
- SPropertyItem tool ;
- tool.name = property ;
- tool.description = description ;
- tool.icon_id = contex->m_discovery_board.item ;
- tool.val = val ;
- contex->m_ActorManager->GetActiveActor().AddTool( tool ) ;
- }
- else if ( cmd == "SHOWTEXT" )
- {
- string text ;
- contex->m_discovery_board.actived = true ;
- stream >> text ;
- contex->m_discovery_board.description = text ;
- contex->m_discovery_board.item = -1 ;
- }
- else if ( cmd == "SHOW_STA" )
- {
- stringstream text ;
- contex->m_discovery_board.actived = true ;
- text << "<size=12> 牛二牺牲了……</p>" ;
-
- text << " <color=16777215>在牛二死之前,您玩出</p>了本游戏 " ;
- text << 100 * (double)call_record.size() / this->event_lib.size() ;
- text << "% 的剧情</p>,别哭泣,别气馁,再接再</p>厉!</p>" ;
- text << " 回车返回主菜单。" ;
- contex->m_discovery_board.item = -1 ;
- contex->m_discovery_board.description = text.str() ;
- }
- else if ( cmd == "LEARN" )
- {
- string description ;
- string property ;
- int val ;
- string actor ;
- string temp ;
- /* 学会技能 */
- contex->m_discovery_board.actived = true ;
- stream >> actor >> description >> property >> val ;
- contex->m_discovery_board.item = contex->m_ActorManager->GetSimpleObj( "菜刀" ).ResID ;
- temp = "速成" ;
- temp += description ;
- contex->m_discovery_board.description = temp ;
- SPropertyItem skill ;
- skill.name = property ;
- skill.description = description ;
- skill.icon_id = -1 ;
- skill.val = val ;
- contex->m_ActorManager->GetActor(actor).LearnSkill( skill ) ;
- }
- else if ( cmd == "LEARNEND" )
- {
- contex->m_discovery_board.actived = false ;
- }
- else if ( cmd == "SHUTUP" )
- {
- contex->m_talking_board.actived = false ;
- }
- else if ( cmd == "FINDCLOSE" )
- {
- contex->m_discovery_board.actived = false ;
- }
- else if ( cmd == "CLOSEINPUTS" )
- {
- contex->m_bAccept_user_inputs = false ;
- }
- else if ( cmd == "OPENINPUTS")
- {
- contex->m_bAccept_user_inputs = true ;
- }
- else if ( cmd == "FADEIN" )
- {
- this->m_background_state = BackGround_Fadein ;
- this->m_is_in_state = false ;
- }
- else if ( cmd == "FADEOUT" )
- {
- this->m_background_state = BackGround_Fadeout ;
- this->m_is_in_state = false ;
- }
- else if ( cmd == "SPEAK" )
- {
- string file ;
- stream >> file ;
- Speak( file.c_str() ) ;
- }
- else if ( cmd == "LOADMUSIC" )
- {
- string file ;
- stream >> file ;
- LoadMusic( file.c_str() ) ;
- }
- else if ( cmd == "PLAYMUSIC" )
- {
- PlayMusic(true) ;
- }
- else if ( cmd == "STOPMUSIC" )
- {
- StopMusic() ;
- }
- else if ( cmd == "WAITKEY" )
- {
- wait_for_enter = true ;
- }
- else if ( cmd == "LOADSCENE" )
- {
- string scene_name, mask_name ;
- int logical_map ;
- stream >> scene_name >> mask_name >> logical_map ;
- this->ChangeScene(scene_name, mask_name, logical_map) ;
- }
- else if (cmd == "ACTIVEACTOR")
- {
- string ActorName ;
- int ActorX, ActorY, ActorFacing ;
- stream >> ActorName >> ActorX >> ActorY >> ActorFacing ;
- CPlayer& actor = this->contex->m_ActorManager->GetActor(ActorName) ;
- if ( !actor.is_dead )
- {
- actor.active_in_scene = true ;
- actor.facing = ActorFacing ;
- actor.x = ActorX ;
- actor.y = ActorY ;
- }
- }
- else if ( cmd == "KILLACTOR" )
- {
- string name ;
- stream >> name ;
- CPlayer& player = this->contex->m_ActorManager->GetActor(name) ;
- player.Die() ;
- }
- else if ( cmd == "USERCONTROL" )
- {
- string name ;
- stream >> name ;
- this->contex->m_ActorManager->SetActiveActor(name) ;
- }
- else if ( cmd == "DISABLEACTOR")
- {
- string ActorName ;
- stream >> ActorName ;
- this->contex->m_ActorManager->GetActor(ActorName).active_in_scene = false ;
- }
- else if ( cmd == "GOTO" ) /* 跳转到某个过程执行 */
- {
- string proc ;
- stream >> proc ;
- Do_Event( proc ) ;
- }
- else if ( cmd == "CALL" ) /* 调用某个过程执行 */
- {
- string proc ;
- string Argu ;
- vector<string> Argu_list ;
- stream >> proc >> Argu ;
- /*
- * 参数压栈
- */
- while ( Argu != "CALLEND" )
- {
- Argu_list.push_back(Argu) ;
- stream >> Argu ;
- }
- Call_Event( proc, &Argu_list) ;
- }
- else if ( cmd == "RET" ) /* 过程返回 */
- {
- Return_from_Event() ;
- }
- else if ( cmd == "SHIFTACTOR" )
- {
- string name ;
- string state ;
- stream >> name >> state ;
- CPlayer& actor = this->contex->m_ActorManager->GetActor(name) ;
- if ( state == "BIG" )
- {
- actor.SetActiveRes( CPlayer::BIG ) ;
- }
- else if ( state == "SMALL" )
- {
- actor.SetActiveRes( CPlayer::SMALL ) ;
- }
- else if ( state == "MID" )
- {
- actor.SetActiveRes( CPlayer::MID ) ;
- }
- }
- else if ( cmd == "WALKSPEED" )
- {
- string speed ;
- stream >> speed ;
- if ( speed == "FAST" )
- {
- contex->SetWalkingSpeed( CGameLogic::FASTMODE ) ;
- }
- else if ( speed == "SLOW" )
- {
- contex->SetWalkingSpeed( CGameLogic::SLOWMODE ) ;
- }
- }
- else if ( cmd == "STARTFIGHT" )
- {
- string name ;
- string npc_name ;
- stream >> name >> npc_name ;
- contex->StartFight(name, npc_name) ;
- }
- else if ( cmd == "ENDFIGHT" )
- {
- string name ;
- stream >> name ;
- contex->EndFight( name ) ;
- }
- else if ( cmd == "NPCFIGHT" )
- {
- string npc_name ;
- string user_name ;
- stream >> npc_name >> user_name ;
-
- contex->m_ActorManager->GetActor( npc_name ).NpcFight( user_name ) ;
- }
- else if ( cmd == "FIGHTMENU" )
- {
- contex->BringUpMenu( CGameLogic::MENU3 ) ;
- }
- else if ( cmd == "IF" )
- {
- string condition_src ;
- string op ;
- string condition_dest ;
- string temp ;
- stringstream then_stmt ;
- stringstream else_stmt ;
- int nest_count = 0 ;
- stream >> condition_src >> op >> condition_dest >> temp;
- if ( temp != "THEN" )
- {
- temp.insert(0, "script error: 'THEN' expected, but found: ") ;
- throw exception( temp.c_str() ) ;
- }
- else
- {
- /* 读取then部分,直到读到else为止 */
- stream >> temp ;
- while ( temp != "ELSE" || nest_count != 0 )
- {
- if ( temp == "IF" )
- {
- nest_count++ ;
- }
- if ( temp == "ENDIF" )
- {
- nest_count-- ;
- }
- then_stmt << temp << ' ';
- stream >> temp ;
- }
- /* 读else部分,直到读到ENDIF为止 */
- stream >> temp ;
- while ( temp != "ENDIF" || nest_count != 0 )
- {
- if ( temp == "IF" )
- {
- nest_count++ ;
- }
- if ( temp == "ENDIF" )
- {
- nest_count-- ;
- }
- else_stmt << temp << ' ' ;
- stream >> temp ;
- }
- }
- /* 根据条件选择执行 */
- string name ;
- string property ;
- size_t pos = condition_src.find('.') ;
- bool cond ;
- /* 解析人物属性操作,如 牛二.生命力 */
- name = condition_src.substr( 0, pos ) ;
- property = condition_src.substr( pos+1, condition_src.length() ) ;
- CPlayer& Actor = this->contex->m_ActorManager->GetActor( name ) ;
- if ( op == ">" )
- {
- SPropertyItem* item = Actor.Property( property ) ;
- cond = ( item->val > atoi( condition_dest.c_str() ) ) ;
- }
- else if ( op == "<" )
- {
- SPropertyItem* item = Actor.Property( property ) ;
- cond = ( item->val < atoi( condition_dest.c_str() ) ) ;
- }
- else if ( op == ">=" )
- {
- SPropertyItem* item = Actor.Property( property ) ;
- cond = ( item->val >= atoi( condition_dest.c_str() ) ) ;
- }
- else if ( op == "<=" )
- {
- SPropertyItem* item = Actor.Property( property ) ;
- cond = ( item->val <= atoi( condition_dest.c_str() ) ) ;
- }
- else if ( op == "==" )
- {
- SPropertyItem* item = Actor.Property( property ) ;
- cond = ( item->val == atoi( condition_dest.c_str() ) ) ;
- }
- else if ( op == "HAS" )
- {
- if ( property == "装备" )
- {
- SPropertyItem* item = Actor.FindTools( condition_dest ) ;
- if ( item == NULL )
- {
- cond = false ;
- }
- else
- {
- cond = true ;
- }
- }
- else if ( property == "技能" )
- {
- try
- {
- SPropertyItem* item = Actor.Skill( condition_dest ) ;
- cond = true ;
- }
- catch (...)
- {
- cond = false ;
- }
- }
- else
- {
- throw exception( "script error: actor's property expected in if-stmt" ) ;
- }
- }
- /*
- * 根据解释得来得条件执行
- */
- if ( cond )
- {
- Executer( then_stmt ) ;
- }
- else
- {
- Executer( else_stmt ) ;
- }
- }
- else if ( cmd == "NEXTEVENT" )
- {
- int id ;
- stream >> id ;
- CPlayer& Actor = contex->m_ActorManager->GetActiveActor() ;
- int ix = Actor.x ;
- int iy = Actor.y ;
- /*
- * 修改逻辑地图,下次可触发事件
- */
- contex->m_LogicMap[contex->m_current_map][ix/CGameLogic::granularity][iy/CGameLogic::granularity] = id ;
- }
- else if ( cmd == "WAYPOINT" )
- {
- string name ;
- string position ;
- string temp ;
- int x, y ;
- stream >> name >> position ;
- CPlayer& Actor = contex->m_ActorManager->GetActor( name ) ;
- while ( position != "STOP" && position != "LOOP" )
- {
- size_t pos = position.find_first_of(',') ;
- temp = position.substr(1, pos-1) ;
- x = atoi( temp.c_str() ) ;
- temp = position.substr(pos+1, position.length()-1) ;
- y = atoi( temp.c_str() ) ;
- Actor.push_way_point( x, y ) ;
- stream >> position ;
- }
- if ( position == "LOOP" )
- {
- Actor.set_task_loop(true) ;
- }
- else
- {
- Actor.set_task_loop(false) ;
- }
- }
- else if ( cmd == "CLEARWAYPOINT" )
- {
- string npc ;
- stream >> npc ;
- this->contex->m_ActorManager->GetActor(npc).flush_all_way_point() ;
- }
- else if ( cmd == "SETFACING" )
- {
- string npc ;
- string point ;
- stream >> npc >> point ;
- if ( point == "UP" )
- {
- this->contex->m_ActorManager->GetActor(npc).facing = 2 ;
- }
- else if ( point == "DOWN" )
- {
- this->contex->m_ActorManager->GetActor(npc).facing = 0 ;
- }
- else if ( point == "LEFT" )
- {
- this->contex->m_ActorManager->GetActor(npc).facing = 1 ;
- }
- else if ( point == "RIGHT" )
- {
- this->contex->m_ActorManager->GetActor(npc).facing = 3 ;
- }
- }
- else if ( cmd == "ACTOR_NEXT_TALKING" )
- {
- string name ;
- string proc ;
- stream >> name >> proc ;
- this->contex->m_ActorManager->GetActor(name).NextTalking( proc ) ;
- }
- else if ( cmd == "ACTORSHOW" )
- {
- string name ;
- stream >> name ;
- /* 人物秀 */
- contex->m_discovery_board.actived = true ;
- contex->m_discovery_board.item = -1 ;//contex->m_ActorManager->GetActor(name).face_Res_id ;
- contex->m_discovery_board.description = contex->m_ActorManager->GetActor(name).self_description.c_str() ;
- }
- else if ( cmd == "CLOSESHOW" )
- {
- contex->m_discovery_board.actived = false ;
- }
- else if ( cmd == "JMP" )
- {
- int addr ;
- stream >> addr ;
- this->pos_in_a_event = pos_in_a_event + addr ;
- }
- else if ( cmd == "INCEXP" )
- {
- // ActiveActor涨经验
- int val ;
- stream >> val ;
- contex->m_ActorManager->GetActiveActor().ChangeProperty("经验", val) ;
- }
- else if ( cmd == "DISABLE_AUTO_ATTACK" )
- {
- string name ;
- stream >> name ;
- contex->m_ActorManager->GetActor(name).AutoAttack( false ) ;
- }
- else if ( cmd == "ENABLE_AUTO_ATTACK" )
- {
- string name ;
- stream >> name ;
- contex->m_ActorManager->GetActor(name).AutoAttack( true ) ;
- }
- else if ( cmd == "SET" )
- {
- string name ;
- string property ;
- int val ;
- stream >> name >> property >> val ;
- contex->m_ActorManager->GetActor(name).Property(property)->val = val ;
- }
- else if ( cmd == "SET_ANGEL" )
- {
- double angel_up ;
- double angel_left ;
- stream >> angel_up >> angel_left ;
- contex->set_up_walking_angel( angel_up ) ;
- contex->set_left_walking_angel( angel_left ) ;
- }
- else if ( cmd == "THEEND" )
- {
- /* 当前幕通关 */
- contex->m_is_success = true ;
- }
- else if ( cmd == "LOST" )
- {
- string description ;
- stream >> description ;
- contex->m_ActorManager->GetActiveActor().DelTools( description ) ;
- }
- else if ( cmd == "NOOP" )
- {
- // 空指令,什么也不作
- return ;
- }
- else
- {
- cmd.insert(0, "Unrecognized script: ") ;
- throw exception( cmd.c_str() ) ;
- }
- }
- /*
- * 按照当前指针取出脚本,调用解释程序
- */
- bool CEventManager::Continue_Doing()
- {
-
- // 逻辑等待状态不执行脚本
- if ( is_logic_waiting() )
- {
- return false ;
- }
- if ( pos_in_a_event == FindProc(now_event).end() )
- {
- is_doing_event = false ;
- return false ;
- }
- string preProcess = *pos_in_a_event ;
- string argu = "%1" ;
- // 处理参数
- for ( int i = 0; i < 9; i++ )
- {
- argu[1] = i + '1' ;
- while (1)
- {
- size_t pos = preProcess.find(argu) ;
- if ( pos == string::npos )
- {
- break ;
- }
- preProcess.erase(pos, 2) ;
- preProcess.insert(pos, Arguments_list[i]) ;
- }
-
- }
- stringstream stream ;
- stream.rdbuf()->str( preProcess ) ;
- // 得到当前script,指针加一
- pos_in_a_event++ ;
- Executer( stream ) ;
- return false ;
- }
- /*
- * 跳转到某事件执行:类似jump
- */
- void CEventManager::Do_Event(int ID, std::vector<std::string>* ArguList)
- {
- char buf[16] ;
- string name = itoa( ID, buf, 10 ) ;
- Do_Event(name, ArguList) ;
- }
- void CEventManager::Do_Event( const string& Proc, std::vector<std::string>* ArguList)
- {
- now_event = Proc ;
- // 如果参数列表不为空,
- if ( ArguList != NULL )
- {
- // 加入新的参数列表
- Arguments_list = *ArguList ;
- }
- pos_in_a_event = FindProc( Proc ).begin() ;
- is_doing_event = true ;
- wait_for_enter = false ;
- // 记录数据便于统计
- call_record.insert(Proc) ;
- }
- /*
- * 调用某事件执行,类似call
- */
- void CEventManager::Call_Event(int ID, std::vector<std::string>* ArguList)
- {
- char buf[16] ;
- string name = itoa( ID, buf, 10 ) ;
- Call_Event(name) ;
- }
- void CEventManager::Call_Event(const string& Proc, std::vector<std::string>* ArguList)
- {
- CallInfo info ;
- /*
- * 保存现场,压入调用栈
- */
- info.proc_name = now_event ;
- info.ip = pos_in_a_event - FindProc(now_event).begin() ;
- info.Scene = this->BackBmpResName ;
- info.Mask = this->MaskBmpResName ;
- info.logical_map = this->contex->m_current_map ;
- // 现场环境和当前参数列表压栈
- Call_Stack.push_back( info ) ;
- Arguments_Stack.push_back( Arguments_list ) ;
- // 如果参数列表不为空,
- if ( ArguList != NULL )
- {
- // 加入新的参数列表
- Arguments_list = *ArguList ;
- }
- else
- {
- Arguments_list.clear() ;
- }
- /* 准备新环境 */
- now_event = Proc ;
- pos_in_a_event = FindProc(Proc).begin() ;
- is_doing_event = true ;
- wait_for_enter = false ;
- // 记录调用,便于统计
- call_record.insert(Proc) ;
- }
- /*
- * 切换场景操作,包括逻辑和图像
- */
- void CEventManager::ChangeScene(const std::string& scene_name, const std::string& mask_name, int logical_map)
- {
- GameRes* res_info ;
- int pid ;
- res_info = this->contex->GetRes(scene_name) ;
- BackBmpResName = scene_name ;
- (*LoadBackGround)( res_info->filename.c_str(), res_info->color_key, &pid ) ;
- this->BackBmpID = pid ;
- res_info = this->contex->GetRes(mask_name) ;
- MaskBmpResName = mask_name ;
- (*LoadBGMask)( res_info->filename.c_str(), res_info->color_key , &pid ) ;
- this->MaskBmpID = pid ;
- // 切换逻辑地图
- this->contex->UseLogicalMap(logical_map) ;
- // 继续执行脚本,以获得场景转换之后的初始化
- while ( !wait_for_enter && this->Has_something_todo() )
- {
- this->Continue_Doing() ;
- }
- }
- /*
- * 输入事件号(由于触发事件从256开始编号,所以ID应该大于256),返回后续事件号
- */
- int CEventManager::Following_Event(int ID )
- {
- std::map<int, int>::iterator pos = relation_lib.find( ID ) ;
- if ( pos == relation_lib.end() )
- {
- return -1 ;
- }
- else
- {
- return (*pos).second ;
- }
- }
- void CEventManager::PosIterator(int cs, size_t ip, std::vector< std::string>::iterator& pos)
- {
- char buf[16] ;
- string ProcName = itoa(cs, buf, 10) ;
- // 转换到新过程的调用
- this->PosIterator(ProcName, ip, pos) ;
- }
- void CEventManager::PosIterator(const std::string& proc, size_t ip, std::vector< std::string>::iterator& pos)
- {
- try
- {
- std::vector<std::string>& code = FindProc( proc ) ;
- pos = code.begin() + ip ;
- }
- catch (exception e)
- {
- string err = "script error: call non-exsisted procedure " ;
-
- err += proc ;
- throw logic_error( err ) ;
- }
-
- }
- std::vector<std::string>& CEventManager::FindProc( const std::string& ProcName )
- {
- list< pair<string, vector<string > > >::iterator iter = event_lib.begin() ;
- for ( ; iter != event_lib.end(); ++iter )
- {
- if ( (*iter).first == ProcName )
- {
- return (*iter).second ;
- }
- }
- string err = "script error: procedure not found " ;
- err += ProcName ;
- throw logic_error( err ) ;
- }
- std::vector<std::string>& CEventManager::FindProc( int ProcID )
- {
- char buf[16] ;
- string ProcName = itoa(ProcID, buf, 10) ;
- return FindProc( ProcName ) ;
- }
- void CEventManager::Return_from_Event()
- {
- CallInfo& info = Call_Stack.back() ;
- Arguments_list = Arguments_Stack.back() ;
- /* 恢复现场 */
- now_event = info.proc_name ;
- PosIterator(now_event, info.ip, pos_in_a_event ) ;
- is_doing_event = true ;
- wait_for_enter = false ;
- if ( info.Scene != this->BackBmpResName && info.Mask != this->MaskBmpResName )
- {
- this->ChangeScene( info.Scene, info.Mask, info.logical_map ) ;
- this->m_background_state = BackGround_Fadein ;
- this->m_is_in_state = false ;
- }
- Call_Stack.pop_back() ;
- Arguments_Stack.pop_back() ;
- }
- void CEventManager::Wait(size_t count )
- {
- GetFrameCount( &m_frame_count ) ;
- m_waiting_frame = count ;
- m_is_doing_logic_wait = true ;
- }
- bool CEventManager::is_logic_waiting()
- {
- size_t now ;
- if ( m_is_doing_logic_wait )
- {
- GetFrameCount( &now ) ;
- if ( now - m_frame_count > m_waiting_frame )
- {
- m_is_doing_logic_wait = false ;
- return false ;
- }
- else
- {
- return true ;
- }
- }
- else
- {
- return false ;
- }
- }