⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statusbar.cpp

📁 Blood 2全套源码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
					if( m_sCommSound )
					{
						g_pClientDE->KillSound( m_sCommSound );
						m_sCommSound = 0;
					}
					m_sCommSound = PlaySoundLocal(m_szCommVoice, SOUNDPRIORITY_MISC_HIGH,
												  DFALSE, DTRUE, DTRUE, DFALSE, 100);
				}
				m_fCommStartTime = currentTime;
			}

			m_pClientDE->DrawSurfaceToSurface(hScreen, m_hCharFaces, &locRect, m_nCommPicX, m_nCommPicY);
			break;

		case	3:
			if(!m_sCommSound || !m_bPlayVoice)
			{
				if(currentTime - m_fCommStartTime > m_fCommLength)
				{
					m_bCommState = 4;
					m_fCommStartTime = currentTime;
				}
			}
			else if(m_bPlayVoice && m_sCommSound && m_pClientDE->IsDone(m_sCommSound))
			{
				m_bCommState = 4;
				m_pClientDE->KillSound(m_sCommSound);
				m_sCommSound = DNULL;
				m_fCommStartTime = currentTime;
			}

			m_pClientDE->DrawSurfaceToSurface(hScreen, m_hCharFaces, &locRect, m_nCommPicX, m_nCommPicY);
			m_pInfoCursor->SetFont(m_pStatFont4);
			m_pInfoCursor->SetDest(hScreen);
			m_pInfoCursor->SetJustify(CF_JUSTIFY_LEFT);
			m_pInfoCursor->SetLoc((short)m_nCommTextX, (short)m_nCommTextY);
			m_pInfoCursor->DrawSolidFormat(m_szCommText, m_nCommTextWidth, white);
			break;
		case	4:
			if(currentTime - m_fCommStartTime > SB_COMMLINK_TIME_2)
			{
				m_bCommState = 5;
				m_fCommStartTime = currentTime;
			}

			m_pClientDE->DrawSurfaceToSurface(hScreen, m_hCharFaces, &locRect, m_nCommPicX, m_nCommPicY);
			break;
		case	5:
			dif = currentTime - m_fCommStartTime;
			if(dif > SB_COMMLINK_TIME_1)
			{
				m_bCommState = 0;
				m_fCommStartTime = currentTime;
				ratio = 1.0;
			}
			else
				ratio = (dif / SB_COMMLINK_TIME_1);

			m_pClientDE->DrawSurfaceToSurface(hScreen, m_hCharFaces, &locRect, m_nCommPicX, (DDWORD)(m_nCommPicY - ((m_nCommPicY - m_nCommPicStartY) * ratio)));
			break;
	}
}

//*************************************************************************
//*****	Function:	DrawStatTabs(HSURFACE hScreen)
//*****	Details:	Draws the stat tabs at the bottom of the screen
//*************************************************************************

void	CStatusBar::DrawStatTabs(HSURFACE hScreen)
{
	DRect	locRect;
	DFLOAT	currentTime = m_pClientDE->GetTime();

	locRect.top = 0;
	locRect.left = 0;
	locRect.right = SB_STATTAB_SIZE_X;
	locRect.bottom = SB_STATTAB_SIZE_Y;

	if(m_bStatsOn > 3)
	{
		m_pClientDE->DrawSurfaceToSurface(hScreen, m_hStatTabs, &locRect, m_nHealthX, m_nHealthY);
		m_pClientDE->DrawSurfaceToSurface(hScreen, m_hStatTabs, &locRect, m_nArmorX, m_nArmorY);

		locRect.left = SB_STATTAB_SIZE_X;
		locRect.right += SB_STATTAB_SIZE_X;

//		m_pClientDE->DrawSurfaceToSurface(hScreen, m_hStatTabs, &locRect, m_nManaX, m_nManaY);
		m_pClientDE->DrawSurfaceToSurface(hScreen, m_hStatTabs, &locRect, m_nAmmoX, m_nAmmoY);
	}

	locRect.bottom = SB_STATICON_SIZE_Y;

	if(m_bStatsOn > 2)
	{
		switch(m_nHeartFrame)
		{
			case	0:	if(currentTime - m_fHeartTime > m_fHeartBeat)
							{ m_nHeartFrame++; m_fHeartTime = currentTime; }
						break;
			case	1:
			case	2:	if(currentTime - m_fHeartTime > SB_HEARTBEAT_TIME_2)
							{ m_nHeartFrame++; m_fHeartTime = currentTime; }
						break;
			case	3:	if(currentTime - m_fHeartTime > SB_HEARTBEAT_TIME_2)
							{ m_nHeartFrame = 0; m_fHeartTime = currentTime; }
						break;
		}

		locRect.left = SB_HEALTHICON_LOC_X + m_nHeartFrame * SB_STATICON_SIZE_X; locRect.right = locRect.left + SB_STATICON_SIZE_X;
		m_pClientDE->DrawSurfaceToSurfaceTransparent(hScreen, m_hStatIcons, &locRect, m_nHealthX + SB_LEFTICON_OFFSET_X, m_nHealthY + SB_ICON_OFFSET_Y, m_hTransColor);

		locRect.left = SB_ARMORICON_LOC_X; locRect.right = locRect.left + SB_STATICON_SIZE_X;
		m_pClientDE->DrawSurfaceToSurfaceTransparent(hScreen, m_hStatIcons, &locRect, m_nArmorX + SB_LEFTICON_OFFSET_X, m_nArmorY + SB_ICON_OFFSET_Y, m_hTransColor);
//		locRect.left = SB_MANAICON_LOC_X; locRect.right = locRect.left + SB_STATICON_SIZE_X;
//		m_pClientDE->DrawSurfaceToSurfaceTransparent(hScreen, m_hStatIcons, &locRect, m_nManaX + SB_RIGHTICON_OFFSET_X, m_nManaY + SB_ICON_OFFSET_Y, m_hTransColor);
		locRect.left = SB_AMMOICON_LOC_X; locRect.right = locRect.left + SB_STATICON_SIZE_X;
		m_pClientDE->DrawSurfaceToSurfaceTransparent(hScreen, m_hStatIcons, &locRect, m_nAmmoX + SB_RIGHTICON_OFFSET_X, m_nAmmoY + SB_ICON_OFFSET_Y, m_hTransColor);
	}

	if(m_bStatsOn > 1)
	{
		DrawNumber(m_nHealth, m_nHealthX + SB_LEFTNUM_OFFSET_X, m_nHealthY + SB_NUM_OFFSET_Y);
		DrawNumber(m_nArmor, m_nArmorX + SB_LEFTNUM_OFFSET_X, m_nArmorY + SB_NUM_OFFSET_Y);
//		DrawNumber(m_nMana, m_nManaX + SB_RIGHTNUM_OFFSET_X, m_nManaY + SB_NUM_OFFSET_Y);
		DrawNumber(m_nAmmo, m_nAmmoX + SB_RIGHTNUM_OFFSET_X, m_nAmmoY + SB_NUM_OFFSET_Y);
	}
}

//*************************************************************************
//*****	Function:	DrawItemAndNameTabs(HSURFACE hScreen, DDWORD yPos)
//*****	Details:	Draws the selected item and spell tabs + names at the bottom of the screen
//*************************************************************************

void	CStatusBar::DrawItemTabs(HSURFACE hScreen)
{
/*	DRect	locRect;
	m_pStatCursor->SetDest(hScreen);

	locRect.top = 0;
	locRect.bottom = SB_INVICON_SIZE_Y;

	locRect.left = m_hSelectedItem->locXLeft;
	locRect.right = m_hSelectedItem->locXRight;

	m_pClientDE->DrawSurfaceToSurface(hScreen, m_hItemIcons, &locRect, m_nItemX, m_nItemY);

	locRect.left = m_hSelectedSpell->locXLeft;
	locRect.right = m_hSelectedSpell->locXRight;

	m_pClientDE->DrawSurfaceToSurface(hScreen, m_hSpellIcons, &locRect, m_nSpellX, m_nSpellY);

	if(m_bInventoryOn == 1)		m_pStatCursor->Draw(g_ItemNames[m_hItemList[SB_SELECTED_ITEM]->type]);
	if(m_bInventoryOn == 2)		m_pStatCursor->Draw(g_SpellNames[m_hSpellList[SB_SELECTED_ITEM]->type]);
*/}

//*************************************************************************
//*****	Function:	DrawHighlight(HSURFACE hScreen, char type)
//*****	Details:	Draws the item or spell highlight
//*************************************************************************

