-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathZScreenEffectManager.cpp
More file actions
212 lines (172 loc) · 5.47 KB
/
Copy pathZScreenEffectManager.cpp
File metadata and controls
212 lines (172 loc) · 5.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
bool ZBossGaugeEffect::Draw(unsigned long int nTime, MDrawContext* pDC)
{
MFont* pFont = ZGetCombatInterface()->GetGameFont();
MUID uidBoss = MUID(0, 0);
if (ZGetGame()->GetMatch()->IsQuestDrived())
{
uidBoss = ZGetQuest()->GetGameInfo()->GetBoss();
}
else if(ZGetGame()->GetMatch()->GetMatchType() == MMATCH_GAMETYPE_QUEST_CHALLENGE)
{
uidBoss = ((ZRuleQuestChallenge*)ZGetGame()->GetMatch()->GetRule())->GetBoss();
}
if (uidBoss == MUID(0,0)) return true;
const float fShockDuration= 0.5f;
const rvector ShockOffset=rvector(0,0,0);
const rvector ShockVelocity=rvector(0,0,0);
rvector offset = rvector(0.0f, 0.0f, 0.0f);
float fElapsed = ZGetGame()->GetTime() - m_fLastTime;
if (m_bShocked)
{
float fA=RandomNumber(0.0f, 1.0f)*2*pi;
float fB=RandomNumber(0.0f, 1.0f)*2*pi;
rvector velocity=rvector(cos(fA)*cos(fB), sin(fA)*sin(fB), 0.0f);
float fPower=(ZGetGame()->GetTime() - m_fShockStartTime) / fShockDuration;
if(fPower>1.f)
{
m_bShocked=false;
}
else
{
fPower=1.f-fPower;
fPower=pow(fPower,1.5f);
m_ShockVelocity = (RandomNumber(0.0f, 1.0f) * m_fShockPower * velocity);
m_ShockOffset += fElapsed * m_ShockVelocity;
offset = fPower * m_ShockOffset;
#ifdef DEBUG
char text[256];
sprintf(text, "%.3f, %.3f\n", offset.x, offset.y);
OutputDebugString(text);
#endif
}
}
m_fLastTime = ZGetGame()->GetTime();
offset.z = 0.0f;
bool ret = ZScreenEffect::DrawCustom(0, offset);
// HP Gauge
ZObject* pBoss = ZGetObjectManager()->GetObject(uidBoss);
if ((pBoss) && (pBoss->IsNPC()))
{
ZActorBase* pBossActor = (ZActorBase*)pBoss;
// In cases where the boss dies with AP remaining and HP becoming 0, AP is not drawn at all.
int nMax = pBossActor->GetActualMaxHP()/* + pBossActor->GetActualMaxAP()*/;
int nCurr = min(pBossActor->GetActualHP()/* + pBossActor->GetAP()*/, nMax);
if ((m_nVisualValue < 0) || (m_nVisualValue > nCurr) || (nCurr - m_nVisualValue > 100))
{
m_nVisualValue = nCurr;
}
if (m_nVisualValue > 0)
{
char szText[256];
float nHP = pBossActor->GetActualHP() + pBossActor->GetActualAP();
float nMaxHP = pBossActor->GetActualMaxHP() + pBossActor->GetActualMaxAP();
float percentage = nHP / nMaxHP;
const int width = 433+1;
const int height = 12;
int x = (800 - width) * 0.5f;
int y = 600 * 0.028f;
float fGaugeWidth = width * (m_nVisualValue / (float)nMax);
DWORD color = D3DCOLOR_ARGB(255, 0xBB, 0, 0);
RGetDevice()->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE);
RGetDevice()->SetTexture(0, NULL);
float fx = 183.0f / 800.0f/* + offset.x / 980.0f*/;
float fy = 574.0f / 600.0f/* - offset.y / 720.0f*/;
float posX = 540.0f / 800.f * (float)MGetWorkspaceWidth();
float posY = 560.0f / 600.f * (float)MGetWorkspaceHeight();
sprintf(szText, "BOSS: %.1f%%", percentage * 100.0f);
DrawGauge(fx, fy, fGaugeWidth / 800.0f, 7.0f / 600.0f, 0.0f, color);
pDC->SetColor(MCOLOR(0xFFFFFFFF));
pDC->SetFont(pFont);
pDC->Text(posX, posY, szText);
}
}
return ret;
}
void ZScreenEffectManager::Draw(MDrawContext* pDC)
{
ZCharacter *pTargetCharacter = ZGetGameInterface()->GetCombatInterface()->GetTargetCharacter();
if (!pTargetCharacter || !pTargetCharacter->GetInitialized()) return;
if (!ZGetCombatInterface()->GetObserverMode() && !ZGetCombatInterface()->IsSkupUIDraw())
{
RGetDevice()->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
RGetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
if (pTargetCharacter)
{
ZItem* pSelectedItem = pTargetCharacter->GetItems()->GetSelectedWeapon();
if (pSelectedItem) {
if (pSelectedItem->GetItemType() != MMIT_MELEE) {
if (pSelectedItem->GetBulletCurrMagazine() <= 0) {
if (pSelectedItem->isReloadable() == false) {
m_bShowReload = false;
m_bShowEmpty = true;
}
else {
m_bShowReload = true;
m_bShowEmpty = false;
}
}
else {
m_bShowReload = false;
m_bShowEmpty = false;
}
}
else {
m_bShowReload = false;
m_bShowEmpty = false;
}
}
}
if (m_bShowReload) {
if (m_pReload)
{
m_pReload->Update();
m_pReload->Draw(0);
}
}
else if (m_bShowEmpty) {
if (m_pEmpty)
{
m_pEmpty->Update();
m_pEmpty->Draw(0);
}
}
}
LPDIRECT3DDEVICE9 pLPDIRECT3DDEVICE9 = RGetDevice();
pLPDIRECT3DDEVICE9->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
pLPDIRECT3DDEVICE9->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
if (!ZGetGame()->IsReplay() || ZGetGame()->IsShowReplayInfo())
{
if (ZGetCombatInterface()->IsShowUI())
DrawEffects(); // Draw combo animation
// You have to manage the combo effect yourself.
DrawCombo();
}
if (ZGetCombatInterface()->IsShowUI())
{
DrawQuestEffects(pDC); // Quest - K.O - image
DrawDuelEffects();
DrawTDMEffects();
}
}
void ZScreenEffectManager::DrawQuestEffects(MDrawContext* pDC)
{
bool isQuestDerived = ZGetGameTypeManager()->IsQuestDerived(ZGetGameClient()->GetMatchStageSetting()->GetGameType());
bool isNewQuestDerived = ZGetGameTypeManager()->IsNewQuestDerived(ZGetGameClient()->GetMatchStageSetting()->GetGameType());
if (!isNewQuestDerived && !isQuestDerived)
return;
if (m_pBossHPPanel)
{
if(ZGetCombatInterface()->IsShowUI())
m_pBossHPPanel->Draw(0, pDC);
}
// If it's a spec, KO and arrows are not drawn.
if(!ZGetGameInterface()->GetCombatInterface()->GetObserverMode())
{
DrawKO();
if (ZGetQuest()->IsRoundClear())
{
rvector to = ZGetQuest()->GetGameInfo()->GetPortalPos();
DrawArrow(to);
}
}
}