how to add ammo bar?

Results 1 to 7 of 7
  1. #1
    Newbie laverint is offline
    MemberRank
    Jan 2022 Join Date
    16Posts

    shout how to add ammo bar?

    this:


  2. #2
    I'm retired, I'm already jorklenis2 is offline
    Grand MasterRank
    Oct 2011 Join Date
    PanamáLocation
    888Posts
    I made this bar a long time ago the truth.

  3. #3
    Member megaju9 is online now
    MemberRank
    Apr 2021 Join Date
    Finland HellLocation
    73Posts
    how u add it

  4. #4
    I'm retired, I'm already jorklenis2 is offline
    Grand MasterRank
    Oct 2011 Join Date
    PanamáLocation
    888Posts
    Taking as an example the life or EXP bar of the game hud.

  5. #5
    Sorcerer Supreme Enough is offline
    Member +Rank
    Oct 2012 Join Date
    302Posts
    take it of jetman source

  6. #6
    I'm retired, I'm already jorklenis2 is offline
    Grand MasterRank
    Oct 2011 Join Date
    PanamáLocation
    888Posts
    ZCombatInterface.cpp in bool ZCombatInterface::OnCreate() add these
    ´
    Code:
    	m_AmmoCount = new MBitmapR2;
    	if (!m_AmmoCount->Create("AmmoBar", RGetDevice(), "Interface/default/loading/loading.bmp"))
    	{
    		mlog("Error creating ammo bar\n");
    	}
    in void ZCombatInterface::OnDestroy() add
    Code:
    	if (m_AmmoCount != nullptr)
    	{
    		delete m_AmmoCount;
    		m_AmmoCount = nullptr;
    	}
    in void ZCombatInterface::DrawMyWeaponPont(MDrawContext* pDC) ebelow of MMatchCharItemParts nParts = pCharacter->GetItems()->GetSelectedWeaponParts();
    Code:
    	if (nParts != MMCIP_MELEE && nParts < MMCIP_END) 
    	{
    		// meleeÀ϶§´Â ź¾Ë¼ö Ç¥½Ã¸¦ ÇÏÁö ¾Ê´Â´Ù.
    		float width = static_cast<float>(pCharacter->GetItems()->GetSelectedWeapon()->GetBulletCurrMagazine()) /
    			static_cast<float>(pCharacter->GetItems()->GetSelectedWeapon()->GetDesc()->m_nMaxBullet.Ref());
    		BitmapRelative(pDC, 660.f / 800.f, 515.f / 600.f, width * 800.f, 16,m_AmmoCount->GetSourceBitmap());
    		sprintf(buffer, "%d / %d", m_nBulletCurrMagazine, m_nBulletSpare);
    		TextRelative(pDC, 720.f/800.f, 495.f/600.f, buffer);
    	}
    This is in the Jetman code, it's not the same as mine but it will help you depending on how you want to do it, I don't know if it will work for certain weapons and if you want to add colors you won't be able to because this works with MBitmapR2.

  7. #7
    Newbie laverint is offline
    MemberRank
    Jan 2022 Join Date
    16Posts
    Quote Originally Posted by jorklenis2 View Post
    ZCombatInterface.cpp in bool ZCombatInterface::OnCreate() add these
    ´
    Code:
        m_AmmoCount = new MBitmapR2;
        if (!m_AmmoCount->Create("AmmoBar", RGetDevice(), "Interface/default/loading/loading.bmp"))
        {
            mlog("Error creating ammo bar\n");
        }
    in void ZCombatInterface::OnDestroy() add
    Code:
        if (m_AmmoCount != nullptr)
        {
            delete m_AmmoCount;
            m_AmmoCount = nullptr;
        }
    in void ZCombatInterface::DrawMyWeaponPont(MDrawContext* pDC) ebelow of MMatchCharItemParts nParts = pCharacter->GetItems()->GetSelectedWeaponParts();
    Code:
        if (nParts != MMCIP_MELEE && nParts < MMCIP_END) 
        {
            // meleeÀ϶§´Â ź¾Ë¼ö Ç¥½Ã¸¦ ÇÏÁö ¾Ê´Â´Ù.
            float width = static_cast<float>(pCharacter->GetItems()->GetSelectedWeapon()->GetBulletCurrMagazine()) /
                static_cast<float>(pCharacter->GetItems()->GetSelectedWeapon()->GetDesc()->m_nMaxBullet.Ref());
            BitmapRelative(pDC, 660.f / 800.f, 515.f / 600.f, width * 800.f, 16,m_AmmoCount->GetSourceBitmap());
            sprintf(buffer, "%d / %d", m_nBulletCurrMagazine, m_nBulletSpare);
            TextRelative(pDC, 720.f/800.f, 495.f/600.f, buffer);
        }
    This is in the Jetman code, it's not the same as mine but it will help you depending on how you want to do it, I don't know if it will work for certain weapons and if you want to add colors you won't be able to because this works with MBitmapR2.
    edit: do you know any method so that the bar is always the same size? is that with that src it depends on the amount of ammo that the weapon has for the size of the bar
    Last edited by laverint; 1 Week Ago at 12:59 AM.



Advertisement