void	CStatusBar::DrawHighlight(HSURFACE hScreen, char type)
{
/*	DRect	locRect;
	locRect.top = 0;
	locRect.bottom = SB_HIGHLIGHT_SIZE_Y;
	locRect.left = SB_HIGHLIGHT_SIZE_X * m_nHighlightFrame;
	locRect.right = locRect.left + SB_HIGHLIGHT_SIZE_X;

	if(type)
		m_pClientDE->DrawSurfaceToSurfaceTransparent(hScreen, m_hSpellLight, &locRect, m_nSpellX + SB_HIGHLIGHT_OFFSET_X, m_nInventoryY + SB_HIGHLIGHT_OFFSET_Y - SB_INVICON_SIZE_Y, m_hTransColor);
	else
		m_pClientDE->DrawSurfaceToSurfaceTransparent(hScreen, m_hItemLight, &locRect, m_nItemX + SB_HIGHLIGHT_OFFSET_X, m_nInventoryY + SB_HIGHLIGHT_OFFSET_Y - SB_INVICON_SIZE_Y, m_hTransColor);

	if(m_nHighlightFrame < SB_NUM_HIGHLIGHTS)
		m_nHighlightFrame++;
	else
		m_nHighlightFrame = 0;
*/}

//*************************************************************************
//*****	Function:	DrawKeyTabs()
//*****	Details:	Draws the key tabs at the left of the screen
//*************************************************************************

void	CStatusBar::DrawKeyTabs(HSURFACE hScreen)
{
	CKeyTab		*key = m_hFirstKey.next;
	DFLOAT		currentTime = m_pClientDE->GetTime();
	DFLOAT		dif, ratio;
	DRect	locRect;

	locRect.left = 0;
	locRect.right = SB_KEYTAB_SIZE_X;

	// Start drawing the key tabs
	while(key->next)
	{
		locRect.top = key->locYTop;
		locRect.bottom = key->locYBottom;

		switch(key->direction)
		{
			case	1:
				dif = currentTime - key->startTime;
				if(dif > SB_KEYTAB_TIME)	{	ratio = 0.0; key->direction = 0;	}
					else	ratio = (dif / SB_KEYTAB_TIME) - 1.0f;
				key->currentX = (short)(SB_KEYTAB_SIZE_X * ratio);
				break;

			case	2:
				if(key->currentY < key->prev->currentY - SB_KEYTAB_SIZE_Y)	key->currentY += SB_KEYSLIDE_AMOUNT;
					else	key->direction = 0;
				break;
		}

		m_pClientDE->DrawSurfaceToSurface(hScreen, m_hKeyTabs, &locRect, (DDWORD)key->currentX, (DDWORD)key->currentY);
		key = key->next;
	}
}

//*************************************************************************
//*****	Function:	DrawInfoTab()
//*****	Details:	Draws the information tab at the top of the screen
//*************************************************************************

void	CStatusBar::DrawInfoTab(HSURFACE hScreen)
{
	HDECOLOR	white = m_pClientDE->SetupColor1(1.0f, 1.0f, 1.0f, DFALSE);

	m_pInfoCursor->SetFont(m_pStatFont1);
	m_pInfoCursor->SetDest(hScreen);

	if(m_bMultiInfo)
	{
		m_pInfoCursor->SetJustify(CF_JUSTIFY_LEFT);
		m_pInfoCursor->SetLoc(m_nInfoX, m_nInfoY);
		m_pInfoCursor->Draw("< NAME OF LEVEL >"); m_pInfoCursor->NewLine();
		m_pInfoCursor->SetFont(m_pStatFont4);
		m_pInfoCursor->Draw("< PLAYER 1 > = < KILLS > < DEATHS >"); m_pInfoCursor->NewLine();
		m_pInfoCursor->Draw("< PLAYER 2 > = < KILLS > < DEATHS >"); m_pInfoCursor->NewLine();
		m_pInfoCursor->Draw("< PLAYER 3 > = < KILLS > < DEATHS >"); m_pInfoCursor->NewLine();
		m_pInfoCursor->Draw("< PLAYER 4 > = < KILLS > < DEATHS >"); m_pInfoCursor->NewLine();
		m_pInfoCursor->Draw("< HUMILIATIONS > = < YOU > < THEM >");
	}
	else
	{
		m_pInfoCursor->SetJustify(CF_JUSTIFY_CENTER);
		m_pInfoCursor->SetLoc((short)(m_nScreenWidth >> 1), (short)(m_nScreenHeight >> 1) - 140);
		m_pInfoCursor->Draw("< INSERT LEVEL NAME HERE >"); m_pInfoCursor->NewLine();
		m_pInfoCursor->SetFont(m_pStatFont4);
		m_pInfoCursor->DrawSolid("< OBJECTIVE 1 > = KILL EVERYTHING YOU CAN!", white); m_pInfoCursor->NewLine();
		m_pInfoCursor->DrawSolid("< OBJECTIVE 2 > = KILL MORE STUFF!", white); m_pInfoCursor->NewLine();
		m_pInfoCursor->DrawSolid("< OBJECTIVE 3 > = INSERT YOUR OWN OBJECTIVE HERE...", white); m_pInfoCursor->NewLine();
		m_pInfoCursor->DrawSolid("< OBJECTIVE 4 > = DUNNO... JUST KILL SOMTHIN'!", white); m_pInfoCursor->NewLine();
		m_pInfoCursor->DrawSolid("< KILLS > = < TOTAL > < THIS LEVEL >", white);
	}
}

