📄 player.cpp
字号:
&& pCommand->iType == _COMMAND_EMOTION
&& pCommand->iStatus == _CMDSTATUS_CONTINUE)
{
nNameShowOffset = this->GetZoomPercent()*OFFSET_NAMESHOW/200;
}
int nShowX =m_Info.posScr.x;//-sizeFont.iWidth*iInfoLen/2;
int nShowY =m_Info.posScr.y- nNameShowOffset - sizeFont.iHeight*2;
if (g_objHero.GetID() == this->GetID())
{
nShowY = m_Info.posScr.y - nNameShowOffset - sizeFont.iHeight*2;
}
if(this->GetRoleType() == _ROLE_BOOTH_NPC)
{
char szTemp[64];
const OBJID idStr = 100124;
sprintf(szTemp, "%s%s", pszString, g_objGameDataSet.GetStr(idStr));
g_objGameMap.MapScaleShowPos(nShowX, nShowY);
nShowX -= sizeFont.iWidth*iInfoLen/2;
{
DWORD dwBkColor = 0;
if (((dwColor&0x00ff0000)>>16) < 0x20
&& ((dwColor&0x00ff00)>>8) < 0x20
&& (dwColor&0x00ff) < 0x20)
dwBkColor = 0xaaaaaa;
CMyPos posShow;
posShow.x = nShowX+1;
posShow.y = nShowY+1-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView(szTemp, posShow, dwBkColor);
posShow.x = nShowX;
posShow.y = nShowY-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView(szTemp, posShow, dwColor);
}
}
else
{
g_objGameMap.MapScaleShowPos(nShowX, nShowY);
{
DWORD dwBkColor = 0;
if (((dwColor&0x00ff0000)>>16) < 0x20
&& ((dwColor&0x00ff00)>>8) < 0x20
&& (dwColor&0x00ff) < 0x20)
dwBkColor = 0xaaaaaa;
nShowX -= sizeFont.iWidth*iInfoLen/2;
if (this->IsPlayer())
{
CMyPos posShow;
posShow.x = nShowX+1;
posShow.y = nShowY+1-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView((char*)pszString, posShow, dwBkColor);
posShow.x = nShowX;
posShow.y = nShowY-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView((char*)pszString, posShow, dwColor);
}
else
{
CMyPos posShow;
posShow.x = nShowX+1;
posShow.y = nShowY+1-this->GetOffsetY()-4;
g_objGameMap.m_InfoViewManager.AddStringView((char*)pszString, posShow, dwBkColor);
posShow.x = nShowX;
posShow.y = nShowY-this->GetOffsetY()-4;
g_objGameMap.m_InfoViewManager.AddStringView((char*)pszString, posShow, dwColor);
}
}
}
}
//////////////////////////////////////////////////////////////////////
void CPlayer::ShowSyndicate (void)
{
if(CRole::GetIDType(this->GetID()) == _PLAYER_ID_SYSNPC && this->GetRoleType() !=_ROLE_STONE_MINE)
{
if(strlen(m_szNpcTitle) > 0)
{
CMySize sizeFont;
sizeFont.iHeight =CMyBitmap::GetFontSize();
sizeFont.iWidth =sizeFont.iHeight/2;
g_objGameMap.World2Screen(m_Info.posWorld.x, m_Info.posWorld.y, m_Info.posScr.x, m_Info.posScr.y);
int nNameShowOffset = this->GetZoomPercent()*OFFSET_NAMESHOW/100;
int nShowX =m_Info.posScr.x;//-sizeFont.iWidth*iInfoLen/2;
int nShowY =m_Info.posScr.y- nNameShowOffset - sizeFont.iHeight*2;
g_objGameMap.MapScaleShowPos(nShowX, nShowY);
nShowX -= sizeFont.iWidth*strlen(m_szNpcTitle)/2;
CMyPos posShow;
int noffset = 6;
posShow.x = nShowX;
posShow.y = nShowY-this->GetOffsetY() - sizeFont.iHeight - noffset;
g_objGameMap.m_InfoViewManager.AddStringView((char*)m_szNpcTitle, posShow, _COLOR_BLACK);
posShow.x = nShowX+1;
posShow.y = nShowY-this->GetOffsetY() - sizeFont.iHeight+1 - noffset;
g_objGameMap.m_InfoViewManager.AddStringView((char*)m_szNpcTitle, posShow, _COLOR_YELLOW);
// CMyBitmap::ShowString(posShow.x, posShow.y, _COLOR_YELLOW, m_szNpcTitle);
}
return;
}
if(this->GetSydicateID() == 0)
return;
CMySize sizeFont;
sizeFont.iHeight =CMyBitmap::GetFontSize();
sizeFont.iWidth =sizeFont.iHeight/2;
int iInfoLen =strlen(this->GetSyndicate());
if (iInfoLen <= 0)
return;
char szSyndicate[256] = "";
sprintf(szSyndicate, "%s", this->GetSyndicate());
char szSyndicateInfo[256] = "";
if (this->GetSyndicateRank() >= RANK_SUBLEADER)
sprintf(szSyndicateInfo, "%s %s", this->GetSyndicate(), this->GetSyndicateTitle());
else
sprintf(szSyndicateInfo, "%s", this->GetSyndicate());
iInfoLen = strlen(szSyndicateInfo);
DWORD dwColor = _COLOR_WHITE;
DWORD dwSyndicateColor;
switch(g_objPlayerSet.GetSyndicateStatus(this->GetSydicateID()) )
{
case SYNDICATE_ALLY:
dwSyndicateColor = _COLOR_GREEN;
break;
case SYNDICATE_ANTAGONIZE:
dwSyndicateColor = _COLOR_RED;
break;
case SYNDICATE_SELF:
dwSyndicateColor = _COLOR_YELLOW;
break;
case _COLOR_WHITE:
dwSyndicateColor = SYNDICATE_NORMAL;
break;
default:
dwSyndicateColor = _COLOR_WHITE;
break;
}
if (g_objHero.GetSydicateID() == ID_NONE)
{
dwSyndicateColor = _COLOR_WHITE;
}
int nNameShowOffset = this->GetZoomPercent()*OFFSET_NAMESHOW/100;
CCommand* pCommand = this->GetCommand();
if (pCommand
&& pCommand->nData == _ACTION_SITDOWN
&& pCommand->iType == _COMMAND_EMOTION
&& pCommand->iStatus == _CMDSTATUS_CONTINUE)
{
nNameShowOffset = this->GetZoomPercent()*OFFSET_NAMESHOW/200;
}
int nShowX =m_Info.posScr.x;//-sizeFont.iWidth*iInfoLen/2;
int nShowY =m_Info.posScr.y-nNameShowOffset - sizeFont.iHeight*2;
g_objGameMap.MapScaleShowPos(nShowX, nShowY);
nShowX -= sizeFont.iWidth*iInfoLen/2;
nShowY += sizeFont.iHeight;
CMyPos posShow;
posShow.x = nShowX+1;
posShow.y = nShowY+1-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView(szSyndicate, posShow, 0x0);
// show syndicate ...
posShow.x = nShowX;
posShow.y = nShowY-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView(szSyndicate, posShow, dwSyndicateColor);
// 总堂,或无堂口
if(strlen(this->GetSubSyndicate()) == 0 && this->GetSyndicateRank() >= RANK_SUBLEADER)
{
// show rank ...
nShowX += (strlen(szSyndicate)) * sizeFont.iWidth;
posShow.x = nShowX+1;
posShow.y = nShowY+1-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView(this->GetSyndicateTitle(), posShow, 0x0);
posShow.x = nShowX;
posShow.y = nShowY-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView(this->GetSyndicateTitle(), posShow, 0x6699ff);
}
// show subsybcidate ...
if(strlen(this->GetSubSyndicate()) != 0)
{
posShow.x = nShowX + strlen(szSyndicate) * sizeFont.iWidth;
posShow.y = nShowY+1-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddAniView("ani/common.ani", "Syndicate", posShow, 0);
// show rank ...
nShowX += (2+strlen(szSyndicate)) * sizeFont.iWidth;
posShow.x = nShowX+1;
posShow.y = nShowY+1-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView(this->GetSubSyndicate(), posShow, 0x0);
posShow.x = nShowX;
posShow.y = nShowY-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView(this->GetSubSyndicate(), posShow, dwSyndicateColor);
}
// show subsybcidate title...
if(strlen(this->GetSubSyndicate()) != 0 && this->GetSyndicateRank() != RANK_NEWBIE)
{
// show rank ...
nShowX += (strlen(this->GetSubSyndicate())) * sizeFont.iWidth;
posShow.x = nShowX+1;
posShow.y = nShowY+1-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView(this->GetSyndicateTitle(), posShow, 0x0);
posShow.x = nShowX;
posShow.y = nShowY-this->GetOffsetY();
g_objGameMap.m_InfoViewManager.AddStringView(this->GetSyndicateTitle(), posShow, 0x6699ff);
}
}
//////////////////////////////////////////////////////////////////////
void CPlayer::ShowInfo(void)
{
if (this->IsNpc())
{
this->ShowName();
this->ShowSyndicate();
return;
}
if(this->GetRoleType() == _ROLE_MOUSE_NPC)
return;
this->ShowName();
this->ShowSyndicate();
// this->ShowKoAmount();
}
//////////////////////////////////////////////////////////////////////
DWORD CPlayer::SetCommand (CCommand* pCommand)
{
if (!pCommand)
return false;
switch(pCommand->iType)
{
case _COMMAND_DIE:
{
// 清掉延时命令
m_setCmdList.clear();
// 清除当前命令
this->ResetActionData();
// 快速执行队列中所有命令
int nCmds = m_infoPlayer.setCmd.size();
for (int i = 0; i < nCmds; i++)
{
CCommand& cmd = m_infoPlayer.setCmd[i];
CRole::SetCommand(&cmd);
CRole::ProcessCommand();
this->ResetActionData();
}
m_infoPlayer.setCmd.clear();
// 设置指令
CRole::SetCommand(pCommand);
}
break;
case _COMMAND_SHITHAPPEN:
case _COMMAND_INTONE:
case _COMMAND_ATTACK:
case _COMMAND_SHOOT:
case _COMMAND_SPATTACK:
case _COMMAND_RUSHATK:
case _COMMAND_LOCKATK:
case _COMMAND_BUMP:
{
// 清掉延时命令
m_setCmdList.clear();
// 快速执行队列中所有命令
int nCmds = m_infoPlayer.setCmd.size();
for (int i = 0; i < nCmds; i++)
{
CCommand& cmd = m_infoPlayer.setCmd[i];
CRole::SetCommand(&cmd);
CRole::ProcessCommand();
this->ResetActionData();
}
m_infoPlayer.setCmd.clear();
// 清除当前动作
this->ResetActionData();
// 设置指令
CRole::SetCommand(pCommand);
}
break;
case _COMMAND_TAKEOFF:
case _COMMAND_LANDING:
case _COMMAND_JUMP:
case _COMMAND_WALK:
case _COMMAND_RUN:
case _COMMAND_WALKFORWARD:
case _COMMAND_RUNFORWARD:
{
// 清除掉所有延时的命令
m_setCmdList.clear();
// 查询序列中的命令, 如果是低优先级别, 则清除掉
int nCmds = m_infoPlayer.setCmd.size();
for (int i = nCmds - 1; i >= 0 ; i--)
{
CONST CCommand& cmd = m_infoPlayer.setCmd[i];
switch (cmd.iType)
{
case _COMMAND_EMOTION:
case _COMMAND_ACTION:
case _COMMAND_STANDBY:
case _COMMAND_POSE:
case _COMMAND_MINE:
case _COMMAND_WOUND:
case _COMMAND_DEFEND:
//case _COMMAND_LOCKBOOTH:
m_infoPlayer.setCmd.erase(m_infoPlayer.setCmd.begin() + i);
break;
default:
break;
}
}
// 查询当前执行的命令, 如果是低优先级别, 则重置
if (this->IsIdle())
this->ResetActionData();
// 加入新的指令
m_infoPlayer.setCmd.push_back(*pCommand);
}
break;
case _COMMAND_ACTION:
{
this->ResetActionData();
// reset cmd in queue
int nCmds = m_infoPlayer.setCmd.size();
for (int i=0; i<nCmds; i++)
{
CCommand cmd = m_infoPlayer.setCmd[i];
CRole::SetCommand(&cmd);
CRole::ProcessCommand();
this->ResetActionData();
}
m_infoPlayer.setCmd.clear();
m_setCmdList.clear();
// set command now
return CRole::SetCommand(pCommand);
}
break;
default:
m_infoPlayer.setCmd.push_back(*pCommand);
break;
}
return TRUE;
/*
switch(pCommand->iType)
{
case _COMMAND_POSE:
case _COMMAND_EMOTION:
case _COMMAND_ACTION:
case _COMMAND_INTONE:
case _COMMAND_DIE:
case _COMMAND_JUMP:
{
// reset cur cmd first
this->ResetActionData();
// reset cmd in queue
int nCmds = m_infoPlayer.setCmd.size();
for (int i=0; i<nCmds; i++)
{
CCommand cmd = m_infoPlayer.setCmd[i];
CRole::SetCommand(&cmd);
CRole::ProcessCommand();
this->ResetActionData();
}
m_infoPlayer.setCmd.clear();
m_setCmdList.clear();
// set command now
return CRole::SetCommand(pCommand);
}
break;
default:
{
m_dwCommandIndex++;
pCommand->dwIndex = m_dwCommandIndex;
m_infoPlayer.setCmd.push_back(*pCommand);
return m_dwCommandIndex;
}
break;
}
return 0;*/
}
//////////////////////////////////////////////////////////////////////
void CPlayer::SynTrack(BOOL bMove)
{
if(!bMove)
{
if(m_setLife.size() > 0)
{
int nLife = m_setLife.front();
m_setLife.erase(m_setLife.begin());
this->AddZoomNum(nLife, 0xff0000ff, 300, 30);
int nRealLife = (int)this->GetData(CPlayer::_PLAYER_LIFE)-nLife;
this->SetData(CPlayer::_PLAYER_LIFE, __max(0, nRealLife));
this->SetActionCmd(_ACTION_BRUISE0);
}
return;
}
if(this->IsDead())
{
this->ResetActionData();
// reset cmd in queue
int nCmds = m_infoPlayer.setCmd.size();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -