예제 #1
0
bool Player::Quick(Game_Manager* gm_, coord_def c, float focus_)
{
	if(GetStop())
		return false;
	if(berserker)
		return false;
	switch(quick_menu)
	{
	case 1:
		Special(gm_, c, focus_);
		break;
	case 2:
		Shot(gm_, c, focus_, 2);
		break;
	case 3:
		Shot(gm_, c, focus_, 3);
		break;
	case 4:
		Shot(gm_, c, focus_, 4);
		break;
	case 5:
		UseAbility(gm_, 0);
		break;
	case 6:
		UseAbility(gm_, 1);
		break;
	default:
		return false;
	}
	return true;
}
예제 #2
0
bool Player::Shot(Game_Manager* gm_, coord_def c, float focus_, int item_num)
{
	if(GetStop())
		return false;
	Item* item_ = NULL;
	switch(item_num)
	{
	case 0:
		item_ = current_weapon;
		break;
	case 1:
		item_ = main_weapon;
		break;
	case 2:
		item_ = sub_weapon[0];
		break;
	case 3:
		item_ = sub_weapon[1];
		break;
	case 4:
		item_ = melee_weapon;
		break;
	}
	if(!GetDelay() && item_)
	{
		focus_ += GetFocusSum();
		InitNoneMoveCount();
		if(SetDelay(item_->Shot(gm_, this, GetTeam(), GetPos(), c, focus_)) == -1)
		{
			SetDelay(0);
			if(item_ == main_weapon)
			{
				Reload(gm_);
			}
			return false;
		}
		else
		{
			if(item_ == main_weapon)
			{
				if(GetFocus() < main_weapon->GetFocusMaxReact())
					UpDownFocus(main_weapon->GetFocusReact());
			}
			return true;
		}
	}
	return false;
}
예제 #3
0
inline void TaskThread::Run(void* arg)
{
    idleStart = time(NULL);
    do
    {
        currentTask = queue.Pop();
        if (currentTask != NULL)
        {
            currentTask->Run();
            currentTask = NULL;
            idleStart = time(NULL);
        }
        else
        {
            Sleep(1);
        }
    }
    while (!GetStop());
}
예제 #4
0
bool Monster::Shot(Game_Manager* gm_, coord_def c, float focus_, int item_num)
{
	if(GetShotStop())
		return false;
	if(GetStop())
		return false;
	if(!GetDelay() && weapon)
	{
		focus_ += weapon->GetFocusBase()+GetFocusSum();
		while(SetDelay(weapon->Shot(gm_, this, GetTeam(), GetPos(), c, focus_)*panalty) < 0)
		{
			SetDelay(0.0f);
			weapon->Reload(); //몬스터는 무한 리로드한다.
		}
		if(GetFocus() < weapon->GetFocusMaxReact())
			UpDownFocus(weapon->GetFocusReact());
		return true;
	}
	return false;
}
예제 #5
0
void LocationDlg::UpdateEnabling()
{
	GetAnimPos()->Enable(m_iAnim != -1);
	GetSaveAnim()->Enable(m_iAnim != -1);
	GetActive()->Enable(m_iAnim != -1);
	GetSpeed()->Enable(m_iAnim != -1);
	GetReset()->Enable(m_iAnim != -1);
	GetPlay()->Enable(m_iAnim != -1);
	GetRecord1()->Enable(m_iAnim != -1);
	GetStop()->Enable(m_iAnim != -1);
	GetLoop()->Enable(m_iAnim != -1);
	GetContinuous()->Enable(m_iAnim != -1);
	GetSmooth()->Enable(m_iAnim != -1 && GetAnim(m_iAnim)->NumPoints() > 2);
	GetPosOnly()->Enable(m_iAnim != -1);

	GetRecordInterval()->Enable(m_iAnim != -1);
	GetRecordLinear()->Enable(m_iAnim != -1);

	GetRecordSpacing()->Enable(m_bRecordInterval);
	GetPlayToDisk()->Enable(m_iAnim != -1);
}
예제 #6
0
bool Player::Special(Game_Manager* gm_, coord_def c, float focus_)
{
	if(GetStop())
		return false;
	if(current_weapon)
	{
		//focus_ += GetFocusSum();
		//InitNoneMoveCount();
		if(SetDelay(current_weapon->special(gm_, this, GetTeam(), GetPos(), c, focus_)) == -1)
		{
			//ÀÌ ºÎºÐÀº ¹Ì±¸Çö
			//SetDelay(0);
			return false;
		}
		else
		{
			//ÀÌ ºÎºÐµµ ¹Ì±¸Çö
			return true;
		}
	}
	return false;
}
예제 #7
0
bool Monster::Melee(Game_Manager* gm_)
{
	if(!GetDamage())
		return false;
	bool ok_ = false;
	if(GetStop())
		return false;
	for(list<Unit*>::iterator it = gm_->unit_list.begin();it != gm_->unit_list.end();it++)
	{
		if((*it)->isLive() && !(*it)->isNonTarget()  && GetTeam() != (*it)->GetTeam())
		{
			if(GetSize()+(*it)->GetSize()+5.0f > distan_coord(GetPos(), (*it)->GetPos()))
			{
				//if(각도가 맞으면)
				MeleeDamage(gm_,(*it));
				SetDelay(30.0f);
				ok_ = true;
			}
		}
	}
	return ok_;
}
예제 #8
0
bool Named_fly_boss::Shot(Game_Manager* gm_, coord_def c, float focus_, int item_num)
{
	if(GetShotStop())
		return false;
	if(GetStop())
		return false;
	if(!GetDelay())
	{
		float length_ = distan_coord(GetPos(), c);

		if(length_ >120)
			return false;
		float angle_ = GetAngleToTarget(GetPos(), c);

		Unit* target_ = NULL;
		if(gm_)
		{
			for(list<Unit*>::iterator it = gm_->unit_list.begin();it != gm_->unit_list.end();it++)
			{
				if((*it)->isLive() && !(*it)->isNonTarget()  && (*it)->GetTeam() != GetTeam())
				{
					if((*it)->collution(c, 30.0f))
					{
						target_ = (*it);
						break;
					}
				}
			}
		}
		Unit* temp = new Mon_bug_child_fly(monster__bug_child_fly,this, target_, GetX(), GetY(), GetTeam(),200);
		temp->SetAi(MS_NORMAL, NULL, 2);
		temp->SetFlyAngle(GetAngle()+rand_float(-1.0f,1.0f,"Named_fly_boss::Shot delta angle"));
		gm_->unit_list.push_back(temp);			
		SetDelay(50.0f);
		return true;
	}
	return false;

}
예제 #9
0
int _tmain(int argc, _TCHAR* argv[])
{
    std::wcout << L"version : 2015.09.14" << std::endl;
    std::wcout << L"Usage : FbxExporter <path to fbx file> <outdir> [/fps:60|30|24] [/skipemptynodes] [/animstack:\"animstack name\"]" << std::endl;
    if (argc < 3) {
        std::wcerr << L"Invalid argument count" << std::endl;
        return -1;
    }
    std::wstring wInputPath(argv[1]);
    std::wstring wInputDir(argv[1]);
    std::wstring wInputFileName(argv[1]);
    auto lastDirSeparator = wInputDir.find_last_of(L'\\');
    if (lastDirSeparator == wInputDir.npos) {
        wInputDir = L".";
    }
    else {
        wInputDir.erase(lastDirSeparator);
        wInputFileName.erase(0, lastDirSeparator + 1);
    }
    std::wstring wOutputPath(argv[2]);
    CreateDirectory(wOutputPath.c_str(), nullptr);
    bool skipEmptyNodes = false;
    std::wstring animStackName;
    for (int i = 3; i < argc; ++i) {
        std::wstring warg = argv[i];
        if (warg == L"/skipemptynodes") {
            skipEmptyNodes = true;
        }
        else if (warg.find(L"/fps:") == 0) {
            if (warg == L"/fps:60") {
                GlobalSettings::Current().AnimationsTimeMode = FbxTime::EMode::eFrames60;
            }
            else if (warg == L"/fps:30") {
                GlobalSettings::Current().AnimationsTimeMode = FbxTime::EMode::eFrames30;
            }
            else if (warg == L"/fps:24") {
                GlobalSettings::Current().AnimationsTimeMode = FbxTime::EMode::eFrames24;
            }
            else {
                std::wcerr << L"Unrecognized fps parameter" << std::endl;
                return -2;
            }
        }
        else if (warg.find(L"/animstack:") == 0) {
            animStackName = warg.substr(11);

            if (animStackName.size()>0 && animStackName[0] == L'\"') {
                animStackName.erase(0, 1);
            }
            if (animStackName.size() > 0 && animStackName[animStackName.size() - 1] == L'\"') {
                animStackName.erase(animStackName.size() - 1, 1);
            }
        }

    }


    FbxSceneLoader sceneLoader(wstringToUtf8(wInputPath));
    auto animStackCount = sceneLoader.getScene()->GetSrcObjectCount<FbxAnimStack>();
    if (animStackName.size() == 0) {
        GlobalSettings::Current().AnimStackIndex = 0;
    }
    else {
        for (auto ix = 0; ix < animStackCount; ++ix) {
            auto animStack = sceneLoader.getScene()->GetSrcObject<FbxAnimStack>(ix);
            if (utf8ToWstring(animStack->GetName()) == animStackName) {
                GlobalSettings::Current().AnimStackIndex = ix;
            }
        }
    }
    std::wcout << L"Animation stacks : " << std::endl;
    for (auto ix = 0; ix < animStackCount; ++ix) {
        auto animStack = sceneLoader.getScene()->GetSrcObject<FbxAnimStack>(ix);
        if (ix == GlobalSettings::Current().AnimStackIndex) {
            std::wcout << L"[X] ";
            sceneLoader.getScene()->SetCurrentAnimationStack(animStack);
        }
        else {
            std::wcout << L"[ ] ";
        }

        std::wcout << utf8ToWstring(animStack->GetName());
        auto ts=animStack->GetLocalTimeSpan();
        auto start = ts.GetStart();
        auto stop = ts.GetStop();
        std::wcout << L"(" << start.GetMilliSeconds() << L" - " << stop.GetMilliSeconds() << L")" << std::endl;
    }

    auto root = sceneLoader.rootNode();

    BabylonScene babScene(*root, skipEmptyNodes);

    for (auto& mat : babScene.materials()) {
        exportTexture(mat.ambientTexture, wOutputPath);
        exportTexture(mat.diffuseTexture, wOutputPath);
        exportTexture(mat.specularTexture, wOutputPath);
        exportTexture(mat.emissiveTexture, wOutputPath);
        exportTexture(mat.reflectionTexture, wOutputPath);
        exportTexture(mat.bumpTexture, wOutputPath);

    }



    auto json = babScene.toJson();
    if (L'\\' != *wOutputPath.crbegin()) {
        wOutputPath.append(L"\\");
    }
    wOutputPath.append(wInputFileName);

    auto lastDot = wOutputPath.find_last_of(L'.');
    wOutputPath.erase(lastDot);
    wOutputPath.append(L".babylon");
    DeleteFile(wOutputPath.c_str());
    std::ofstream stream(wOutputPath);
    json.serialize(stream);
    stream.flush();
    return 0;
}
예제 #10
0
파일: NPC.cpp 프로젝트: pandaforks/Mirage--
void NPC::Update(float deltaTime, Map* map, Character& character) {
	int x = (RoundUp((int) mNPCData.mPosition.x + (mSprite.GetWidth() * 0.5),
			32) / 32) - 1;
	int y = (RoundUp((int) mNPCData.mPosition.y + (mSprite.GetHeight() * 0.5),
			32) / 32) - 1;
	int index = x + (y * mMapWidth);

	if (!mInit || !mNPCData.mCanMove)
		return;

	int tiles = mMapWidth * mMapHeight;

	// If we have reached our destination and are not fighting find a new place to walk
	if (mReachedDestination && !mBattling) {
		if (mNPCData.mHost) {
			mNPCData.mPathEnd = rand() % tiles;

			while (!map->GetWalkable(mNPCData.mPathEnd)) {
				mNPCData.mPathEnd = rand() % tiles;
			}

			RakNet::BitStream bsOut;
			bsOut.Write((RakNet::MessageID) ID_NPC_NEW_PATH);

			// Npc Array Slot
			bsOut.Write(mIndex);

			// End Position index
			bsOut.Write(mNPCData.mPathEnd);

			bsOut.Write(mNPCData.mPosition);

			mRaknet.mPeer->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0,
					mRaknet.mServerAddress, false);
		}
	} else if (!mNPCData.mStop) {
		SVector2 oldPosition = mNPCData.mPosition;
		mVelocity = SVector2(0.0f, 0.0f);
		// Smooths out Animation jitters
		for (int a = 0; a < 3; ++a) {
			// Move us towards are location
			if (mNPCData.mPathIndex < mPath.size()) {
				bool xDone = false;
				SVector2 position = mPath[mNPCData.mPathIndex];

				CheckCollision(deltaTime, *map, character);
				if (mNPCData.mPosition.x < position.x - mNPCData.mMoveSpeed) {
					mVelocity.x += mNPCData.mMoveSpeed;
				} else if (mNPCData.mPosition.x
						> position.x + mNPCData.mMoveSpeed) {
					mVelocity.x -= mNPCData.mMoveSpeed;
				} else {
					// We are at the right x location
					xDone = true;
				}

				// Move the npc to the next position
				if (mNPCData.mPosition.y < position.y - mNPCData.mMoveSpeed) {
					mVelocity.y += mNPCData.mMoveSpeed;
				} else if (mNPCData.mPosition.y
						> position.y + mNPCData.mMoveSpeed) {
					mVelocity.y -= mNPCData.mMoveSpeed;
				} else {
					// We are at the next tile
					if (xDone) {
						if (mNPCData.mHost) {
							RakNet::BitStream bsOut;
							bsOut.Write((RakNet::MessageID) ID_NPC_POSITION);
							bsOut.Write(mIndex); // Array location
							bsOut.Write(mNPCData.mPathIndex);
							bsOut.Write(mNPCData.mPosition);
							mRaknet.mPeer->Send(&bsOut, HIGH_PRIORITY,
									RELIABLE_ORDERED, 0, mRaknet.mServerAddress,
									false);
						}

						++mNPCData.mPathIndex;
					}
				}
			} else {
				mReachedDestination = true;
			}
		}

		Direction oldDirection = mDirection;
		SVector2 positionDifferance = mNPCData.mPosition - oldPosition;

		// Right
		if (positionDifferance.x > 0 && positionDifferance.y == 0) {
			if (oldDirection != right) {
				mAnimation.SetStartFrame(mFrames.WalkLeftStart);
				mAnimation.SetEndFrame(mFrames.WalkLeftEnd);

				mSprite.SetFlipH(true);
				mDirection = right;
			}
		}
		// Left
		else if (positionDifferance.x < 0 && positionDifferance.y == 0) {
			if (oldDirection != left) {
				mAnimation.SetStartFrame(mFrames.WalkLeftStart);
				mAnimation.SetEndFrame(mFrames.WalkLeftEnd);
				mSprite.SetFlipH(false);
				mDirection = left;
			}
		}
		// Up
		else if (positionDifferance.y > 0 && positionDifferance.x == 0) {
			if (oldDirection != up) {
				mAnimation.SetStartFrame(mFrames.WalkDownStart);
				mAnimation.SetEndFrame(mFrames.WalkDownEnd);

				mSprite.SetFlipH(false);
				mDirection = up;
			}
		}
		// Down
		else if (positionDifferance.y < 0 && positionDifferance.x == 0) {
			if (oldDirection != down) {
				mAnimation.SetStartFrame(mFrames.WalkUpStart);
				mAnimation.SetEndFrame(mFrames.WalkUpEnd);

				mSprite.SetFlipH(false);
				mDirection = down;
			}
		}

		// Up Right
		else if (positionDifferance.x > 0 && positionDifferance.y < 0) {
			if (oldDirection != rightDown) {
				mAnimation.SetStartFrame(mFrames.WalkLeftStart);
				mAnimation.SetEndFrame(mFrames.WalkLeftEnd);
				mSprite.SetFlipH(true);
				mDirection = rightDown;
			}
		}
		// Down Right
		else if (positionDifferance.x > 0 && positionDifferance.y > 0) {
			if (oldDirection != rightUp) {
				mAnimation.SetStartFrame(mFrames.WalkLeftStart);
				mAnimation.SetEndFrame(mFrames.WalkLeftEnd);
				mSprite.SetFlipH(true);
				mDirection = rightUp;
			}
		}

		// Up Left
		else if (positionDifferance.x < 0 && positionDifferance.y > 0) {
			if (oldDirection != leftUp) {
				mAnimation.SetStartFrame(mFrames.WalkLeftStart);
				mAnimation.SetEndFrame(mFrames.WalkLeftEnd);
				mSprite.SetFlipH(false);
				mDirection = leftUp;
			}
		}
		// Down Left
		else if (positionDifferance.x < 0 && positionDifferance.y < 0) {
			if (oldDirection != leftDown) {
				mAnimation.SetStartFrame(mFrames.WalkLeftStart);
				mAnimation.SetEndFrame(mFrames.WalkLeftEnd);
				mSprite.SetFlipH(false);
				mDirection = leftDown;
			}
		}

		if (positionDifferance.x != 0 || positionDifferance.y != 0) {
			mSprite.Update(deltaTime);
			mAnimation.AnimateSprite(deltaTime, mSprite);
			mAnimation.SetIsAnimating(true);
		}
	}

	if (GetStop()) {
		CheckCollision(deltaTime, *map, character);
	}
}