MCPcopy Create free account
hub / github.com/crossuo/crossuo / SelectObjectHandlesTexture

Method SelectObjectHandlesTexture

src/GameObjects/GameObject.cpp:170–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170void CGameObject::SelectObjectHandlesTexture()
171{
172 if (m_TextureObjectHandles.Texture != 0)
173 {
174 int x = DrawX - g_ObjectHandlesWidthOffset;
175 int y = DrawY;
176
177 if (NPC)
178 {
179 CGameCharacter *gc = (CGameCharacter *)this;
180 const AnimationState anim = { this->GetGraphicForAnimation(), 0, 0 };
181 const auto dims = g_AnimationManager.GetAnimationDimensions(
182 this->AnimIndex, anim, this->IsMounted(), this->IsCorpse());
183 x += gc->OffsetX;
184 y += gc->OffsetY - (gc->OffsetZ + dims.Height + dims.CenterY + s_objectHandleOffsetY);
185 }
186 else if (IsCorpse())
187 {
188 x += 20;
189 y -= g_Game.GetStaticArtDimension(Graphic).Height + s_bodyHandleOffsetY;
190 }
191 else
192 {
193 y -= g_Game.GetStaticArtDimension(Graphic).Height;
194 }
195
196 x = g_MouseManager.Position.X - x;
197 y = g_MouseManager.Position.Y - y;
198
199 if (x < 0 || x >= g_ObjectHandlesWidth || y < 0 || y >= g_ObjectHandlesHeight)
200 {
201 return;
202 }
203
204 if (g_ObjectHandlesBackgroundPixels[(y * g_ObjectHandlesWidth) + x] != 0)
205 {
206 g_SelectedObject.Init(this);
207 g_SelectedGameObjectHandle = Serial;
208 }
209 }
210}
211
212void CGameObject::GenerateObjectHandlesTexture(wstr_t text)
213{

Callers 1

DrawGameWindowMethod · 0.80

Calls 6

IsMountedMethod · 0.95
IsCorpseMethod · 0.95
GetStaticArtDimensionMethod · 0.80
InitMethod · 0.45

Tested by

no test coverage detected