www.pudn.com > GameEngine_src.rar > CGameManager.cpp
#include "CGameManager.h" #include "normal.h" #include "resource.h" #include "CAppWnd.h" #include "CEPKFile.h" #include "CEasyAudio.h" #include "CBaseSprite.h" #include "CMap.h" #include "CMessageManager.h" #include "CSpriteFactory.h" #include "CHero.h" #include "CPathSeeker.h" #include "CDInput.h" #include "CProgressBar.h" #include "CNpcDlg.h" #include "CItemFactory.h" #include "CMagicFactory.h" #include "BaseUtil.h" //#include "resource.h" #includeextern CAppWnd theAppWnd; extern PEASYDRAW g_pEasyDraw; extern PEASYAUDIO g_pEasyAudio; extern CMap theMap; extern CMessageManager theMsgMgr; extern CPathSeeker thePathSeeker; extern CSpriteFactory theSpriteFactory; extern CHero theHero; extern CDIMouse theMouse; extern CDIKeyBoard theKeyBoard; extern CProgressBar theHPBar; extern CProgressBar theMPBar; extern CNpcDlgMgr theNpcDlgMgr; extern CItemBox theItemBag; extern CItemFactory theItemFactory; extern CItemBox theItemTrough; extern CItemBox theItemStorage; extern CItemBox theEquipmentBox; extern CItemBox theItemShop; extern CMagicFactory theMagicFactory; const RECT MAIN_MENU_BUTTON_RECT[4] = { {307, 147, 500, 175}, {307, 216, 500, 241}, {307, 297, 500, 326}, {307, 381, 500, 410}, }; const RECT LOAD_GAME_BUTTON_RECT[4] = { {80, 230, 136, 283}, {419, 231, 476, 284}, {156, 363, 396, 402}, {160, 446, 400, 484} }; const RECT NEW_HERO_BUTTON_RECT[4] = { {350, 206, 390, 242}, {154, 363, 400, 400}, {236, 262, 403, 294}, {155, 448, 400, 485} }; const RECT GAME_MENU_BUTTON_RECT[3] = { {40, 48, 180, 70}, {40, 110, 180, 132}, {40, 170, 180, 190} }; const char * SURF_NAME[7] = { "MainMenu.ecp", "CurSel.ecp", "NewHero.ecp", "LoadHero.ecp", "author.ecp", "GameMenu.ecp", "GameHelp.ecp" }; const char * CLASS_NAME[3]= { "剑士", "秘术师", "咒术师", }; const int KEY_ARRAY[26] = { DIK_A, DIK_B, DIK_C, DIK_D, DIK_E, DIK_F, DIK_G, DIK_H, DIK_I, DIK_J, DIK_K, DIK_L, DIK_M, DIK_N, DIK_O, DIK_P, DIK_Q, DIK_R, DIK_S, DIK_T, DIK_U, DIK_V, DIK_W, DIK_X, DIK_Y, DIK_Z, }; ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// CGameManager::CGameManager() { m_CurSelSprite = NULL; m_bLocked = false; m_GameState = GS_MAIN_MENU; m_CurSelHero = 0; m_CurSelClass = 0; } CGameManager::~CGameManager() { } ////////////////////////////////////////////////////////////////////// //GameManager的初始化,一定要在ResMgr和map的后面 ////////////////////////////////////////////////////////////////////// bool CGameManager::Init() { PSURFACE bk_surf, ft_surf; BYTE *buf; int i; CEPKFile epk; HINSTANCE hIn = GetModuleHandle(NULL); m_hPointCursor = LoadCursor( hIn, MAKEINTRESOURCE(IDC_NORMAL) ); if ( m_hPointCursor == NULL ) goto _error; m_hFightCursor = LoadCursor( hIn, MAKEINTRESOURCE(IDC_FIGHT) ); if ( m_hFightCursor == NULL ) goto _error; m_hPickCursor = LoadCursor( hIn, MAKEINTRESOURCE(IDC_PICK) ); if ( m_hPickCursor == NULL ) goto _error; if ( epk.Open( "..\\data\\loading.epk", EPK_IN ) == false ) goto _error; for ( i = 0; i < 7; ++i ) { buf = epk.Read( SURF_NAME[i] ); if ( buf == NULL ) goto _error; m_TempSurface[i] = g_pEasyDraw->CreateSurfaceFromMemory( buf ); if ( m_TempSurface[i] == NULL ) goto _error; } for ( ; i < 9; ++i ) { m_TempSurface[i] = g_pEasyDraw->CreateSurfaceEx( NULL, g_pEasyDraw->GetCharWidth() * 16, g_pEasyDraw->GetCharHeight(), 0, true, 0 ); m_TempSurface[i]->ClearSurface( 0, 0 ); } m_HeroClassSurface->WriteText( "剑士", 4, 0, 0, 0xffffff ); //初始化英雄职业页面 buf = epk.Read( "loadingbar_bk.ecp" ); if ( buf == NULL ) goto _error; bk_surf = g_pEasyDraw->CreateSurfaceFromMemory( buf ); if ( bk_surf == NULL ) goto _error; buf = epk.Read( "loadingbar_ft.ecp" ); if ( buf == NULL ) goto _error; ft_surf = g_pEasyDraw->CreateSurfaceFromMemory( buf ); if ( ft_surf == NULL ) { _error: epk.Close(); assert(false); return false; } epk.Close(); m_LoadingBar.Init( bk_surf, ft_surf, 140, 389 ); HANDLE handle; WIN32_FIND_DATA wfd; handle = FindFirstFile( "..\\save\\*.hd", &wfd ); if ( handle != INVALID_HANDLE_VALUE ) { char buf[16]; do { GetFileNameWithoutEx( wfd.cFileName, 0, buf, 16 ); m_HeroNameArray.Add( buf ); } while ( FindNextFile( handle, &wfd ) != FALSE ); } FindClose( handle ); g_pEasyAudio->PlayMP3( "..\\data\\blood.mp3" ); return true; } ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// void CGameManager::Free() { } ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// void CGameManager::ReadyToLoadLvl() { m_GameState = GS_LOADING_LVL; m_StepLoad = 0; m_AllToLoad = 6; m_NumLoaded = 0; m_LBRenderPoint.x = ( g_pEasyDraw->GetDeviceWidth() - m_LoadingBar.GetBackSurfWidth() ) / 2; m_LBRenderPoint.y = ( g_pEasyDraw->GetDeviceHeight()- m_LoadingBar.GetBackSurfHeight()) / 2; } ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// void CGameManager::OnGameLoop() { if ( m_GameState == GS_PROCESS_LVL ) //关卡进行时 { int mx = theMouse.GetX(); int my = theMouse.GetY(); int re = 0; re += theNpcDlgMgr.HandleMouseMsg(); theItemBag.EnableMouseMsg(); re += theItemStorage.HandleMouseMsg(); re += theEquipmentBox.HandleMouseMsg(); re += theItemShop.HandleMouseMsg(); re += theItemTrough.HandleMouseMsg(); re += theItemBag.HandleMouseMsg(); re += theHero.UpdateInfoDlg(); re += theHero.UpdateControlPanel( re ); HandleKeyMsg(); if ( re == 0 ) //如果GUI没有处理鼠标消息的话 HandleMouseMsg(); else OnMouseRelease(); theMap.Draw(); theHero.DrawBloodBar(); theItemBag.Draw(); theItemTrough.Draw(); theItemStorage.Draw(); theEquipmentBox.Draw(); theItemShop.Draw(); thePathSeeker.Clear(); theSpriteFactory.CreateMonster(); //if ( m_HeroState == HS_TALKING ) theNpcDlgMgr.Draw(); theMsgMgr.UpdateAndDraw(); theHero.ShowHeroInfo(); theHero.ShowControlPanel(); if ( m_CurSelSprite != NULL ) { m_CurSelSprite->EnableSelected(); if (m_CurSelSprite->GetSpriteType() == ST_MONSTER) SetClassLong( theAppWnd.GetHWnd(), GCL_HCURSOR, (long)m_hFightCursor ); else if ( m_CurSelSprite->GetSpriteType() == ST_ITEM ) SetClassLong( theAppWnd.GetHWnd(), GCL_HCURSOR, (long)m_hPickCursor ); } else { SetClassLong( theAppWnd.GetHWnd(), GCL_HCURSOR, (long)m_hPointCursor ); } } else if ( m_GameState == GS_LOADING_LVL ) //载入关卡 { switch ( m_StepLoad ) { case 0: theMap.LoadMap( NULL ); //首先载入地图,获取关卡中所需的SI,DLG,ITM文件 m_StepLoad++; break; case 1: theSpriteFactory.OnLoadLvl(); //载入SI文件,获取关卡所需的EPG,MGC文件 m_StepLoad++; m_AllToLoad += theSpriteFactory.GetNumEPG(); break; case 2: if ( theSpriteFactory.OnLoadingLvl() ) //每次循环中载入一个EPG文件,全部载入返回true m_StepLoad++; break; case 3: theMagicFactory.OnLoadLvl(); //载入MGC文件和魔法动画 m_StepLoad++; break; case 4: theNpcDlgMgr.OnLoadLvl(); //载入NPC对话框和相关ECP文件 m_StepLoad++; break; case 5: theItemFactory.OnLoadLvl(); //载入ITM文件和相关ECP文件 m_StepLoad++; break; case 6: //初始化所有对象工厂 theSpriteFactory.OnInitLvl(); theMagicFactory.OnInitLvl(); theNpcDlgMgr.OnInitLvl(); theItemFactory.OnInitLvl(); theHero.OnInitLvl(); theMouse.Reset(); m_StepLoad++; m_GameState = GS_PROCESS_LVL; theHero.SetHeroState( HS_NORMAL ); theHero.SetState( SS_WAIT ); m_bLocked = false; m_CurSelSprite = NULL; break; } //清屏,绘制载入画面: g_pEasyDraw->Clear(0); m_LoadingBar.Draw( m_LBRenderPoint.x, m_LBRenderPoint.y, m_NumLoaded, m_AllToLoad ); m_NumLoaded++; } else if ( m_GameState == GS_QUIT_LVL || m_GameState == GS_QUIT_GAME ) //退出关卡或退出游戏时 { theHero.SaveHero(); theMap.FreeMap(); theSpriteFactory.OnFreeLvl(); theMagicFactory.OnFreeLvl(); theNpcDlgMgr.OnFreeLvl(); theItemFactory.OnFreeLvl(); if ( m_GameState == GS_QUIT_LVL ) { ReadyToLoadLvl(); } else { PostMessage( theAppWnd.GetHWnd(), WM_CLOSE, 0, 0 ); } } else if ( m_GameState == GS_MAIN_MENU ) { int curSelButton = -1; int x = ( g_pEasyDraw->GetDeviceWidth() - m_MainMenuSurface->GetWidth() ) / 2; int y = ( g_pEasyDraw->GetDeviceHeight()- m_MainMenuSurface->GetHeight()) / 2; int mx = theMouse.GetX(); int my = theMouse.GetY(); for ( int i = 0; i < 4; ++i ) { if ( mx >= x + MAIN_MENU_BUTTON_RECT[i].left && mx <= x + MAIN_MENU_BUTTON_RECT[i].right ) { if ( my >= y + MAIN_MENU_BUTTON_RECT[i].top && my <= y + MAIN_MENU_BUTTON_RECT[i].bottom ) { curSelButton = i; break; } } } g_pEasyDraw->Clear(0); m_MainMenuSurface->DrawSurface( x, y, 0 ); //绘制主菜单 theMsgMgr.UpdateAndDraw(); if ( curSelButton != -1 ) { m_CurSelSurface->DrawSurface( x + MAIN_MENU_BUTTON_RECT[curSelButton].left - 50, y + MAIN_MENU_BUTTON_RECT[curSelButton].top - 10, 0 ); if ( theMouse.IsLRelease() ) { switch ( curSelButton ) { case 0: m_HeroNameSurface->ClearSurface( 0, 0 ); m_GameState = GS_NEW_HERO; break; case 1: if ( m_HeroNameArray.IsEmpty() == false ) m_GameState = GS_LOAD_HERO; else theMsgMgr.AddMessage( "没有任何记录" ); break; case 2: m_GameState = GS_AUTHOR; break; case 3: m_GameState = GS_QUIT_GAME; break; } } } } else if ( m_GameState == GS_LOAD_HERO ) { int x = ( g_pEasyDraw->GetDeviceWidth() - m_LoadHeroSurface->GetWidth() ) / 2; int y = ( g_pEasyDraw->GetDeviceHeight()- m_LoadHeroSurface->GetHeight()) / 2; int mx = theMouse.GetX(); int my = theMouse.GetY(); for ( int i = 0; i < 4; ++i ) { if ( mx >= x + LOAD_GAME_BUTTON_RECT[i].left && mx <= x + LOAD_GAME_BUTTON_RECT[i].right ) { if ( my >= y + LOAD_GAME_BUTTON_RECT[i].top && my <= y + LOAD_GAME_BUTTON_RECT[i].bottom ) break; } } m_LoadHeroSurface->DrawSurface( x, y, 0 ); if ( m_HeroNameArray.IsEmpty() == false ) { const char *name = m_HeroNameArray[m_CurSelHero].c_str(); m_HeroNameSurface->ClearSurface( 0, 0 ); m_HeroNameSurface->WriteTextCenter( name, 0xffffff ); m_HeroNameSurface->DrawSurface( x + 176, y + 244, 0 ); } if ( theMouse.IsLRelease() ) { if ( m_HeroNameArray.IsEmpty() ) m_GameState = GS_MAIN_MENU; else { switch ( i ) { case 0: m_CurSelHero++; break; case 1: m_CurSelHero--; break; case 2: theHero.LoadHero( m_HeroNameArray[m_CurSelHero].c_str() ); ReadyToLoadLvl(); break; case 3: m_GameState = GS_MAIN_MENU; break; } if ( m_CurSelHero >= m_HeroNameArray.GetLength() ) m_CurSelHero = 0; else if ( m_CurSelHero < 0 ) m_CurSelHero = m_HeroNameArray.GetLength() - 1; } } } else if ( m_GameState == GS_NEW_HERO ) { int x = ( g_pEasyDraw->GetDeviceWidth() - m_NewHeroSurface->GetWidth() ) / 2; int y = ( g_pEasyDraw->GetDeviceHeight()- m_NewHeroSurface->GetHeight()) / 2; int mx = theMouse.GetX(); int my = theMouse.GetY(); for ( int i = 0; i < 4; ++i ) { if ( mx >= x + NEW_HERO_BUTTON_RECT[i].left && mx <= x + NEW_HERO_BUTTON_RECT[i].right ) { if ( my >= y + NEW_HERO_BUTTON_RECT[i].top && my <= y + NEW_HERO_BUTTON_RECT[i].bottom ) break; } } for ( int j = 0; j < 26; ++j ) { if ( theKeyBoard.IsKeyPress( KEY_ARRAY[j] ) && m_NewHeroName.length() < 9 ) { char c = (char)j + 'a'; m_NewHeroName += c; m_HeroNameSurface->ClearSurface( 0, 0 ); m_HeroNameSurface->WriteText( m_NewHeroName.c_str(), m_NewHeroName.length(), 0, 0, 0xffffff ); break; } } if ( theKeyBoard.IsKeyPress( DIK_BACK ) ) { m_HeroNameSurface->ClearSurface( 0, 0 ); m_NewHeroName.erase(); } g_pEasyDraw->Clear(0); m_NewHeroSurface->DrawSurface( x, y, 0 ); m_HeroNameSurface->DrawSurface( x + 242, y + 264, 0 ); m_HeroClassSurface->DrawSurface( x + 244, y + 211, 0 ); theMsgMgr.UpdateAndDraw(); if ( theMouse.IsLRelease() ) { switch ( i ) { case 0: { m_CurSelClass++; m_CurSelClass %= 3; m_HeroClassSurface->ClearSurface( 0, 0 ); const char *name = CLASS_NAME[m_CurSelClass]; m_HeroClassSurface->WriteText( name, strlen(name), 0, 0, 0xffffff ); } break; case 1: if ( m_NewHeroName.empty() == false && m_HeroNameArray.IsContain( m_NewHeroName ) == false ) { theHero.NewHero( m_NewHeroName.c_str(), HERO_CLASS(m_CurSelClass + 1) ); ReadyToLoadLvl(); } else theMsgMgr.AddMessage( "名字重复或错误" ); break; case 2: theMsgMgr.AddMessage( "用键盘输入名字" ); break; case 3: m_GameState = GS_MAIN_MENU; break; } } } else if ( m_GameState == GS_AUTHOR ) { int x = ( g_pEasyDraw->GetDeviceWidth() - m_AuthorSurface->GetWidth() ) / 2; int y = ( g_pEasyDraw->GetDeviceHeight()- m_AuthorSurface->GetHeight()) / 2; m_AuthorSurface->DrawSurface( x, y, 0 ); if ( theMouse.IsLRelease() ) m_GameState = GS_MAIN_MENU; } else if ( m_GameState == GS_GAME_MENU ) { int x = ( g_pEasyDraw->GetDeviceWidth() - m_GameMenuSurface->GetWidth() ) / 2; int y = ( g_pEasyDraw->GetDeviceHeight()- m_GameMenuSurface->GetHeight()) / 2; int mx = theMouse.GetX(); int my = theMouse.GetY(); for ( int i = 0; i < 3; ++i ) { if ( mx >= x + GAME_MENU_BUTTON_RECT[i].left && mx <= x + GAME_MENU_BUTTON_RECT[i].right ) { if ( my >= y + GAME_MENU_BUTTON_RECT[i].top && my <= y + GAME_MENU_BUTTON_RECT[i].bottom ) break; } } m_GameMenuSurface->DrawSurface( x, y, 0 ); if ( theMouse.IsLRelease() ) { switch( i ) { case 0: m_GameState = GS_PROCESS_LVL; break; case 1: m_GameState = GS_GAME_HELP; break; case 2: m_GameState = GS_QUIT_GAME; break; } } } else if ( m_GameState == GS_GAME_HELP ) { int x = ( g_pEasyDraw->GetDeviceWidth() - m_GameHelpSurface->GetWidth() ) / 2; int y = ( g_pEasyDraw->GetDeviceHeight()- m_GameHelpSurface->GetHeight()) / 2; m_GameHelpSurface->DrawSurface( x, y, 0 ); if ( theMouse.IsLRelease() ) { m_GameState = GS_PROCESS_LVL; } } } ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// void CGameManager::SetCurSelSprite( CBaseSprite *sprite ) { if ( m_bLocked == false ) { m_CurSelSprite = sprite; if ( sprite != NULL && sprite->IsAlive() == false ) m_CurSelSprite = NULL; } } ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// void CGameManager::HandleMouseMsg() { //鼠标左健按下时 if ( theMouse.IsLPress() ) { //英雄不在死亡或NPC对话状态 if ( theHero.GetHeroState() <= HS_PICK ) { theHero.ClearCurMagic(); if ( m_CurSelSprite == NULL ) //如果指向的精灵为空,则寻路 { theHero.SetHeroState( HS_NORMAL ); POINT p = {theMouse.GetX(), theMouse.GetY()}; theMap.ClientToMap( p ); CELL cell; theMap.PointToCell( p, cell ); if ( theHero.IsWalking() ) theHero.SetNextDest( cell ); else theHero.GetPath( cell ); } else { if ( m_CurSelSprite->GetSpriteType() == ST_MONSTER ) //如果指向的精灵是怪物 { if ( theHero.GetHeroState() != HS_FIGHTING ) HeroMelee(); } else if ( m_CurSelSprite->GetSpriteType() == ST_N_B ) //如果指向的精灵是NPC { ((CNpc*)m_CurSelSprite)->OnClick(); } else if ( m_CurSelSprite->GetSpriteType() == ST_ITEM ) //如果指向的精灵是物品 { if ( CBaseSprite::CalcDistance( m_CurSelSprite->GetBasePoint(), theHero.GetBasePoint() ) <= 1 ) { theItemBag.AddItem( (CItem *)m_CurSelSprite ); m_CurSelSprite = NULL; } else { theHero.SetHeroState( HS_PICK ); POINT p = m_CurSelSprite->GetBasePoint(); CELL cell; theMap.PointToCell( p, cell ); if ( theHero.IsWalking() ) theHero.SetNextDest( cell ); else theHero.GetPath( cell ); } } } } } //鼠标左健按住不放时 else if ( theMouse.IsLDown() ) { m_bLocked = true; if ( theHero.GetHeroState() == HS_NORMAL ) { if ( m_CurSelSprite == NULL ) { if ( theHero.IsWalking() ) { POINT p = {theMouse.GetX(), theMouse.GetY()}; theMap.ClientToMap( p ); CELL cell; theMap.PointToCell( p, cell ); theHero.SetNextDest( cell ); } } } else if ( m_CurSelSprite != NULL ) { if ( theHero.GetHeroState() == HS_END_FIGHT ) { if ( m_CurSelSprite->GetSpriteType() == ST_MONSTER ) { //theHero.ClearCurMagic(); HeroMelee(); } else { OnMouseRelease(); } } } } else if ( theMouse.IsRPress() ) { if ( theHero.GetHeroState() != HS_FIGHTING && theHero.GetHeroState() <= HS_PICK ) HeroSpell(); } else if ( theMouse.IsRDown() ) { m_bLocked = true; if ( theHero.GetHeroState() == HS_END_FIGHT ) { HeroSpell(); } } //鼠标无动作时 else { OnMouseRelease(); //m_CurSelSprite = NULL; } } int F[12] = { DIK_F1, DIK_F2, DIK_F3, DIK_F4, DIK_F5, DIK_F6, DIK_F7, DIK_F8, DIK_F9, DIK_F10, DIK_F11, DIK_F12 }; ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// void CGameManager::HandleKeyMsg() { if ( theKeyBoard.IsKeyPress( DIK_SPACE ) ) { theHero.PickItem( 3 ); } if ( theKeyBoard.IsKeyPress( DIK_B ) ) { theItemBag.ChangeState(); } else if ( theKeyBoard.IsKeyPress( DIK_E ) ) { theEquipmentBox.ChangeState(); } else if ( theKeyBoard.IsKeyPress( DIK_C ) ) { theHero.ChangeInfoDlg(); } else if ( theKeyBoard.IsKeyDown( DIK_ESCAPE ) ) { if ( theHero.IsAlive() ) SetGameState( GS_GAME_MENU ); } else { for ( int i = 0; i < 12; ++i ) { if ( theKeyBoard.IsKeyPress( F[i] ) ) { theItemTrough.UseItem( 0, i ); break; } } } } ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// void CGameManager::HeroMelee() { theHero.SetEnemy( (CAliveSprite *)m_CurSelSprite ); if ( CBaseSprite::CalcDistance( m_CurSelSprite->GetBasePoint(), theHero.GetBasePoint() ) <= 1 ) { theHero.SetState( SS_MELEE ); theHero.SetHeroState( HS_FIGHTING ); theHero.GetNextDirection( m_CurSelSprite->GetBasePoint() ); } else { theHero.SetHeroState( HS_GOTO_FIGHT ); POINT p = m_CurSelSprite->GetBasePoint(); CELL cell; theMap.PointToCell( p, cell ); if ( theHero.IsWalking() ) theHero.SetNextDest( cell ); else theHero.GetPath( cell ); } } ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// void CGameManager::HeroSpell() { POINT p = {theMouse.GetX(), theMouse.GetY()}; CAliveSprite *pTarget = NULL; if ( m_CurSelSprite != NULL ) { if ( m_CurSelSprite->GetSpriteType() == ST_MONSTER ) { p = m_CurSelSprite->GetBasePoint(); pTarget = (CAliveSprite *)m_CurSelSprite; } else { if ( theHero.IsFighting() ) { theHero.SetState( SS_WAIT ); theHero.SetHeroState( HS_NORMAL ); m_bLocked = false; m_CurSelSprite = NULL; } } } else theMap.ClientToMap( p ); //theHero.GetNextDirection( p ); if ( theHero.Spell( pTarget, p ) == false ) { if ( theHero.IsFighting() ) { theHero.SetState( SS_WAIT ); theHero.SetHeroState( HS_NORMAL ); m_bLocked = false; m_CurSelSprite = NULL; } } } ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// void CGameManager::OnMouseRelease() { m_bLocked = false; m_CurSelSprite = NULL; if ( theHero.GetHeroState() == HS_END_FIGHT ) { theHero.SetState( SS_WAIT ); theHero.SetHeroState( HS_NORMAL ); //theHero.SetEnemy( NULL ); } } ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// void CGameManager::GotoMap( const char *mapName, int indexPoint ) { char sz[32] = "..\\data\\"; strcat( sz, mapName ); theMap.SetNextMap( sz ); theMap.SetIndexHeroPoint( indexPoint-1 ); SetGameState( GS_QUIT_LVL ); theHero.SetHeroState( HS_NORMAL ); }