//*************************************************************************
//*****	Function:	DrawEquipTab()
//*****	Details:	Draws the information tab at the top of the screen
//*************************************************************************

void	CStatusBar::DrawEquipTab(HSURFACE hScreen)
{
	char	*string, i, j = m_bTopEquipItem + SB_NUM_EQUIP_DISP_ITEMS;
	short	x, y;

	if(j > SB_NUM_EQUIP_ITEMS)	j = SB_NUM_EQUIP_ITEMS;

	m_pEquipCursor->SetDest(hScreen);
	m_pEquipCursor->SetLoc((short)(m_nEquipX + SB_EQUIP_OFFSET_X), (short)(m_nEquipY + SB_EQUIP_OFFSET_Y));
	m_pClientDE->DrawSurfaceToSurface(hScreen, m_hEquipTab, 0, m_nEquipX, m_nEquipY);

	for(i = m_bTopEquipItem; i < j; i++)
	{
		switch(m_pEquipList[i].type)
		{
			case	0:	string = g_EquipTitles[m_pEquipList[i].name];	break;
			case	1:	string = g_WeaponNames[m_pEquipList[i].name];	break;
			case	2:
			case	3:	string = g_ItemNames[m_pEquipList[i].name];		break;
			case	4:	string = g_SpellNames[m_pEquipList[i].name];	break;
		}

		if(m_bSelectedEquipItem == i)
		{
			m_pEquipCursor->GetLoc(x, y);
			m_pClientDE->DrawSurfaceToSurfaceTransparent(hScreen, m_hEquipCursor, 0, x, y, m_hTransColor);

			m_pEquipCursor->SetFont(m_pStatFont3);
			m_pEquipCursor->Draw(string, m_pEquipList[i].offset, 0);
			m_pEquipCursor->SetFont(m_pStatFont2);
		}
		else
			m_pEquipCursor->Draw(string, m_pEquipList[i].offset, 0);

		m_pEquipCursor->NewLine();
	}
}

//*************************************************************************
//*****	Function:	DrawSpellbook(HSURFACE hScreen)
//*****	Details:	Draw the spellbook interface
//*************************************************************************

void	CStatusBar::DrawSpellbook(HSURFACE hScreen)
{
	short	i;
	DRect	rect;

	m_pSpellCursor->SetDest(hScreen);
	m_pClientDE->DrawSurfaceToSurface(hScreen, m_hSpellBG, 0, 0, 0);

	rect.left = 0;
	rect.right = SB_SPELLNAME_SIZE_X;

	for(i = 0; i <= SB_NUM_SINGLEPLAYER_SPELLS; i++)
	{
		if(m_bSpellLevel < g_SpellLevel[g_SpellNameFix[i]])
		{
			rect.top = g_SpellNameYOffsets[i];
			rect.bottom = g_SpellNameYOffsets[i+1];
			m_pClientDE->DrawSurfaceToSurfaceTransparent(hScreen, m_hSpellsLo, &rect, SB_SPELLNAME_LOC_X, g_SpellNameYLocs[i], m_hTransColor);
		}
		else if(i == m_bCurrentSpell)
		{
			rect.top = g_SpellNameYOffsets[i];
			rect.bottom = g_SpellNameYOffsets[i+1];
			m_pClientDE->DrawSurfaceToSurfaceTransparent(hScreen, m_hSpellsHi, &rect, SB_SPELLNAME_LOC_X, g_SpellNameYLocs[i], m_hTransColor);
		}

		if(m_pCurrentSpells[g_SpellNameFix[i]])
			m_pClientDE->DrawSurfaceToSurfaceTransparent(hScreen, m_hSpellDot, 0, SB_SPELLDOT_LOC_X, g_SpellDotYLocs[i], m_hTransColor);
	}

	rect.right = SB_SYMBOL_SIZE;
	rect.top = SB_SYMBOL_SIZE * m_bCurrentSpell;
	rect.bottom = rect.top + SB_SYMBOL_SIZE;

	m_pClientDE->DrawSurfaceToSurface(hScreen, m_hSpellSymbols, &rect, SB_SYMBOL_LOC_X, SB_SYMBOL_LOC_Y);
	m_pClientDE->DrawSurfaceToSurfaceTransparent(hScreen, m_hSpellCursor, 0, 0, g_SpellCursorYLocs[m_bCurrentSpell] - 7, m_hTransColor);

	m_pSpellCursor->SetLoc(SB_SYMBOL_LOC_X + SB_SYMBOL_SIZE, SB_SYMBOL_LOC_Y);
	m_pSpellCursor->SetFont(m_pSpellFont2);
	m_pSpellCursor->NewLine();
	m_pSpellCursor->NewLine();
	m_pSpellCursor->DrawFormat(g_SpellRequires[m_bCurrentSpell], 0);

	m_pSpellCursor->SetLoc(SB_SYMBOL_LOC_X, SB_SYMBOL_LOC_Y + SB_SYMBOL_SIZE);
	m_pSpellCursor->SetFont(m_pSpellFont2);
	m_pSpellCursor->NewLine();
	m_pSpellCursor->DrawFormat(g_SpellInfo[m_bCurrentSpell], m_nSpellTextWidth);
}

