Mercurial > mm7
annotate GUI/UI/UIPopup.cpp @ 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
author | a.parshin |
---|---|
date | Wed, 09 Mar 2016 01:39:52 +0200 |
parents | dd36326a9994 |
children |
rev | line source |
---|---|
2501 | 1 #define _CRTDBG_MAP_ALLOC |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
2501 | 3 #include <stdlib.h> |
4 #include <crtdbg.h> | |
5 | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
6 #include "Engine/Engine.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
7 #include "Engine/Graphics/Sprites.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
8 #include "Engine/Graphics/Vis.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
9 #include "Engine/Party.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
10 #include "Engine/LOD.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
11 #include "Engine/Objects/Actor.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
12 #include "Engine/Graphics/Viewport.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
13 #include "Engine/Objects/SpriteObject.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
14 #include "Engine/Objects/ObjectList.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
15 #include "Engine/Objects/Chest.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
16 #include "Engine/Graphics/PaletteManager.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
17 #include "Engine/Timer.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
18 #include "Engine/texts.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
19 #include "Engine/Events.h" |
2541 | 20 |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
21 #include "IO/Mouse.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
22 |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
23 #include "GUI/UI/Books/MapBook.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
24 #include "GUI/GUIFont.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
25 |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
26 #include "Media/Audio/AudioPlayer.h" |
2541 | 27 |
2501 | 28 #include "UIPopup.h" |
29 #include "UIShops.h" | |
30 | |
31 static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually | |
32 | |
33 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
34 struct Image *parchment = nullptr; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
35 struct Image *messagebox_corner_x = nullptr; // 5076AC |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
36 struct Image *messagebox_corner_y = nullptr; // 5076B4 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
37 struct Image *messagebox_corner_z = nullptr; // 5076A8 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
38 struct Image *messagebox_corner_w = nullptr; // 5076B0 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
39 struct Image *messagebox_border_top = nullptr; // 507698 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
40 struct Image *messagebox_border_bottom = nullptr; // 5076A4 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
41 struct Image *messagebox_border_left = nullptr; // 50769C |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
42 struct Image *messagebox_border_right = nullptr; // 5076A0 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
43 |
2501 | 44 //----- (004179BC) -------------------------------------------------------- |
45 void CharacterUI_DrawTooltip(const char *Title, const char *content) | |
46 { | |
47 GUIWindow popup_window; // [sp+Ch] [bp-5Ch]@1 | |
48 POINT v6; // [sp+60h] [bp-8h]@1 | |
49 | |
50 memset(&popup_window, 0, 0x54u); | |
51 popup_window.uFrameWidth = 384; | |
52 popup_window.uFrameHeight = 256; | |
53 popup_window.uFrameX = 128; | |
54 popup_window.uFrameY = pMouse->GetCursorPos(&v6)->y + 30; | |
55 popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(content, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; | |
56 popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; | |
57 popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; | |
58 popup_window.DrawMessageBox(0); | |
59 | |
60 popup_window.uFrameX += 12; | |
61 popup_window.uFrameWidth -= 24; | |
62 popup_window.uFrameY += 12; | |
63 popup_window.uFrameHeight -= 12; | |
64 popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; | |
65 popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; | |
66 sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", ui_character_tooltip_header_default_color, Title); | |
67 popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); | |
2556 | 68 popup_window.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, content, 0, popup_window.uFrameY + popup_window.uFrameHeight, 0); |
2501 | 69 } |
70 | |
71 //----- (004151D9) -------------------------------------------------------- | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
72 void DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight) |
2501 | 73 { |
74 unsigned int uNumTiles; // [sp+2Ch] [bp-Ch]@6 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
75 int coord_x; // [sp+2Ch] [bp-Ch]@3 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
76 int coord_y; // [sp+34h] [bp-4h]@5 |
2501 | 77 |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
78 if (!parchment) |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
79 return; |
2524 | 80 |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
81 |
2524 | 82 pRenderer->SetUIClipRect(uX, uY, uX + uWidth, uY + uHeight); |
83 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
84 unsigned int parchment_width = parchment->GetWidth(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
85 unsigned int parchment_height = parchment->GetHeight(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
86 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
87 uNumTiles = uWidth / parchment_width; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
88 if ( uWidth % parchment_width) |
2501 | 89 ++uNumTiles; |
90 coord_y = uY; | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
91 for ( uint j = 0; j <= uHeight / parchment_height; j++ ) |
2501 | 92 { |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
93 coord_x = uX - parchment_width; |
2501 | 94 for ( uint i = uNumTiles + 1; i; --i ) |
95 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
96 coord_x += parchment_width; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
97 pRenderer->DrawTextureNew(coord_x / 640.0f, coord_y / 480.0f, parchment); |
2501 | 98 } |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
99 coord_y += parchment_height; |
2501 | 100 } |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
101 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
102 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
103 pRenderer->DrawTextureAlphaNew( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
104 uX / 640.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
105 uY / 480.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
106 messagebox_corner_x |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
107 ); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
108 pRenderer->DrawTextureAlphaNew( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
109 uX / 640.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
110 (uY + uHeight - messagebox_corner_y->GetHeight()) / 480.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
111 messagebox_corner_y |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
112 ); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
113 pRenderer->DrawTextureAlphaNew( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
114 (uX + uWidth - messagebox_corner_z->GetWidth()) / 640.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
115 uY / 480.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
116 messagebox_corner_z |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
117 ); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
118 pRenderer->DrawTextureAlphaNew( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
119 (uX + uWidth - messagebox_corner_z->GetWidth()) / 640.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
120 (uY + uHeight - messagebox_corner_y->GetHeight()) / 480.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
121 messagebox_corner_w |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
122 ); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
123 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
124 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
125 if (uWidth > messagebox_corner_x->GetWidth() + messagebox_corner_z->GetWidth()) |
2501 | 126 { |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
127 pRenderer->SetUIClipRect( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
128 uX + messagebox_corner_x->GetWidth(), |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
129 uY, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
130 uX + uWidth - messagebox_corner_z->GetWidth(), |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
131 uY + uHeight |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
132 ); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
133 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
134 // horizontal borders |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
135 for ( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
136 unsigned int x = uX + messagebox_corner_x->GetWidth(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
137 x < uX + uWidth - messagebox_corner_x->GetWidth(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
138 x += messagebox_border_top->GetWidth() |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
139 ) |
2501 | 140 { |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
141 pRenderer->DrawTextureAlphaNew( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
142 x / 640.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
143 uY / 480.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
144 messagebox_border_top |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
145 ); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
146 pRenderer->DrawTextureAlphaNew( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
147 x / 640.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
148 (uY + uHeight - messagebox_border_bottom->GetHeight()) / 480.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
149 messagebox_border_bottom |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
150 ); |
2501 | 151 } |
152 } | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
153 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
154 // vertical borders |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
155 if ( uHeight > messagebox_corner_x->GetHeight() + messagebox_corner_y->GetHeight()) |
2501 | 156 { |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
157 pRenderer->SetUIClipRect( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
158 uX, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
159 uY + messagebox_corner_x->GetHeight(), |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
160 uX + uWidth, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
161 uY + uHeight - messagebox_corner_y->GetHeight() |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
162 ); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
163 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
164 for ( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
165 unsigned int y = uY + messagebox_corner_x->GetHeight(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
166 y < uY + uHeight - messagebox_corner_y->GetHeight(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
167 y += messagebox_border_top->GetHeight() |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
168 ) |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
169 { |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
170 pRenderer->DrawTextureAlphaNew( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
171 uX / 640.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
172 y / 480.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
173 messagebox_border_left |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
174 ); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
175 pRenderer->DrawTextureAlphaNew( |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
176 (uX + uWidth - messagebox_border_right->GetWidth() - 1) / 640.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
177 y / 480.0f, |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
178 messagebox_border_right |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
179 ); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2567
diff
changeset
|
180 } |
2501 | 181 } |
2524 | 182 pRenderer->ResetUIClipRect(); |
2501 | 183 } |
184 | |
185 //----- (0041D895) -------------------------------------------------------- | |
186 void GameUI_DrawItemInfo( struct ItemGen* inspect_item ) | |
187 { | |
188 unsigned int v2; // eax@3 | |
189 const char *v28; // edi@69 | |
190 int v34; // esi@81 | |
191 const char *pText; // [sp-14h] [bp-28Ch]@110 | |
192 char out_text[300]; // [sp+8h] [bp-270h]@40 | |
193 char v65[120]; // [sp+134h] [bp-144h]@92 | |
194 stru351_summoned_item v67; | |
195 int v77; // [sp+200h] [bp-78h]@12 | |
196 int v78; // [sp+204h] [bp-74h]@5 | |
197 GUIWindow iteminfo_window; // [sp+208h] [bp-70h]@2 | |
198 POINT a2; // [sp+25Ch] [bp-1Ch]@2 | |
199 int v81; // [sp+264h] [bp-14h]@5 | |
200 PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18 | |
201 char* v84; | |
202 int v85; | |
203 char *Str; // [sp+270h] [bp-8h]@65 | |
204 | |
205 int r_mask = 0xF800; | |
206 int g_mask = 0x7E0; | |
207 int b_mask = 0x1F; | |
208 | |
209 if (!inspect_item->uItemID) | |
210 return; | |
2575 | 211 |
212 auto inspect_item_image = assets->GetImage_16BitColorKey(inspect_item->GetIconName(), 0x7FF); | |
213 | |
2501 | 214 iteminfo_window.Hint = nullptr; |
215 iteminfo_window.uFrameWidth = 384; | |
216 iteminfo_window.uFrameHeight = 180; | |
217 iteminfo_window.uFrameY = 40; | |
218 if ( pMouse->GetCursorPos(&a2)->x <= 320 ) | |
219 v2 = pMouse->GetCursorPos(&a2)->x + 30; | |
220 else | |
221 v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30; | |
222 iteminfo_window.uFrameX = v2; | |
2575 | 223 v78 = 100 - inspect_item_image->GetWidth(); |
224 v81 = 144 - inspect_item_image->GetHeight(); | |
2501 | 225 if ( v78 > 0 ) |
226 v78 = v78 / 2; | |
227 if ( v81 <= 0 ) | |
228 v81 = 0; | |
229 else | |
230 v81 = v81 / 2; | |
231 if ( !pItemsTable->pItems[inspect_item->uItemID].uItemID_Rep_St ) | |
232 inspect_item->SetIdentified(); | |
233 v77 = 0; | |
234 if (inspect_item->GetItemEquipType() == EQUIP_GOLD) | |
2567 | 235 v77 = inspect_item->special_enchantment; |
2501 | 236 if ( uActiveCharacter ) |
237 { | |
238 //try to identify | |
239 if (!inspect_item->IsIdentified()) | |
240 { | |
241 if ( pPlayers[uActiveCharacter]->CanIdentify(inspect_item) == 1 ) | |
242 inspect_item->SetIdentified(); | |
243 v83 = SPEECH_9; | |
244 if ( !inspect_item->IsIdentified() ) | |
245 ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2);//"Identify Failed" | |
246 else | |
247 { | |
248 v83 = SPEECH_8; | |
249 if ( inspect_item->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) ) | |
250 v83 = SPEECH_7; | |
251 } | |
252 if ( dword_4E455C ) | |
253 { | |
254 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0); | |
255 dword_4E455C = 0; | |
256 } | |
257 } | |
258 inspect_item->UpdateTempBonus(pParty->uTimePlayed); | |
259 if (inspect_item->IsBroken()) | |
260 { | |
261 if ( pPlayers[uActiveCharacter]->CanRepair(inspect_item) == 1 ) | |
262 inspect_item->uAttributes = inspect_item->uAttributes & 0xFFFFFFFD | 1; | |
263 v83 = SPEECH_11; | |
264 if ( !inspect_item->IsBroken() ) | |
265 v83 = SPEECH_10; | |
266 else | |
267 ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2);//"Repair Failed" | |
268 if ( dword_4E455C ) | |
269 { | |
270 pPlayers[uActiveCharacter]->PlaySound(v83, 0); | |
271 dword_4E455C = 0; | |
272 } | |
273 } | |
274 } | |
275 if (inspect_item->IsBroken()) | |
276 { | |
277 iteminfo_window.DrawMessageBox(0); | |
2524 | 278 pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, |
2501 | 279 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, |
280 iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); | |
281 iteminfo_window.uFrameWidth -= 24; | |
282 iteminfo_window.uFrameHeight -= 12; | |
283 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; | |
284 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; | |
2574 | 285 |
286 pRenderer->DrawTransparentRedShade( | |
287 (iteminfo_window.uFrameX + v78) / 640.0f, | |
288 (v81 + iteminfo_window.uFrameY + 30) / 480.0f, | |
289 //pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); | |
2575 | 290 inspect_item_image); |
2501 | 291 if ( inspect_item->IsIdentified()) |
292 pText = (char *)inspect_item->GetIdentifiedName(); | |
293 else | |
294 pText = pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName; | |
295 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pText, 3); | |
296 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2, | |
297 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item" | |
2524 | 298 pRenderer->ResetUIClipRect(); |
2575 | 299 |
300 if (inspect_item_image) | |
2501 | 301 { |
2575 | 302 inspect_item_image->Release(); |
303 inspect_item_image = nullptr; | |
2501 | 304 } |
2575 | 305 |
2501 | 306 return; |
307 } | |
308 if (!inspect_item->IsIdentified()) | |
309 { | |
310 iteminfo_window.DrawMessageBox(0); | |
2524 | 311 pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, |
2501 | 312 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); |
313 iteminfo_window.uFrameWidth -= 24; | |
314 iteminfo_window.uFrameHeight -= 12; | |
315 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; | |
316 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; | |
2575 | 317 pRenderer->DrawTextureAlphaNew( |
318 (iteminfo_window.uFrameX + v78)/640.0f, | |
319 (v81 + iteminfo_window.uFrameY + 30)/480.0f, | |
320 inspect_item_image); | |
2501 | 321 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3); |
322 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2, | |
323 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified" | |
2524 | 324 pRenderer->ResetUIClipRect(); |
2575 | 325 |
326 if (inspect_item_image) | |
2501 | 327 { |
2575 | 328 inspect_item_image->Release(); |
329 inspect_item_image = nullptr; | |
2501 | 330 } |
331 return; | |
332 } | |
333 sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName); //"Type: %s" | |
334 out_text[100] = 0; | |
335 out_text[200] = 0; | |
336 switch (inspect_item->GetItemEquipType()) | |
337 { | |
338 case EQUIP_SINGLE_HANDED: | |
339 case EQUIP_TWO_HANDED: | |
340 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK], | |
341 (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], | |
342 (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); //"Damage" | |
343 if (inspect_item->GetDamageMod()) | |
344 { | |
345 char mod[16]; | |
346 sprintf(mod, "+%d", (int)inspect_item->GetDamageMod()); | |
347 strcat(out_text + 100, mod); | |
348 } | |
349 break; | |
350 | |
351 case EQUIP_BOW: | |
352 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot" | |
353 (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], //"Damage" | |
354 (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); | |
355 if (inspect_item->GetDamageMod()) | |
356 { | |
357 char mod[16]; | |
358 sprintf(mod, "+%d", (int)inspect_item->GetDamageMod()); | |
359 strcat(out_text + 100, mod); | |
360 } | |
361 break; | |
362 | |
363 case EQUIP_ARMOUR: | |
364 case EQUIP_SHIELD: | |
365 case EQUIP_HELMET: | |
366 case EQUIP_BELT: | |
367 case EQUIP_CLOAK: | |
368 case EQUIP_GAUNTLETS: | |
369 case EQUIP_BOOTS: | |
370 case EQUIP_RING: | |
371 case EQUIP_AMULET: | |
372 if (inspect_item->GetDamageDice()) //"Armor" | |
373 sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], | |
374 inspect_item->GetDamageDice() + inspect_item->GetDamageMod()); | |
375 break; | |
376 } | |
377 | |
378 if ( !v77 ) | |
379 { | |
380 if (inspect_item->GetItemEquipType() ==EQUIP_POTION) //this is CORRECT! do not move to switch! | |
381 { | |
382 if ( inspect_item->uEnchantmentType ) | |
383 sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power" | |
384 } | |
385 else if (inspect_item->GetItemEquipType() == EQUIP_REAGENT) | |
386 sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], inspect_item->GetDamageDice()); //"Power" | |
387 else if ( inspect_item->uEnchantmentType ) | |
388 sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->m_enchantmentStrength); //"Special" | |
2567 | 389 else if ( inspect_item->special_enchantment ) |
390 sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], pItemsTable->pSpecialEnchantments[inspect_item->special_enchantment-1].pBonusStatement); | |
2501 | 391 else if ( inspect_item->uNumCharges ) |
392 sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges" | |
393 } | |
394 iteminfo_window.uFrameWidth -= 12; | |
395 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; | |
396 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; | |
397 Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8)); | |
398 v84 = &out_text[0]; | |
399 for ( uint i = 1; i <= 3; i++ ) | |
400 { | |
401 if ( *v84 ) | |
402 Str += pFontComic->CalcTextHeight(v84, &iteminfo_window, 100, 0) + 3; | |
403 v84 += 100; | |
404 } | |
405 v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription; | |
406 if ( *v28 ) | |
407 Str += pFontSmallnum->CalcTextHeight(pItemsTable->pItems[inspect_item->uItemID].pDescription, &iteminfo_window, 100, 0); | |
408 iteminfo_window.uFrameHeight = pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), | |
409 TEXTURE_16BIT_PALETTE)->uTextureHeight + v81 + 54; | |
410 if ( (signed int)Str > (signed int)iteminfo_window.uFrameHeight ) | |
411 iteminfo_window.uFrameHeight = (unsigned int)Str; | |
2567 | 412 if ( inspect_item->uAttributes & ITEM_TEMP_BONUS && (inspect_item->special_enchantment || inspect_item->uEnchantmentType) ) |
2501 | 413 iteminfo_window.uFrameHeight += LOBYTE(pFontComic->uFontHeight); |
414 v85 = 0; | |
415 if ( pFontArrus->uFontHeight ) | |
416 { | |
417 iteminfo_window.uFrameWidth -= 24; | |
418 if ( pFontArrus->CalcTextHeight(inspect_item->GetIdentifiedName(), &iteminfo_window, 0, 0) / (signed int)pFontArrus->uFontHeight ) | |
419 v85 = pFontArrus->uFontHeight; | |
420 iteminfo_window.uFrameWidth += 24; | |
421 } | |
422 iteminfo_window.uFrameWidth += 12; | |
423 iteminfo_window.uFrameHeight += (unsigned int)v85; | |
424 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; | |
425 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; | |
426 iteminfo_window.DrawMessageBox(0); | |
2524 | 427 pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, |
2501 | 428 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); |
429 iteminfo_window.uFrameWidth -= 12; | |
430 iteminfo_window.uFrameHeight -= 12; | |
431 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; | |
432 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; | |
2575 | 433 pRenderer->DrawTextureAlphaNew( |
434 (iteminfo_window.uFrameX + v78)/640.0f, | |
435 (iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - inspect_item_image->GetHeight()) / 2)/480.0f, | |
436 inspect_item_image | |
437 ); | |
2501 | 438 |
439 v34 = (int)(v85 + 35); | |
440 Str = out_text; | |
441 for ( uint i = 1; i <= 3; i++ ) | |
442 { | |
443 if ( *Str ) | |
444 { | |
445 iteminfo_window.DrawText(pFontComic, 100, v34, 0, Str, 0, 0, 0); | |
446 v34 += pFontComic->CalcTextHeight(Str, &iteminfo_window, 100, 0) + 3; | |
447 } | |
448 Str += 100; | |
449 } | |
450 v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription; | |
451 if ( *v28 ) | |
452 iteminfo_window.DrawText(pFontSmallnum, 100, v34, 0, v28, 0, 0, 0); | |
453 iteminfo_window.uFrameX += 12; | |
454 iteminfo_window.uFrameWidth -= 24; | |
455 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), inspect_item->GetIdentifiedName(), 3); | |
456 iteminfo_window.uFrameWidth += 24; | |
457 iteminfo_window.uFrameX -= 12; | |
458 if ( v77 ) | |
459 { | |
460 sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value" | |
461 iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); | |
2524 | 462 pRenderer->ResetUIClipRect(); |
2501 | 463 } |
464 else | |
465 { | |
2567 | 466 if ( (inspect_item->uAttributes & ITEM_TEMP_BONUS) && (inspect_item->special_enchantment || inspect_item->uEnchantmentType) ) |
2501 | 467 { |
468 init_summoned_item(&v67, inspect_item->uExpireTime - pParty->uTimePlayed); | |
469 strcpy(pTmpBuf.data(), "Duration:"); | |
470 Str = (char *)(v67.field_18_expire_year - game_starting_year); | |
471 if (v67.field_18_expire_year != 1168 ) | |
472 { | |
473 sprintf(v65, " %d:yr", v67.field_18_expire_year - game_starting_year); | |
474 strcat(pTmpBuf.data(), v65); | |
475 } | |
476 if ( (((v67.field_14_exprie_month || Str) && | |
477 ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str) | |
478 || v67.field_C_expire_day) | |
479 && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || | |
480 v67.field_C_expire_day) | |
481 || v67.field_8_expire_hour) | |
482 && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || | |
483 v67.field_C_expire_day || v67.field_8_expire_hour) | |
484 || v67.field_4_expire_minute ) | |
485 { | |
486 sprintf(v65, " %d:mn", v67.field_4_expire_minute); | |
487 strcat(pTmpBuf.data(), v65); | |
488 } | |
489 iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - 2 * LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); | |
490 } | |
491 sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], inspect_item->GetValue()); | |
492 iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); | |
493 if ( inspect_item->uAttributes & ITEM_STOLEN ) | |
494 pText = pGlobalTXT_LocalizationStrings[187]; //"Stolen" | |
495 else | |
496 { | |
497 if ( !(inspect_item->uAttributes & ITEM_HARDENED) ) | |
498 { | |
2524 | 499 pRenderer->ResetUIClipRect(); |
2501 | 500 if ( !areWeLoadingTexture ) |
501 { | |
502 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); | |
503 pIcons_LOD->SyncLoadedFilesCount(); | |
504 } | |
505 return; | |
506 } | |
507 pText = pGlobalTXT_LocalizationStrings[651]; //"Hardened" | |
508 } | |
509 LOWORD(inspect_item->uAttributes) = r_mask; | |
510 iteminfo_window.DrawText(pFontComic, pFontComic->GetLineWidth(pTmpBuf.data()) + 132, | |
511 iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), inspect_item->uAttributes, pText, 0, 0, 0); | |
2524 | 512 pRenderer->ResetUIClipRect(); |
2501 | 513 } |
514 if ( !areWeLoadingTexture ) | |
515 { | |
516 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); | |
517 pIcons_LOD->SyncLoadedFilesCount(); | |
518 } | |
519 return; | |
520 } | |
521 | |
522 //----- (0041E360) -------------------------------------------------------- | |
523 void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *pWindow) | |
524 { | |
525 unsigned __int16 v9; // dx@4 | |
526 SpriteFrame *v10; // edi@17 | |
527 unsigned int v18; // ecx@19 | |
528 unsigned int v19; // eax@21 | |
529 int skill_points; // edi@61 | |
530 unsigned int skill_level; // eax@61 | |
531 int pTextHeight; // edi@90 | |
532 PlayerSpeech speech; // [sp-8h] [bp-1F4h]@79 | |
533 DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18 | |
534 DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18 | |
535 RECT dest_rect; // [sp+ECh] [bp-100h]@26 | |
536 const char *string_name[10]; // [sp+FCh] [bp-F0h]@145 | |
537 const char *content[11]; // [sp+124h] [bp-C8h]@127 | |
538 unsigned char resistances[11]; // [sp+124h] [bp-C8h]@127 | |
539 RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3 | |
540 unsigned int v107; // [sp+1A0h] [bp-4Ch]@18 | |
541 bool for_effects; // [sp+1C0h] [bp-2Ch]@3 | |
542 bool normal_level; // [sp+1D0h] [bp-1Ch]@18 | |
543 bool expert_level; // [sp+1C4h] [bp-28h]@18 | |
544 bool master_level; // [sp+1C8h] [bp-24h]@18 | |
545 bool grandmaster_level; // [sp+1B4h] [bp-38h]@3 | |
546 const char *pText; // [sp+1D4h] [bp-18h]@18 | |
547 int pTextColorID; // [sp+1E4h] [bp-8h]@18 | |
548 int v115; | |
549 | |
550 bool monster_full_informations = false; | |
551 static Actor pMonsterInfoUI_Doll; | |
552 if ( !uActiveCharacter ) // | |
553 uActiveCharacter = 1; | |
554 | |
555 /*if ( !(bMonsterInfoUI_bDollInitialized & 1) ) | |
556 { | |
557 bMonsterInfoUI_bDollInitialized |= 1u; | |
558 Actor::Actor(&pMonsterInfoUI_Doll); | |
559 atexit(nullsub_3); | |
560 }*/ | |
561 v106.sParentBillboardID = -1; | |
562 v115 = monster_popup_y_offsets[((signed __int16)pActors[uActorID].pMonsterInfo.uID - 1) / 3] - 40; | |
563 if ( pActors[uActorID].pMonsterInfo.uID == pMonsterInfoUI_Doll.pMonsterInfo.uID ) | |
564 v9 = pMonsterInfoUI_Doll.uCurrentActionLength; | |
565 else | |
566 { | |
567 memcpy(&pMonsterInfoUI_Doll, &pActors[uActorID], sizeof(pMonsterInfoUI_Doll)); | |
568 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; | |
569 pMonsterInfoUI_Doll.uCurrentActionTime = 0; | |
570 v9 = rand() % 256 + 128; | |
571 pMonsterInfoUI_Doll.uCurrentActionLength = v9; | |
572 } | |
573 | |
574 if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 ) | |
575 { | |
576 pMonsterInfoUI_Doll.uCurrentActionTime = 0; | |
577 if ( pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_Bored || pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_AtkMelee) | |
578 { | |
579 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Standing; | |
580 pMonsterInfoUI_Doll.uCurrentActionLength = rand() % 128 + 128; | |
581 } | |
582 else | |
583 { | |
584 //rand(); | |
585 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; | |
586 if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) && | |
587 (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) && rand() % 30 < 100 ) | |
588 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_AtkMelee; | |
589 pMonsterInfoUI_Doll.uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[pActors[uActorID].pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength; | |
590 } | |
591 } | |
592 v10 = pSpriteFrameTable->GetFrame( pActors[uActorID].pSpriteIDs[pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime); | |
593 v106.pTarget = pRenderer->pTargetSurface; | |
594 v106.pTargetZ = pRenderer->pActiveZBuffer; | |
595 v106.uTargetPitch = pRenderer->uTargetSurfacePitch; | |
596 v106.uViewportX = pWindow->uFrameX + 13; | |
597 v106.uViewportY = pWindow->uFrameY + 52; | |
598 v106.uViewportW = (pWindow->uFrameY + 52) + 128; | |
599 v106.uViewportZ = v106.uViewportX + 128; | |
600 v106.uScreenSpaceX = (signed int)(v106.uViewportX + 128 + v106.uViewportX) / 2; | |
601 v106._screenspace_x_scaler_packedfloat = 65536; | |
602 v106._screenspace_y_scaler_packedfloat = 65536; | |
603 v106.uScreenSpaceY = v115 + (pWindow->uFrameY + 52) + pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]].uHeight; | |
604 v106.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v10->uPaletteIndex, 0, 1); | |
605 v106.sZValue = 0; | |
606 v106.uFlags = 0; | |
607 pRenderer->SetRasterClipRect(0, 0, window->GetWidth() - 1, window->GetHeight() - 1); | |
608 pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu));//ãîðèçîíòàëüíàÿ âåðõíÿÿ ëèíèÿ | |
609 pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu));//ãîðèçîíòàëüíàÿ íèæíÿÿ ëèíèÿ | |
610 pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu));//ëåâàÿ âåðòèêàëüíàÿ ëèíèÿ | |
611 pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu));//ïðàâàÿ âåðòèêàëüíàÿ ëèíèÿ | |
612 //if ( pRenderer->pRenderD3D ) | |
613 { | |
614 v106.uScreenSpaceY = v115 + v106.uViewportY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; | |
615 | |
616 memset(&Dst, 0, sizeof(Dst)); | |
617 Dst.dwSize = sizeof(Dst); | |
618 Dst.dwFillColor = 0; | |
619 | |
620 memset(&pDesc, 0, sizeof(pDesc)); | |
621 pDesc.dwSize = sizeof(pDesc); | |
622 | |
623 pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->GetSurfaceDesc(&pDesc); | |
624 v107 = 0; | |
625 uint i = 0; | |
626 int dst_x = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2; | |
627 int dst_y = v106.uScreenSpaceY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaY - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; | |
628 uint dst_z = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2 - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth; | |
629 uint dst_w = v106.uScreenSpaceY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; | |
630 if (dst_x < v106.uViewportX) | |
631 { | |
632 v18 = v106.uViewportX - dst_x; | |
633 dst_x = v106.uViewportX; | |
634 v107 = v18; | |
635 } | |
636 if (dst_y < v106.uViewportY) | |
637 { | |
638 v19 = v106.uViewportY - dst_y; | |
639 dst_y = v106.uViewportY; | |
640 i = v19; | |
641 } | |
642 if (dst_z > v106.uViewportZ) | |
643 dst_z = v106.uViewportZ; | |
644 if (dst_w > v106.uViewportW) | |
645 dst_w = v106.uViewportW; | |
646 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0x7FF); | |
647 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0x7FF); | |
648 dest_rect.left = v106.uViewportX; | |
649 dest_rect.top = v106.uViewportY; | |
650 dest_rect.right = v106.uViewportZ; | |
651 dest_rect.bottom = v106.uViewportW; | |
652 | |
653 ErrD3D(pRenderer->pBackBuffer4->Blt(&dest_rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &Dst)); | |
654 /*if ( pRenderer->uTargetGBits == 5 ) | |
655 { | |
656 __debugbreak(); // no monster popup for r5g5b5 will be | |
657 memset(&pDesc, 0, 0x7Cu); | |
658 pDesc.dwSize = 124; | |
659 if ( pRenderer->LockSurface_DDraw4(pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface, &pDesc, DDLOCK_WAIT)) | |
660 { | |
661 v20 = (char *)dst_y; | |
662 v110 = pDesc.lpSurface; | |
663 if (dst_y < dst_w) | |
664 { | |
665 v21 = dst_x; | |
666 //v22 = &pRenderer->pTargetSurface[dst_y * pRenderer->uTargetSurfacePitch + dst_x]; | |
667 ushort* _v22_2 = v22; | |
668 v23 = i - dst_y; | |
669 v115 = i - dst_y; | |
670 while ( 1 ) | |
671 { | |
672 dst_y = v21; | |
673 if ( v21 < dst_z ) | |
674 { | |
675 v25 = v107 - v21; | |
676 v109 = (int)&v20[v23]; | |
677 for ( i = v107 - v21; ; v25 = i ) | |
678 { | |
679 v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight); | |
680 v26 = (char *)v108 + pDesc.dwWidth * (v25 + dst_y++) / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth; | |
681 *v22 = *((short *)v110 + (int)v26); | |
682 ++v22; | |
683 if ( dst_y >= dst_z ) | |
684 break; | |
685 } | |
686 v23 = v115; | |
687 } | |
688 v22 = (unsigned __int16 *)((char *)_v22_2 + 2 * pRenderer->uTargetSurfacePitch); | |
689 _v22_2 = v22; | |
690 v20 = (char *)(dst_y + 1); | |
691 v28 = __OFSUB__(dst_y + 1, dst_w); | |
692 v27 = (signed int)(dst_y++ + 1 - dst_w) < 0; | |
693 if ( !(v27 ^ v28) ) | |
694 break; | |
695 v21 = dst_x; | |
696 } | |
697 } | |
698 pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->Unlock(0); | |
699 } | |
700 } | |
701 else*/ | |
702 { | |
703 memset(&pDesc, 0, sizeof(pDesc)); | |
704 pDesc.dwSize = sizeof(pDesc); | |
705 if ( pRenderer->LockSurface_DDraw4(pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface, &pDesc, DDLOCK_WAIT) ) | |
706 { | |
707 ushort* src = (unsigned __int16 *)pDesc.lpSurface; | |
708 uint num_top_scanlines_above_frame_y = i - dst_y; | |
709 for (uint y = dst_y; y < dst_w; ++y) | |
710 { | |
711 //ushort* dst = &pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + dst_x]; | |
712 | |
713 uint src_y = num_top_scanlines_above_frame_y + y; | |
714 for (uint x = dst_x; x < dst_z; ++x) | |
715 { | |
716 uint src_x = v107 - dst_x + x; // num scanlines left to frame_x + current x | |
717 | |
718 uint idx = pDesc.dwHeight * src_y / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight * (pDesc.lPitch / sizeof(short)) + | |
719 pDesc.dwWidth * src_x / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth; | |
720 uint b = src[idx] & 0x1F; | |
721 //*dst++ = b | 2 * (src[idx] & 0xFFE0); | |
722 pRenderer->WritePixel16(x, y, b | 2 * (src[idx] & 0xFFE0)); | |
723 } | |
724 } | |
725 pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->Unlock(NULL); | |
726 } | |
727 } | |
728 } | |
729 /*else | |
730 { | |
731 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0); | |
732 if ( v10->pHwSpriteIDs[0] >= 0 ) | |
733 pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]].DrawSprite_sw(&v106, 0); | |
734 }*/ | |
735 //name and profession | |
736 if ( pActors[uActorID].sNPC_ID ) | |
737 { | |
738 if (GetNPCData(pActors[uActorID].sNPC_ID)->uProfession) | |
739 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], GetNPCData(pActors[uActorID].sNPC_ID)->pName, aNPCProfessionNames[GetNPCData(pActors[uActorID].sNPC_ID)->uProfession]); // "%s the %s" / ^Pi[%s] %s | |
740 else | |
741 strncpy(pTmpBuf.data(), GetNPCData(pActors[uActorID].sNPC_ID)->pName, 2000); | |
742 } | |
743 else | |
744 { | |
745 if ( pActors[uActorID].dword_000334_unique_name ) | |
746 strncpy(pTmpBuf.data(), pMonsterStats->pPlaceStrings[pActors[uActorID].dword_000334_unique_name], 2000); | |
747 else | |
748 strncpy(pTmpBuf.data(), pMonsterStats->pInfos[pActors[uActorID].pMonsterInfo.uID].pName, 2000); | |
749 } | |
750 pWindow->DrawTitleText(pFontComic, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | |
751 //health bar | |
752 Actor::DrawHealthBar(&pActors[uActorID], pWindow); | |
753 | |
754 normal_level = 0; | |
755 expert_level = 0; | |
756 master_level = 0; | |
757 grandmaster_level = 0; | |
758 for_effects = 0; | |
759 pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
760 if ( pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) | |
761 { | |
762 skill_points = (unsigned __int8)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) & 0x3F; | |
763 skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) - 1; | |
764 if ( skill_level == 0 )//(normal) | |
765 { | |
766 if ( skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) | |
767 normal_level = 1; | |
768 } | |
769 else if ( skill_level == 1 )//(expert) | |
770 { | |
771 if ( 2 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) | |
772 { | |
773 normal_level = 1; | |
774 expert_level = 1; | |
775 } | |
776 } | |
777 else if ( skill_level == 2 )//(master) | |
778 { | |
779 if ( 3 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) | |
780 { | |
781 normal_level = 1; | |
782 expert_level = 1; | |
783 master_level = 1; | |
784 } | |
785 } | |
786 else if ( skill_level == 3 )//grandmaster | |
787 { | |
788 normal_level = 1; | |
789 expert_level = 1; | |
790 master_level = 1; | |
791 grandmaster_level = 1; | |
792 } | |
793 } | |
794 if ( pActors[uActorID].uAIState != Dead | |
795 && pActors[uActorID].uAIState != Dying | |
796 && !dword_507BF0_is_there_popup_onscreen && pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) | |
797 { | |
798 if ( normal_level | expert_level | master_level | grandmaster_level ) | |
799 { | |
800 if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 ) | |
801 speech = SPEECH_IDENTIFY_MONSTER_STRONGER; | |
802 else | |
803 speech = SPEECH_IDENTIFY_MONSTER_WEAKER; | |
804 } | |
805 else | |
806 speech = SPEECH_IDENTIFY_MONSTER_106; | |
807 pPlayers[uActiveCharacter]->PlaySound(speech, 0); | |
808 } | |
809 | |
810 if ( (signed int)SkillToMastery(pParty->pPlayers[uActiveCharacter - 1].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 ) | |
811 for_effects = 1; | |
812 | |
813 if ( monster_full_informations == true ) | |
814 { | |
815 normal_level = 1;// | |
816 expert_level = 1;// | |
817 master_level = 1;// | |
818 grandmaster_level = 1;// | |
819 for_effects = 1; | |
820 } | |
821 | |
822 pWindow->DrawText(pFontSmallnum, 12, 196, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0);//Effects | |
823 if ( !for_effects && false) | |
824 pWindow->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0);//? | |
825 else | |
826 { | |
827 pText = ""; | |
828 pTextHeight = LOBYTE(pFontSmallnum->uFontHeight) + 193; | |
829 for ( uint i = 1; i <= 21; ++i ) | |
830 { | |
831 if ( pActors[uActorID].pActorBuffs[i].uExpireTime > 0 ) | |
832 { | |
833 switch ( i ) | |
834 { | |
835 case ACTOR_BUFF_CHARM: | |
836 pTextColorID = 60; | |
837 pText = pGlobalTXT_LocalizationStrings[591];//Charmed | |
838 break; | |
839 case ACTOR_BUFF_SUMMONED: | |
840 pTextColorID = 82; | |
841 pText = pGlobalTXT_LocalizationStrings[649];//Summoned | |
842 break; | |
843 case ACTOR_BUFF_SHRINK: | |
844 pTextColorID = 92; | |
845 pText = pGlobalTXT_LocalizationStrings[592];//Shrunk | |
846 break; | |
847 case ACTOR_BUFF_AFRAID: | |
848 pTextColorID = 63; | |
849 pText = pGlobalTXT_LocalizationStrings[4];//Afraid | |
850 break; | |
851 case ACTOR_BUFF_STONED: | |
852 pText = pGlobalTXT_LocalizationStrings[220];//Stoned | |
853 pTextColorID = 81; | |
854 break; | |
855 case ACTOR_BUFF_PARALYZED: | |
856 pText = pGlobalTXT_LocalizationStrings[162];//Paralyzed | |
857 pTextColorID = 81; | |
858 break; | |
859 case ACTOR_BUFF_SLOWED: | |
860 pText = pGlobalTXT_LocalizationStrings[593];//Slowed | |
861 pTextColorID = 35; | |
862 break; | |
863 case ACTOR_BUFF_BERSERK: | |
864 pText = pGlobalTXT_LocalizationStrings[608];//Berserk | |
865 pTextColorID = 62; | |
866 break; | |
867 case ACTOR_BUFF_SOMETHING_THAT_HALVES_AC: | |
868 case ACTOR_BUFF_MASS_DISTORTION: | |
869 pText = ""; | |
870 pTextColorID = 0; | |
871 continue; | |
872 case ACTOR_BUFF_FATE: | |
873 pTextColorID = 47; | |
874 pText = pGlobalTXT_LocalizationStrings[221];//Fate | |
875 break; | |
876 case ACTOR_BUFF_ENSLAVED: | |
877 pTextColorID = 66; | |
878 pText = pGlobalTXT_LocalizationStrings[607];//Enslaved | |
879 break; | |
880 case ACTOR_BUFF_DAY_OF_PROTECTION: | |
881 pTextColorID = 85; | |
882 pText = pGlobalTXT_LocalizationStrings[610];//Day of Protection | |
883 break; | |
884 case ACTOR_BUFF_HOUR_OF_POWER: | |
885 pTextColorID = 86; | |
886 pText = pGlobalTXT_LocalizationStrings[609];//Hour of Power | |
887 break; | |
888 case ACTOR_BUFF_SHIELD: | |
889 pTextColorID = 17; | |
890 pText = pGlobalTXT_LocalizationStrings[279];//Shield | |
891 break; | |
892 case ACTOR_BUFF_STONESKIN: | |
893 pTextColorID = 38; | |
894 pText = pGlobalTXT_LocalizationStrings[442];//Stoneskin | |
895 break; | |
896 case ACTOR_BUFF_BLESS: | |
897 pTextColorID = 46; | |
898 pText = pGlobalTXT_LocalizationStrings[443];//Bless | |
899 break; | |
900 case ACTOR_BUFF_HEROISM: | |
901 pTextColorID = 51; | |
902 pText = pGlobalTXT_LocalizationStrings[440];//Heroism | |
903 break; | |
904 case ACTOR_BUFF_HASTE: | |
905 pTextColorID = 5; | |
906 pText = pGlobalTXT_LocalizationStrings[441];//Haste | |
907 break; | |
908 case ACTOR_BUFF_PAIN_REFLECTION: | |
909 pTextColorID = 95; | |
910 pText = pGlobalTXT_LocalizationStrings[229];//Pain Reflection | |
911 break; | |
912 case ACTOR_BUFF_PAIN_HAMMERHANDS: | |
913 pTextColorID = 73; | |
914 pText = pGlobalTXT_LocalizationStrings[228];//Hammerhands | |
915 break; | |
916 default: | |
917 pText = ""; | |
918 break; | |
919 } | |
920 if ( _stricmp(pText, "" )) | |
921 { | |
922 pWindow->DrawText(pFontSmallnum, 28, pTextHeight, GetSpellColor(pTextColorID), pText, 0, 0, 0); | |
923 pTextHeight = pTextHeight + *(char *)((int)pFontSmallnum + 5) - 3; | |
924 } | |
925 } | |
926 } | |
927 if ( !_stricmp(pText,"" )) | |
928 pWindow->DrawText(pFontSmallnum, 28, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[153], 0, 0, 0);//Íåò | |
929 } | |
930 | |
931 if ( normal_level ) | |
932 { | |
933 sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, pActors[uActorID].pMonsterInfo.uHP); | |
934 pWindow->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
935 pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
936 sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[12], 0, pActors[uActorID].pMonsterInfo.uAC);//Armor Class | |
937 } | |
938 else | |
939 { | |
940 sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);//? - [630] actually displays a question mark | |
941 pWindow->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
942 pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
943 sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[12], 0, pGlobalTXT_LocalizationStrings[630]);//? - [630] actually displays a question mark | |
944 } | |
945 pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
946 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight); | |
947 | |
948 content[0] = pGlobalTXT_LocalizationStrings[87]; | |
949 content[1] = pGlobalTXT_LocalizationStrings[6]; | |
950 content[2] = pGlobalTXT_LocalizationStrings[240]; | |
951 content[3] = pGlobalTXT_LocalizationStrings[70]; | |
952 content[4] = pGlobalTXT_LocalizationStrings[624]; | |
953 content[5] = pGlobalTXT_LocalizationStrings[138]; | |
954 content[6] = pGlobalTXT_LocalizationStrings[214]; | |
955 content[7] = pGlobalTXT_LocalizationStrings[142]; | |
956 content[8] = pGlobalTXT_LocalizationStrings[29]; | |
957 content[9] = pGlobalTXT_LocalizationStrings[133]; | |
958 content[10] = pGlobalTXT_LocalizationStrings[54]; | |
959 | |
960 if ( expert_level ) | |
961 { | |
962 sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, content[pActors[uActorID].pMonsterInfo.uAttack1Type]);//Attack | |
963 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
964 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
965 if ( pActors[uActorID].pMonsterInfo.uAttack1DamageBonus ) | |
966 sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53], | |
967 0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides, pActors[uActorID].pMonsterInfo.uAttack1DamageBonus); | |
968 else | |
969 sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53], | |
970 0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides); | |
971 } | |
972 else | |
973 { | |
974 sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); | |
975 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
976 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
977 sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]); | |
978 } | |
979 pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
980 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight); | |
981 | |
982 if ( !master_level ) | |
983 { | |
984 sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[630]);//"Spell" "?" | |
985 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
986 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
987 } | |
988 else | |
989 { | |
990 pText = pGlobalTXT_LocalizationStrings[628];//Spell | |
991 if ( pActors[uActorID].pMonsterInfo.uSpell1ID && pActors[uActorID].pMonsterInfo.uSpell2ID ) | |
992 pText = pGlobalTXT_LocalizationStrings[629];//Spells | |
993 if ( pActors[uActorID].pMonsterInfo.uSpell1ID ) | |
994 { | |
995 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pText, 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell1ID].pShortName);//"%s\f%05u\t060%s\n" | |
996 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
997 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
998 } | |
999 if ( pActors[uActorID].pMonsterInfo.uSpell2ID ) | |
1000 { | |
1001 sprintf(pTmpBuf.data(), "\f%05u\t070%s\n", 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell2ID].pShortName);//"%s\f%05u\t060%s\n" | |
1002 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
1003 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
1004 } | |
1005 if ( !pActors[uActorID].pMonsterInfo.uSpell1ID && !pActors[uActorID].pMonsterInfo.uSpell2ID ) | |
1006 { | |
1007 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[153]);//"%s\f%05u\t060%s\n" | |
1008 pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
1009 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
1010 } | |
1011 } | |
1012 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
1013 pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[626], 0, 0, 0);//Immune | |
1014 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
1015 | |
1016 string_name[0] = pGlobalTXT_LocalizationStrings[87];//Fire | |
1017 string_name[1] = pGlobalTXT_LocalizationStrings[6];//Air | |
1018 string_name[2] = pGlobalTXT_LocalizationStrings[240]; | |
1019 string_name[3] = pGlobalTXT_LocalizationStrings[70]; | |
1020 string_name[4] = pGlobalTXT_LocalizationStrings[142]; | |
1021 string_name[5] = pGlobalTXT_LocalizationStrings[214]; | |
1022 string_name[6] = pGlobalTXT_LocalizationStrings[29]; | |
1023 string_name[7] = pGlobalTXT_LocalizationStrings[133]; | |
1024 string_name[8] = pGlobalTXT_LocalizationStrings[54]; | |
1025 string_name[9] = pGlobalTXT_LocalizationStrings[624]; | |
1026 | |
1027 resistances[0] = pActors[uActorID].pMonsterInfo.uResFire; | |
1028 resistances[1] = pActors[uActorID].pMonsterInfo.uResAir; | |
1029 resistances[2] = pActors[uActorID].pMonsterInfo.uResWater; | |
1030 resistances[3] = pActors[uActorID].pMonsterInfo.uResEarth; | |
1031 resistances[4] = pActors[uActorID].pMonsterInfo.uResMind; | |
1032 resistances[5] = pActors[uActorID].pMonsterInfo.uResSpirit; | |
1033 resistances[6] = pActors[uActorID].pMonsterInfo.uResBody; | |
1034 resistances[7] = pActors[uActorID].pMonsterInfo.uResLight; | |
1035 resistances[8] = pActors[uActorID].pMonsterInfo.uResPhysical; | |
1036 resistances[9] = pActors[uActorID].pMonsterInfo.uResDark; | |
1037 | |
1038 if ( grandmaster_level ) | |
1039 { | |
1040 for ( uint i = 0; i < 10; i++ ) | |
1041 { | |
1042 if ( resistances[i] == 200 ) | |
1043 { | |
1044 pText = pGlobalTXT_LocalizationStrings[625];//Immune | |
1045 } | |
1046 else | |
1047 { | |
1048 if ( resistances[i] ) | |
1049 pText = pGlobalTXT_LocalizationStrings[627];//Resistant | |
1050 else | |
1051 pText = pGlobalTXT_LocalizationStrings[153];//None | |
1052 } | |
1053 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pText); | |
1054 pWindow->DrawText(pFontSmallnum, 170, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
1055 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
1056 } | |
1057 } | |
1058 else | |
1059 { | |
1060 for ( uint i = 0; i < 10; ++i ) | |
1061 { | |
1062 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?" | |
1063 pWindow->DrawText(pFontSmallnum, 170, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); | |
1064 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; | |
1065 } | |
1066 } | |
1067 //cast spell: Detect life | |
1068 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 ) | |
1069 { | |
1070 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], pActors[uActorID].sCurrentHP);//Current Hit Points | |
1071 pFontSmallnum->GetLineWidth(pTmpBuf.data()); | |
1072 pWindow->DrawTitleText(pFontSmallnum, 0, pWindow->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf.data(), 3); | |
1073 } | |
1074 } | |
1075 | |
1076 //----- (00417BB5) -------------------------------------------------------- | |
1077 const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType) | |
1078 { | |
1079 char a2[1200]; // [sp+Ch] [bp-538h]@7 | |
1080 char Source[120]; // [sp+4BCh] [bp-88h]@7 | |
1081 int v35; // [sp+53Ch] [bp-8h]@1 | |
1082 | |
1083 v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal | |
1084 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]) > (signed int)v35 ) | |
1085 v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert | |
1086 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]) > (signed int)v35 ) | |
1087 v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master | |
1088 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]) > (signed int)v35 ) | |
1089 v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);// Grand | |
1090 | |
1091 a2[0] = 0; | |
1092 Source[0] = 0; | |
1093 strcpy(a2, "%s\n\n"); | |
1094 sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 1)); | |
1095 strcat(a2, Source); | |
1096 strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); | |
1097 sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 2)); | |
1098 strcat(a2, Source); | |
1099 strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); | |
1100 sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 3)); | |
1101 strcat(a2, Source); | |
1102 strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); | |
1103 sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 4)); | |
1104 strcat(a2, Source); | |
1105 strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); | |
1106 if ( (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F) == (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) ) | |
1107 { | |
1108 sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], | |
1109 pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], // Normal | |
1110 pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], // Expert | |
1111 pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], // Master | |
1112 pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType]); // Grand | |
1113 } | |
1114 else | |
1115 { | |
1116 sprintf(Source, "\f%05d", Color16(0xFFu, 0xFFu, 0xFFu)); | |
1117 strcat(a2, Source); | |
1118 strcat(a2, "%s: +%d"); | |
1119 sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], | |
1120 pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], | |
1121 pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], | |
1122 pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], | |
1123 pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType], | |
1124 pGlobalTXT_LocalizationStrings[623], //Bonus | |
1125 (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) - (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F)); | |
1126 } | |
1127 return static_sub_417BB5_out_string; | |
1128 } | |
1129 | |
1130 //----- (00417FE5) -------------------------------------------------------- | |
1131 void CharacterUI_SkillsTab_ShowHint() | |
1132 { | |
1133 GUIButton *pButton; // esi@6 | |
1134 unsigned int pX; // [sp+4h] [bp-8h]@1 | |
1135 unsigned int pY; // [sp+8h] [bp-4h]@1 | |
1136 | |
1137 pMouse->GetClickPos(&pX, &pY); | |
1138 if ( (signed int)pX < 24 || (signed int)pX > 455 || (signed int)pY < 18 || (signed int)pY > 36 ) | |
1139 { | |
1140 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) | |
1141 { | |
1142 if ( pButton->msg == UIMSG_SkillUp | |
1143 && (signed int)pX >= (signed int)pButton->uX | |
1144 && (signed int)pX <= (signed int)pButton->uZ | |
1145 && (signed int)pY >= (signed int)pButton->uY | |
1146 && (signed int)pY <= (signed int)pButton->uW ) | |
1147 { | |
1148 CharacterUI_DrawTooltip(pSkillNames[pButton->msg_param], CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)pButton->msg_param)); | |
1149 } | |
1150 } | |
1151 } | |
1152 else | |
1153 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);//Î÷êè íàâûêîâ | |
1154 } | |
1155 | |
1156 //----- (00418083) -------------------------------------------------------- | |
1157 void CharacterUI_StatsTab_ShowHint() | |
1158 { | |
1159 int pStringNum; // edi@1 | |
1160 signed int pTextColor; // eax@15 | |
1161 const char *pHourWord; // ecx@17 | |
1162 const char *pDayWord; // eax@20 | |
1163 int v15; // ebx@28 | |
1164 POINT a2; // [sp+Ch] [bp-24h]@1 | |
1165 int pHour; // [sp+14h] [bp-1Ch]@15 | |
1166 unsigned int pDay; // [sp+24h] [bp-Ch]@15 | |
1167 | |
1168 pMouse->GetCursorPos(&a2); | |
1169 for ( pStringNum = 0; pStringNum < stat_string_coord.size(); ++pStringNum ) | |
1170 { | |
1171 if (a2.x >= stat_string_coord[pStringNum].x && a2.x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width ) | |
1172 { | |
1173 if (a2.y >= stat_string_coord[pStringNum].y && a2.y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height ) | |
1174 break; | |
1175 } | |
1176 } | |
1177 | |
1178 switch ( pStringNum ) | |
1179 { | |
1180 case 0:// Attributes | |
1181 case 1: | |
1182 case 2: | |
1183 case 3: | |
1184 case 4: | |
1185 case 5: | |
1186 case 6: | |
1187 if ( aAttributeNames[pStringNum] && pAttributeDescriptions[pStringNum] ) | |
1188 CharacterUI_DrawTooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]); | |
1189 break; | |
1190 case 7:// Health Points | |
1191 if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription ) | |
1192 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription); | |
1193 break; | |
1194 case 8:// Spell Points | |
1195 if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription ) | |
1196 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription); | |
1197 break; | |
1198 case 9:// Armor Class | |
1199 if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription ) | |
1200 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription); | |
1201 break; | |
1202 case 10:// Player Condition | |
1203 strcpy(pTmpBuf2.data(), pPlayerConditionAttributeDescription); | |
1204 strcat(pTmpBuf2.data(), "\n"); | |
1205 extern std::array<unsigned int, 18> pConditionImportancyTable; | |
1206 for ( uint i = 0; i < 18; ++i ) | |
1207 { | |
1208 if ( pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]] ) | |
1209 { | |
1210 strcat(pTmpBuf2.data(), " \n"); | |
1211 pHour = pParty->uTimePlayed - pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]]; | |
1212 pHour = (unsigned int)((pHour * 0.234375) / 60 / 60); | |
1213 pDay = (unsigned int)pHour / 24; | |
1214 pHour %= 24i64; | |
1215 pTextColor = GetConditionDrawColor(pConditionImportancyTable[i]); | |
1216 sprintfex(pTmpBuf.data(), format_4E2DE8, pTextColor, aCharacterConditionNames[pConditionImportancyTable[i]]); | |
1217 strcat(pTmpBuf2.data(), pTmpBuf.data()); | |
1218 if ( pHour && pHour <= 1 ) | |
1219 pHourWord = pGlobalTXT_LocalizationStrings[109]; | |
1220 else | |
1221 pHourWord = pGlobalTXT_LocalizationStrings[110]; | |
1222 if ( !pDay || (pDayWord = pGlobalTXT_LocalizationStrings[56], pDay > 1) ) | |
1223 pDayWord = pGlobalTXT_LocalizationStrings[57]; | |
1224 sprintfex(pTmpBuf.data(), "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord); | |
1225 strcat(pTmpBuf2.data(), pTmpBuf.data()); | |
1226 } | |
1227 } | |
1228 if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2.data() ) | |
1229 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data()); | |
1230 break; | |
1231 case 11:// Fast Spell | |
1232 if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription ) | |
1233 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription); | |
1234 break; | |
1235 case 12:// Player Age | |
1236 if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription ) | |
1237 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription); | |
1238 break; | |
1239 case 13:// Player Level | |
1240 if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription ) | |
1241 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription); | |
1242 break; | |
1243 case 14://Experience | |
1244 v15 = pPlayers[uActiveCharacter]->uLevel; | |
1245 do | |
1246 { | |
1247 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)GetExperienceRequiredForLevel(v15) ) | |
1248 break; | |
1249 ++v15; | |
1250 } | |
1251 while ( v15 <= 10000 ); | |
1252 pTmpBuf[0] = 0; | |
1253 pTmpBuf2[0] = 0; | |
1254 if ( v15 > pPlayers[uActiveCharacter]->uLevel ) | |
1255 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[147], v15); | |
1256 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], GetExperienceRequiredForLevel(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience), v15 + 1); | |
1257 strcat(pTmpBuf.data(), "\n"); | |
1258 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
1259 sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data()); | |
1260 if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2.data() ) | |
1261 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data()); | |
1262 break; | |
1263 case 15:// Attack Bonus | |
1264 if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription ) | |
1265 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription); | |
1266 break; | |
1267 case 16:// Attack Damage | |
1268 if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription ) | |
1269 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription); | |
1270 break; | |
1271 case 17:// Missle Bonus | |
1272 if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription ) | |
1273 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription); | |
1274 break; | |
1275 case 18:// Missle Damage | |
1276 if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription ) | |
1277 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription); | |
1278 break; | |
1279 case 19:// Fire Resistance | |
1280 if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription ) | |
1281 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription); | |
1282 break; | |
1283 case 20:// Air Resistance | |
1284 if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription ) | |
1285 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription); | |
1286 break; | |
1287 case 21:// Water Resistance | |
1288 if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription ) | |
1289 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription); | |
1290 break; | |
1291 case 22:// Earth Resistance | |
1292 if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription ) | |
1293 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription); | |
1294 break; | |
1295 case 23:// Mind Resistance | |
1296 if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription ) | |
1297 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription); | |
1298 break; | |
1299 case 24:// Body Resistance | |
1300 if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription ) | |
1301 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription); | |
1302 break; | |
1303 case 25: // Skill Points | |
1304 if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription ) | |
1305 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription); | |
1306 break; | |
1307 case 26: // Class description | |
1308 { | |
1309 if (pClassDescriptions[pPlayers[uActiveCharacter]->classType] && pClassNames[pPlayers[uActiveCharacter]->classType]) | |
1310 CharacterUI_DrawTooltip(pClassNames[pPlayers[uActiveCharacter]->classType], pClassDescriptions[pPlayers[uActiveCharacter]->classType]); | |
1311 } | |
1312 break; | |
1313 | |
1314 default: | |
1315 break; | |
1316 } | |
1317 } | |
1318 | |
1319 //----- (00410B28) -------------------------------------------------------- | |
1320 void DrawSpellDescriptionPopup(int spell_index) | |
1321 { | |
1322 SpellInfo *spell; // esi@1 | |
1323 unsigned int v3; // eax@2 | |
1324 LONG v5; // ecx@4 | |
1325 GUIWindow spell_info_window; // [sp+Ch] [bp-68h]@4 | |
1326 POINT mouse; // [sp+64h] [bp-10h]@1 | |
1327 | |
1328 spell = &pSpellStats->pInfos[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1]; | |
1329 if ( pMouse->GetCursorPos(&mouse)->y <= 250 ) | |
1330 v3 = pMouse->GetCursorPos(&mouse)->y + 30; | |
1331 else | |
1332 v3 = 30; | |
1333 spell_info_window.uFrameY = v3; | |
1334 spell_info_window.uFrameWidth = 328; | |
1335 spell_info_window.uFrameHeight = 68; | |
1336 spell_info_window.uFrameX = 90; | |
1337 spell_info_window.uFrameZ = 417; | |
1338 spell_info_window.uFrameW = v3 + 67; | |
1339 spell_info_window.Hint = nullptr; | |
1340 v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]); | |
1341 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]) > v5 ) | |
1342 v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]); | |
1343 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]) > v5 ) | |
1344 v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]); | |
1345 if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]) > v5 ) | |
1346 v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]); | |
1347 sprintf(pTmpBuf2.data(), | |
1348 "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", | |
1349 spell->pDescription, | |
1350 pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL], v5 + 3, v5 + 10, spell->pBasicSkillDesc, | |
1351 pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT], v5 + 3, v5 + 10, spell->pExpertSkillDesc, | |
1352 pGlobalTXT_LocalizationStrings[LOCSTR_MASTER], v5 + 3, v5 + 10, spell->pMasterSkillDesc, | |
1353 pGlobalTXT_LocalizationStrings[LOCSTR_GRAND], v5 + 3, v5 + 10, spell->pGrandmasterSkillDesc); | |
1354 spell_info_window.uFrameHeight += pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &spell_info_window, 0, 0); | |
1355 if ( (signed int)spell_info_window.uFrameHeight < 150 ) | |
1356 spell_info_window.uFrameHeight = 150; | |
1357 spell_info_window.uFrameWidth = game_viewport_width; | |
1358 spell_info_window.DrawMessageBox(0); | |
1359 spell_info_window.uFrameWidth -= 12; | |
1360 spell_info_window.uFrameHeight -= 12; | |
1361 spell_info_window.uFrameZ = spell_info_window.uFrameX + spell_info_window.uFrameWidth - 1; | |
1362 spell_info_window.uFrameW = spell_info_window.uFrameHeight + spell_info_window.uFrameY - 1; | |
1363 spell_info_window.DrawTitleText(pFontArrus, 0x78u, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), spell->pName, 3); | |
1364 spell_info_window.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); | |
1365 spell_info_window.uFrameWidth = 108; | |
1366 spell_info_window.uFrameZ = spell_info_window.uFrameX + 107; | |
1367 int skill_level = SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12]); | |
1368 spell_info_window.DrawTitleText(pFontComic, 12, 75, 0, pSkillNames[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12], 3); | |
1369 sprintf( pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST], | |
1370 pSpellDatas[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1].mana_per_skill[skill_level - 1]); | |
1371 spell_info_window.DrawTitleText(pFontComic, 12, spell_info_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); | |
1372 dword_507B00_spell_info_to_draw_in_popup = 0; | |
1373 } | |
2550 | 1374 |
2501 | 1375 |
1376 //----- (00416D62) -------------------------------------------------------- | |
1377 void UI_OnMouseRightClick(Vec2_int_ *_this) | |
1378 { | |
1379 int v5; // esi@62 | |
1380 GUIButton *pButton; // esi@84 | |
1381 const char *pStr; // edi@85 | |
1382 const char *pHint; // edx@113 | |
1383 GUIWindow popup_window; // [sp+4h] [bp-74h]@32 | |
1384 struct tagPOINT Point; // [sp+60h] [bp-18h]@6 | |
1385 unsigned int pX; // [sp+70h] [bp-8h]@3 | |
1386 unsigned int pY; // [sp+74h] [bp-4h]@3 | |
1387 | |
2541 | 1388 if ( current_screen_type == SCREEN_VIDEO || GetCurrentMenuID() == MENU_MAIN ) |
2501 | 1389 return; |
1390 if ( _this ) | |
1391 { | |
1392 pX = _this->x; | |
1393 pY = _this->y; | |
1394 } | |
1395 else | |
1396 { | |
1397 pMouse->GetClickPos(&pX, &pY); | |
1398 } | |
1399 //if ( pRenderer->bWindowMode ) | |
1400 { | |
1401 GetCursorPos(&Point); | |
1402 ScreenToClient(window->GetApiHandle(), &Point); | |
1403 if ( Point.x < 1 || Point.y < 1 || Point.x > 638 || Point.y > 478 ) | |
1404 { | |
1405 back_to_game(); | |
1406 return; | |
1407 } | |
1408 } | |
1409 if ( pParty->pPickedItem.uItemID )//íàæàòèå íà ïîðòðåò ïåðñà ïðàâîé êíîïêîé ìûøè ñ ðàñòâîðîì | |
1410 { | |
1411 for ( uint i = 0; i < 4; ++i ) | |
1412 { | |
1413 if ( (signed int)pX > RightClickPortraitXmin[i] && (signed int)pX < RightClickPortraitXmax[i] | |
1414 && (signed int)pY > 375 && (signed int)pY < 466 ) | |
1415 { | |
1416 pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(i + 1, 1); | |
1417 return; | |
1418 } | |
1419 } | |
1420 } | |
1421 | |
1422 pEventTimer->Pause(); | |
2541 | 1423 switch(current_screen_type) |
2501 | 1424 { |
1425 case SCREEN_CASTING: | |
1426 { | |
1427 Inventory_ItemPopupAndAlchemy(); | |
1428 break; | |
1429 } | |
1430 case SCREEN_CHEST: | |
1431 { | |
1432 if ( !pPlayers[uActiveCharacter]->CanAct() ) | |
1433 { | |
1434 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s íå â ñîñòîÿíèè %s Îïîçíàòü ïðåäìåòû | |
1435 popup_window.Hint = pTmpBuf.data(); | |
1436 popup_window.uFrameWidth = 384; | |
1437 popup_window.uFrameHeight = 180; | |
1438 popup_window.uFrameY = 40; | |
1439 if ( (signed int)pX <= 320 ) | |
1440 popup_window.uFrameX = pX + 30; | |
1441 else | |
1442 popup_window.uFrameX = pX - 414; | |
1443 popup_window.DrawMessageBox(0); | |
1444 } | |
1445 else | |
1446 { | |
1447 if ( pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF ) | |
1448 GameUI_DrawItemInfo(&pChests[pChestWindow->par1C].igChestItems[pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF) - 1] - 1]); | |
1449 } | |
1450 break; | |
1451 } | |
1452 case SCREEN_GAME://In the main menu displays a pop-up window(Â ãëàâíîì ìåíþ ïîêàçûâàåò âñïëûâàþùåå îêíî) | |
1453 { | |
1454 if (GetCurrentMenuID() > 0) | |
1455 break; | |
1456 if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y ) | |
1457 { | |
1458 popup_window.ptr_1C = (void *)((signed int)pX / 118); | |
1459 if ( (signed int)pX / 118 < 4 )//portaits zone | |
1460 { | |
1461 popup_window.Hint = nullptr; | |
1462 popup_window.uFrameWidth = 400; | |
1463 popup_window.uFrameHeight = 200; | |
1464 popup_window.uFrameX = 38; | |
1465 popup_window.uFrameY = 60; | |
1466 pAudioPlayer->StopChannels(-1, -1); | |
1467 GameUI_CharacterQuickRecord_Draw(&popup_window, pPlayers[(int)popup_window.ptr_1C + 1]); | |
1468 } | |
1469 } | |
1470 else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X ) | |
1471 { | |
1472 if ( (signed int)pY >= 130 ) | |
1473 { | |
1474 if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 )//buff_tooltip zone | |
1475 { | |
1476 popup_window.Hint = nullptr; | |
1477 popup_window.uFrameWidth = 400; | |
1478 popup_window.uFrameHeight = 200; | |
1479 popup_window.uFrameX = 38; | |
1480 popup_window.uFrameY = 60; | |
1481 pAudioPlayer->StopChannels(-1, -1); | |
1482 popup_window._41D73D_draw_buff_tooltip(); | |
1483 } | |
1484 else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 )//NPC zone | |
1485 { | |
1486 if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 )) | |
1487 { | |
1488 pAudioPlayer->StopChannels(-1, -1); | |
1489 GameUI_DrawNPCPopup((void *)1);//NPC 2 | |
1490 } | |
1491 } | |
1492 else | |
1493 { | |
1494 pAudioPlayer->StopChannels(-1, -1); | |
1495 GameUI_DrawNPCPopup(0);//NPC 1 | |
1496 } | |
1497 } | |
1498 else//minimap zone | |
1499 { | |
1500 popup_window.Hint = (char *)GameUI_GetMinimapHintText(); | |
1501 popup_window.uFrameWidth = 256; | |
1502 popup_window.uFrameX = 130; | |
1503 popup_window.uFrameY = 140; | |
1504 popup_window.uFrameHeight = 64; | |
1505 pAudioPlayer->StopChannels(-1, -1); | |
1506 popup_window.DrawMessageBox(0); | |
1507 } | |
1508 } | |
1509 else//game zone | |
1510 { | |
1511 popup_window.Hint = nullptr; | |
1512 popup_window.uFrameWidth = 320; | |
1513 popup_window.uFrameHeight = 320; | |
1514 popup_window.uFrameX = pX - 350; | |
1515 if ( (signed int)pX <= 320 ) | |
1516 popup_window.uFrameX = pX + 30; | |
1517 popup_window.uFrameY = 40; | |
1518 //if ( pRenderer->pRenderD3D ) | |
2541 | 1519 v5 = pEngine->pVisInstance->get_picked_object_zbuf_val(); |
2501 | 1520 /*else |
1521 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];*/ | |
1522 if (PID_TYPE((unsigned __int16)v5) == OBJECT_Actor) | |
1523 { | |
1524 /*if ( pRenderer->uNumSceneBegins ) | |
1525 { | |
1526 popup_window.DrawMessageBox(1); | |
1527 MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); | |
1528 } | |
1529 else*/ | |
1530 { | |
1531 pRenderer->BeginScene(); | |
1532 popup_window.DrawMessageBox(1); | |
1533 MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); | |
1534 pRenderer->EndScene(); | |
1535 } | |
1536 } | |
1537 if (PID_TYPE((unsigned __int16)v5) == OBJECT_Item) | |
1538 { | |
1539 if ( !(pObjectList->pObjects[pSpriteObjects[PID_ID((unsigned __int16)v5)].uObjectDescID].uFlags & 0x10 ) ) | |
1540 { | |
2566 | 1541 GameUI_DrawItemInfo(&pSpriteObjects[PID_ID((unsigned __int16)v5)].containing_item); |
2501 | 1542 } |
1543 } | |
1544 } | |
1545 break; | |
1546 } | |
1547 case SCREEN_BOOKS: | |
1548 { | |
1549 if ( !dword_506364 | |
1550 || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X | |
1551 || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y | |
1552 || ((popup_window.Hint = (char *)GetMapBookHintText()) == 0) ) | |
1553 break; | |
1554 popup_window.uFrameWidth = (pFontArrus->GetLineWidth(popup_window.Hint) + 32) + 0.5f; | |
1555 popup_window.uFrameX = pX + 5; | |
1556 popup_window.uFrameY = pY + 5; | |
1557 popup_window.uFrameHeight = 64; | |
1558 pAudioPlayer->StopChannels(-1, -1); | |
1559 popup_window.DrawMessageBox(0); | |
1560 break; | |
1561 } | |
1562 case SCREEN_CHARACTERS: | |
1563 case SCREEN_E: | |
1564 case SCREEN_CHEST_INVENTORY: | |
1565 { | |
2541 | 1566 if ( (signed int)pX > 467 && current_screen_type != SCREEN_E ) |
2501 | 1567 Inventory_ItemPopupAndAlchemy(); |
1568 else if ( (signed int)pY >= 345 ) | |
1569 break; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
1570 else if (current_character_screen_window == WINDOW_CharacterWindow_Stats)//2DEvent - CharacerScreenStats |
2501 | 1571 CharacterUI_StatsTab_ShowHint(); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
1572 else if (current_character_screen_window == WINDOW_CharacterWindow_Skills)//2DEvent - CharacerScreenSkills |
2501 | 1573 CharacterUI_SkillsTab_ShowHint(); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
1574 else if (current_character_screen_window == WINDOW_CharacterWindow_Inventory)//2DEvent - CharacerScreenInventory |
2501 | 1575 Inventory_ItemPopupAndAlchemy(); |
1576 break; | |
1577 } | |
1578 case SCREEN_SPELL_BOOK: | |
1579 { | |
1580 if ( dword_507B00_spell_info_to_draw_in_popup ) | |
1581 DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); | |
1582 break; | |
1583 } | |
1584 case SCREEN_HOUSE: | |
1585 { | |
1586 if ( (signed int)pY < 345 && (signed int)pX < 469 ) | |
1587 ShowPopupShopItem(); | |
1588 break; | |
1589 } | |
1590 case SCREEN_PARTY_CREATION: | |
1591 { | |
1592 popup_window.Hint = nullptr; | |
1593 pStr = 0; | |
1594 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) | |
1595 { | |
1596 if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ | |
1597 && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) | |
1598 { | |
1599 switch ( pButton->msg ) | |
1600 { | |
1601 case UIMSG_0: //stats info | |
1602 popup_window.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7]; | |
1603 pStr = aAttributeNames[(signed int)pButton->msg_param % 7]; | |
1604 break; | |
1605 case UIMSG_PlayerCreationClickPlus: //Plus button info | |
1606 pStr = pGlobalTXT_LocalizationStrings[670];//Äîáàâèòü | |
1607 popup_window.Hint = pGlobalTXT_LocalizationStrings[671];//"Äîáàâëÿåò î÷êî ê âûäåëåííîìó íàâûêó, çàáèðàÿ åãî èç íàêîïèòåëÿ î÷êîâ" | |
1608 break; | |
1609 case UIMSG_PlayerCreationClickMinus: //Minus button info | |
1610 pStr = pGlobalTXT_LocalizationStrings[668];//Âû÷åñòü | |
1611 popup_window.Hint = pGlobalTXT_LocalizationStrings[669];//"Âû÷èòàåò î÷êî èç âûäåëåííîãî íàâûêà, âîçâðàùàÿ åãî â íàêîïèòåëü î÷êîâ" | |
1612 break; | |
1613 case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info | |
1614 pStr = pSkillNames[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; | |
1615 popup_window.Hint = pSkillDesc[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; | |
1616 break; | |
1617 case UIMSG_PlayerCreationSelectClass: //Available Class Info | |
1618 popup_window.Hint = pClassDescriptions[pButton->msg_param]; | |
1619 pStr = pClassNames[pButton->msg_param]; | |
1620 break; | |
1621 case UIMSG_PlayerCreationClickOK: //OK Info | |
1622 popup_window.Hint = pGlobalTXT_LocalizationStrings[664];//Ùåëêíèòå çäåñü äëÿ óòâåðæäåíèÿ ñîñòàâà îòðÿäà è ïðîäîëæåíèÿ èãðû. | |
1623 pStr = pGlobalTXT_LocalizationStrings[665];//Êíîïêà ÎÊ | |
1624 break; | |
1625 case UIMSG_PlayerCreationClickReset: //Clear info | |
1626 popup_window.Hint = pGlobalTXT_LocalizationStrings[666];//Ñáðàñûâàåò âñå ïàðàìåòðû è íàâûêè îòðÿäà. | |
1627 pStr = pGlobalTXT_LocalizationStrings[667];//Êíîïêà Î÷èñòèòü | |
1628 break; | |
1629 case UIMSG_PlayerCreation_SelectAttribute: // Character info | |
1630 pStr = pParty->pPlayers[pButton->msg_param].pName; | |
1631 popup_window.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType]; | |
1632 break; | |
1633 } | |
1634 if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info | |
1635 { | |
1636 pY = 0; | |
1637 if ( (signed int)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48) < 37 ) | |
1638 { | |
1639 strcpy(pTmpBuf2.data(), CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48))); | |
1640 popup_window.Hint = pTmpBuf2.data(); | |
1641 pStr = pSkillNames[pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48)]; | |
1642 } | |
1643 } | |
1644 } | |
1645 } | |
1646 if ( popup_window.Hint ) | |
1647 { | |
1648 pHint = popup_window.Hint; | |
1649 popup_window.Hint = nullptr; | |
1650 popup_window.uFrameWidth = 384; | |
1651 popup_window.uFrameHeight = 256; | |
1652 popup_window.uFrameX = 128; | |
1653 popup_window.uFrameY = 40; | |
1654 popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; | |
1655 popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; | |
1656 popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; | |
1657 popup_window.DrawMessageBox(0); | |
1658 popup_window.uFrameX += 12; | |
1659 popup_window.uFrameWidth -= 24; | |
1660 popup_window.uFrameY += 12; | |
1661 popup_window.uFrameHeight -= 12; | |
1662 popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; | |
1663 popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; | |
1664 sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", Color16(0xFF, 0xFF, 0x9B), pStr); | |
1665 popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); | |
1666 popup_window.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); | |
1667 } | |
1668 break; | |
1669 } | |
1670 default: | |
1671 break; | |
1672 } | |
1673 dword_507BF0_is_there_popup_onscreen = 1; | |
1674 viewparams->bRedrawGameUI = 1; | |
1675 } | |
1676 int no_rightlick_in_inventory = false; // 0050CDCC | |
1677 //----- (00416196) -------------------------------------------------------- | |
1678 void Inventory_ItemPopupAndAlchemy() | |
1679 { | |
1680 int potion1_id; // edx@25 | |
1681 unsigned int potion2_id; // edi@25 | |
1682 signed int potionID; // edx@27 | |
1683 unsigned int pOut_y; // edx@57 | |
1684 double v31; // st7@112 | |
1685 Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 | |
1686 GUIWindow message_window; // [sp+Ch] [bp-84h]@137 | |
1687 POINT cursor; // [sp+78h] [bp-18h]@2 | |
1688 unsigned int damage_level; // [sp+8Ch] [bp-4h]@23 | |
1689 | |
1690 if (no_rightlick_in_inventory) | |
1691 return; | |
1692 | |
1693 pMouse->GetCursorPos(&cursor); | |
1694 int item_pid = (pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF) - 1; | |
1695 if (item_pid == -1) //added here to avoid crash | |
1696 return; | |
1697 ItemGen* item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid]; | |
1698 | |
1699 if (cursor.x <= 13 || cursor.x >= 462)//items out of inventory(âåùè âíå èíâåíòàðÿ) | |
1700 { | |
1701 GameUI_DrawItemInfo(item); | |
1702 return; | |
1703 } | |
1704 | |
1705 if (!item_pid) | |
1706 { | |
1707 int inventory_mouse_x = cursor.x - 14; | |
1708 int inventory_mouse_y = cursor.y - 17; | |
1709 | |
1710 int mouse_cell_x = inventory_mouse_x / 32; | |
1711 int mouse_cell_y = inventory_mouse_y / 32; | |
1712 | |
1713 if (mouse_cell_x + mouse_cell_y < 0) | |
1714 return; | |
1715 | |
1716 int inventory_idx = mouse_cell_x + 14 * mouse_cell_y; | |
1717 if (inventory_idx > 126) | |
1718 return; | |
1719 | |
1720 if (pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx) == 0) | |
1721 return; | |
1722 | |
1723 item_pid = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx); | |
1724 } | |
1725 //check character condition(ïðîâåðêà ñîñòîÿíèÿ ïåðñîíàæà) | |
1726 if (!pPlayers[uActiveCharacter]->CanAct()) | |
1727 { | |
1728 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s íå â ñîñòîÿíèè %s Îïîçíàòü ïðåäìåòû | |
1729 message_window.Hint = pTmpBuf.data(); | |
1730 message_window.uFrameWidth = 384; | |
1731 message_window.uFrameHeight = 180; | |
1732 if (cursor.x <= 320 ) | |
1733 message_window.uFrameX = cursor.x + 30; | |
1734 else | |
1735 message_window.uFrameX = cursor.x - 414; | |
1736 message_window.uFrameY = 40; | |
1737 message_window.DrawMessageBox(0); | |
1738 return; | |
1739 } | |
1740 | |
1741 int alchemy_skill_points = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY) & 0x3F; | |
1742 int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY)); | |
1743 | |
1744 // for potion bottle(ïðîñòàÿ áóòûëêà) | |
1745 if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) | |
1746 { | |
1747 GameUI_DrawItemInfo(item); | |
1748 return; | |
1749 } | |
1750 //for recharge potion(çåëüå ïåðåçàðÿäêà) | |
1751 if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) | |
1752 { | |
1753 if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION)// all potions | |
1754 { | |
1755 if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands | |
1756 { | |
1757 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); | |
1758 return; | |
1759 } | |
1760 | |
1761 v31 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; | |
1762 if ( v31 < 0.0 ) | |
1763 v31 = 0.0; | |
1764 item->uMaxCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); | |
1765 item->uNumCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); | |
1766 | |
1767 pMouse->RemoveHoldingItem(); | |
1768 no_rightlick_in_inventory = 1; | |
1769 return; | |
1770 } | |
1771 GameUI_DrawItemInfo(item); | |
1772 return; | |
1773 } | |
1774 // for harden potion(çåëüå çàêàëêà) | |
1775 else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) | |
1776 { | |
1777 if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // bottle and all potions | |
1778 { | |
1779 if (item->IsBroken() || // cant harden broken items | |
1780 item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts | |
1781 item->GetItemEquipType() < EQUIP_SINGLE_HANDED || | |
1782 item->GetItemEquipType() > EQUIP_WAND) | |
1783 { | |
1784 pMouse->RemoveHoldingItem(); | |
1785 no_rightlick_in_inventory = true; | |
1786 return; | |
1787 } | |
1788 | |
1789 item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; | |
1790 | |
1791 _50C9A8_item_enchantment_timer = 256; | |
1792 pMouse->RemoveHoldingItem(); | |
1793 no_rightlick_in_inventory = true; | |
1794 return; | |
1795 } | |
1796 GameUI_DrawItemInfo(item); | |
1797 return; | |
1798 } | |
1799 // several potions(íåñêîëüêî çåëèé) | |
1800 else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || | |
1801 pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) | |
1802 { | |
1803 if ( item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // all potions | |
1804 { | |
1805 if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || | |
1806 item->uItemID >= ITEM_ARTIFACT_PUCK || | |
1807 item->IsBroken() || | |
2567 | 1808 item->special_enchantment || |
2501 | 1809 item->uEnchantmentType || |
1810 item->GetItemEquipType() >= EQUIP_ARMOUR) // only melee weapons and bows | |
1811 { | |
1812 pMouse->RemoveHoldingItem(); | |
1813 no_rightlick_in_inventory = true; | |
1814 return; | |
1815 } | |
1816 | |
1817 item->UpdateTempBonus(pParty->uTimePlayed); | |
1818 if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) | |
1819 { | |
2567 | 1820 item->special_enchantment = ITEM_ENCHANTMENT_40; // of Slaying |
2501 | 1821 v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); |
1822 } | |
1823 else | |
1824 { | |
2567 | 1825 static ITEM_ENCHANTMENT _4E2904_enchantment_by_potion_lut[] = |
1826 { | |
1827 (ITEM_ENCHANTMENT)164, (ITEM_ENCHANTMENT)93, (ITEM_ENCHANTMENT)22, | |
1828 (ITEM_ENCHANTMENT)164, (ITEM_ENCHANTMENT)93, (ITEM_ENCHANTMENT)22, | |
1829 ITEM_ENCHANTMENT_OF_FLAME, | |
1830 ITEM_ENCHANTMENT_OF_FROST, | |
1831 ITEM_ENCHANTMENT_OF_POISON, | |
1832 ITEM_ENCHANTMENT_OF_SPARKS, | |
1833 (ITEM_ENCHANTMENT)59 | |
1834 }; | |
1835 item->special_enchantment = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; | |
2501 | 1836 v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); |
1837 } | |
1838 | |
1839 item->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; | |
1840 item->uAttributes = alchemy_skill_level | 0x18; | |
1841 | |
1842 _50C9A8_item_enchantment_timer = 256; | |
1843 pMouse->RemoveHoldingItem(); | |
1844 no_rightlick_in_inventory = true; | |
1845 return; | |
1846 } | |
1847 GameUI_DrawItemInfo(item); | |
1848 return; | |
1849 } | |
1850 // use reagents(ïðèìåíåíèå ðåàãåíòîâ) | |
1851 if (pParty->pPickedItem.uItemID >= ITEM_REAGENT_WIDOWSWEEP_BERRIES && pParty->pPickedItem.uItemID <= ITEM_REAGENT_PHILOSOPHERS_STONE && | |
1852 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == ITEM_POTION_BOTTLE) | |
1853 { | |
1854 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = alchemy_skill_points + pParty->pPickedItem.GetDamageDice(); | |
1855 switch ( pParty->pPickedItem.uItemID ) | |
1856 { | |
2567 | 1857 case ITEM_REAGENT_WIDOWSWEEP_BERRIES: |
1858 case ITEM_REAGENT_CRUSHED_ROSE_PETALS: | |
1859 case ITEM_TROLL_BLOOD: | |
1860 case ITEM_TROLL_RUBY: | |
1861 case ITEM_DRAGON_EYE: | |
1862 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = ITEM_POTION_CURE_WOUNDS; | |
2501 | 1863 break; |
2567 | 1864 |
1865 case ITEM_PHIMA_ROOT: | |
1866 case ITEM_METEORITE_FRAGMENT: | |
1867 case ITEM_HARPY_FEATHER: | |
1868 case ITEM_MOONSTONE: | |
1869 case ITEM_ELVISH_TOADSTOOL: | |
1870 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = ITEM_POTION_MAGIC_POTION; | |
2501 | 1871 break; |
2567 | 1872 |
1873 case ITEM_POPPYSNAPS: | |
1874 case ITEM_FAE_DUST: | |
1875 case ITEM_SULFUR: | |
1876 case ITEM_GARNET: | |
1877 case ITEM_DEVIL_ICHOR: | |
1878 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = ITEM_POTION_CURE_WEAKNESS; | |
2501 | 1879 break; |
2567 | 1880 |
1881 case ITEM_MUSHROOM: | |
1882 case ITEM_OBSIDIAN: | |
1883 case ITEM_OOZE_ENDOPLASM_VIAL: | |
1884 case ITEM_MERCURY: | |
1885 case ITEM_REAGENT_PHILOSOPHERS_STONE: | |
1886 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = ITEM_POTION_CATALYST; | |
2501 | 1887 break; |
1888 default: | |
1889 break; | |
1890 } | |
1891 pMouse->RemoveHoldingItem(); | |
1892 no_rightlick_in_inventory = 1; | |
1893 if ( dword_4E455C ) | |
1894 { | |
1895 pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); | |
1896 dword_4E455C = 0; | |
1897 } | |
1898 return; | |
1899 } | |
1900 //potions mixing(ñìåøèâàíèå äâóõ çåëèé) | |
1901 if (pParty->pPickedItem.uItemID >= ITEM_POTION_CATALYST && pParty->pPickedItem.uItemID <= ITEM_POTION_REJUVENATION && | |
1902 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID >= ITEM_POTION_CATALYST && | |
1903 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID <= ITEM_POTION_REJUVENATION) | |
1904 { | |
1905 potion1_id = item->uItemID - ITEM_POTION_CURE_WOUNDS; | |
1906 potion2_id = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; | |
1907 | |
1908 if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || item->uItemID == ITEM_POTION_CATALYST ) | |
1909 potionID = 5; | |
1910 else | |
1911 potionID = pItemsTable->potion_data[potion2_id][potion1_id]; | |
1912 damage_level = 0; | |
1913 if ( alchemy_skill_points ) | |
1914 { | |
1915 if ( potionID < ITEM_POTION_CURE_DISEASE || potionID > ITEM_POTION_AWAKEN )//< 225 >227 | |
1916 { | |
1917 if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY && alchemy_skill_level == 1)//228 >= potionID <= 239 | |
1918 damage_level = 2; | |
1919 if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE && alchemy_skill_level <= 2)//240 >= potionID <= 261 | |
1920 damage_level = 3; | |
1921 if ( potionID >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_level <= 3 )// 262 < potionID | |
1922 damage_level = 4; | |
1923 } | |
1924 } | |
1925 else//no skill(íåò íàâûêà) | |
1926 { | |
1927 if ( potionID >= ITEM_POTION_CURE_DISEASE && potionID <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227 | |
1928 damage_level = 1; | |
1929 if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239 | |
1930 damage_level = 2; | |
1931 if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261 | |
1932 damage_level = 3; | |
1933 if ( potionID >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16 | |
1934 damage_level = 4; | |
1935 } | |
1936 | |
1937 int pOut_x = item_pid + 1; | |
1938 for ( uint i = 0; i < 126; ++i ) | |
1939 { | |
1940 if ( pPlayers[uActiveCharacter]->pInventoryMatrix[i] == pOut_x ) | |
1941 { | |
1942 pOut_y = i; | |
1943 break; | |
1944 } | |
1945 } | |
1946 if ( !potionID ) | |
1947 { | |
1948 GameUI_DrawItemInfo(item); | |
1949 return; | |
1950 } | |
1951 | |
2566 | 1952 if (damage_level > 0) |
2501 | 1953 { |
2566 | 1954 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); |
2501 | 1955 |
2566 | 1956 if (damage_level == 1) |
1957 { | |
1958 pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE); | |
1959 } | |
1960 else if (damage_level == 2) | |
1961 { | |
1962 pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE); | |
1963 pPlayers[uActiveCharacter]->ItemsEnchant(1); | |
1964 } | |
1965 else if (damage_level == 3) | |
1966 { | |
1967 pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 201 + 50, DMGT_FIRE); | |
1968 pPlayers[uActiveCharacter]->ItemsEnchant(5); | |
1969 } | |
1970 else if (damage_level >= 4) | |
1971 { | |
1972 pPlayers[uActiveCharacter]->SetCondition(Condition_Eradicated, 0); | |
1973 pPlayers[uActiveCharacter]->ItemsEnchant(0); | |
1974 } | |
1975 | |
1976 pAudioPlayer->PlaySound(SOUND_fireBall, 0, 0, -1, 0, 0, 0, 0); | |
1977 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1978 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
1979 v39.x = pParty->vPosition.x; | |
1980 v39.y = pParty->vPosition.y; | |
1981 | |
1982 int rot_x, rot_y, rot_z; | |
1983 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); | |
1984 SpriteObject::sub_42F7EB_DropItemAt(SPRITE_SPELL_FIRE_FIREBALL_IMPACT, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); | |
1985 if (dword_4E455C) | |
1986 { | |
1987 if (pPlayers[uActiveCharacter]->CanAct()) | |
1988 pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); | |
1989 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Îé! | |
1990 dword_4E455C = 0; | |
1991 } | |
1992 pMouse->RemoveHoldingItem(); | |
1993 no_rightlick_in_inventory = 1; | |
1994 return; | |
2501 | 1995 } |
2566 | 1996 else //if ( damage_level == 0 ) |
2501 | 1997 { |
1998 if ( alchemy_skill_points ) | |
1999 { | |
2567 | 2000 if (pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == ITEM_POTION_CATALYST || pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST) |
2501 | 2001 { |
2567 | 2002 if (pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == ITEM_POTION_CATALYST) |
2501 | 2003 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = pParty->pPickedItem.uItemID; |
2567 | 2004 if (pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST) |
2501 | 2005 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = pParty->pPickedItem.uEnchantmentType; |
2006 } | |
2007 else | |
2008 { | |
2009 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = potionID; | |
2010 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType | |
2011 + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) / 2; | |
2012 pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, pItemsTable->potion_note[potion1_id][potion2_id]); | |
2013 } | |
2567 | 2014 int bottle = pPlayers[uActiveCharacter]->AddItem(-1, ITEM_POTION_BOTTLE); |
2501 | 2015 if ( bottle ) |
2016 pPlayers[uActiveCharacter]->pOwnItems[bottle - 1].uAttributes = ITEM_IDENTIFIED; | |
2017 if ( !(pItemsTable->pItems[pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID].uItemID_Rep_St) ) | |
2018 pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uAttributes |= 1; | |
2019 if ( !dword_4E455C ) | |
2020 { | |
2021 pMouse->RemoveHoldingItem(); | |
2022 no_rightlick_in_inventory = 1; | |
2023 return; | |
2024 } | |
2025 pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); | |
2026 dword_4E455C = 0; | |
2027 pMouse->RemoveHoldingItem(); | |
2028 no_rightlick_in_inventory = 1; | |
2029 return; | |
2030 } | |
2031 GameUI_DrawItemInfo(item); | |
2032 return; | |
2033 } | |
2034 } | |
2035 GameUI_DrawItemInfo(item); | |
2036 return; | |
2037 } | |
2038 | |
2039 | |
2040 //----- (0045828B) -------------------------------------------------------- | |
2041 unsigned int __fastcall GetSpellColor(signed int a1) | |
2042 { | |
2043 if ( a1 == 0 ) | |
2044 return Color16(0, 0, 0); | |
2045 if ( a1 < 12 ) | |
2046 return Color16(255, 85, 0); | |
2047 if ( a1 < 23 ) | |
2048 return Color16(150, 212, 255); | |
2049 if ( a1 < 34 ) | |
2050 return Color16(0, 128, 255); | |
2051 if ( a1 < 45 ) | |
2052 return Color16(128, 128, 128); | |
2053 if ( a1 < 56 ) | |
2054 return Color16(225, 225, 225); | |
2055 if ( a1 < 67 ) | |
2056 return Color16(235, 15, 255); | |
2057 if ( a1 < 78 ) | |
2058 return Color16(255, 128, 0); | |
2059 if ( a1 < 89 ) | |
2060 return Color16(255, 255, 155); | |
2061 if ( a1 < 100 ) | |
2062 return Color16(192, 192, 240); | |
2063 else | |
2064 __debugbreak(); | |
2065 } | |
2066 | |
2067 //----- (004B46F8) -------------------------------------------------------- | |
2068 __int64 GetExperienceRequiredForLevel(int level) | |
2069 { | |
2070 __int64 v1; // eax@1 | |
2071 int i; // edx@1 | |
2072 | |
2073 v1 = 0; | |
2074 for (i = 0; i < level; ++i) | |
2075 v1 += i + 1; | |
2076 return 1000 * v1; | |
2077 } |