//*************************************************************************
//*****	Function:	DrawCharacterScreen(HSURFACE hScreen)
//*****	Details:	Draw the character creation interface
//*************************************************************************

void	CStatusBar::DrawCharacterScreen(HSURFACE hScreen)
{
	short	i;
	char	type, **list;
	char	str = m_pCSFieldList[0].num2, foc = m_pCSFieldList[3].num2;

	for(i = 4; i < 7; i++)
	{
		if(m_pCSFieldList[i].name == POWERUP_STRENGTHBINDING)	str++;
		if(m_pCSFieldList[i].name == POWERUP_MAGICBINDING)		foc++;
	}

	//**********  SETUP ALL OF THE TEXT COLORS  **********
	HDECOLOR red = m_pClientDE->SetupColor1(1.0f, 0.0f, 0.0f, DFALSE);
	HDECOLOR green = m_pClientDE->SetupColor1(0.0f, 1.0f, 0.0f, DFALSE);
	HDECOLOR blue = m_pClientDE->SetupColor1(0.0f, 0.0f, 1.0f, DFALSE);
	HDECOLOR yellow = m_pClientDE->SetupColor1(1.0f, 1.0f, 0.0f, DFALSE);
	HDECOLOR grey = m_pClientDE->SetupColor1(0.3f, 0.3f, 0.3f, DFALSE);
	HDECOLOR white = m_pClientDE->SetupColor1(1.0f, 1.0f, 1.0f, DFALSE);

	m_pCharCursor->SetDest(hScreen);

	//**********  DRAW THE BOXES  ***********
	for(i = 0; i < SB_NUM_CSBOXES; i++)
		m_pClientDE->DrawSurfaceToSurface(hScreen, m_hCharFields, &(m_rCSFields[m_pCSBoxes[i].box]), m_pCSBoxes[i].x, m_pCSBoxes[i].y);

	//**********  DRAW THE EXTRA POINTS  ************
	m_pCharCursor->SetJustify(m_cfExtraPoints.justify);
	m_pCharCursor->SetLoc(m_pCSBoxes[0].x + m_cfExtraPoints.x, m_pCSBoxes[0].y + m_cfExtraPoints.y);
	m_pCharCursor->DrawSolid("Extra Points\0", red);
	m_pCharCursor->DrawSolid(g_CharScreenValues[m_cfExtraPoints.num1], SB_CHARNUM1_OFFSET_X, 0, blue);

	if(m_cfExtraPoints.num2 == m_cfExtraPoints.num1)
		m_pCharCursor->DrawSolid(g_CharScreenValues[m_cfExtraPoints.num2], SB_CHARNUM2_OFFSET_X, 0, blue);
	else if(m_cfExtraPoints.num2 > m_cfExtraPoints.num1)
		m_pCharCursor->DrawSolid(g_CharScreenValues[m_cfExtraPoints.num2], SB_CHARNUM2_OFFSET_X, 0, yellow);
	else
		m_pCharCursor->DrawSolid(g_CharScreenValues[m_cfExtraPoints.num2], SB_CHARNUM2_OFFSET_X, 0, red);

	//**********  START DRAWING THE FIELD NAMES  ***********
	for(i = 0; i < SB_NUM_CSFIELDS; i++)
	{
		type = m_pCSFieldList[i].type;
		list = m_pCSBoxes[type].list;

		m_pCharCursor->SetJustify(m_pCSFieldList[i].justify);
		m_pCharCursor

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -