MCPcopy Create free account
hub / github.com/diasurgical/devilution / FocusOnCharInfo

Function FocusOnCharInfo

SourceX/miniwin/misc_msg.cpp:43–78  ·  view source on GitHub ↗

Moves the mouse to the first attribute "+" button.

Source from the content-addressed store, hash-verified

41
42// Moves the mouse to the first attribute "+" button.
43void FocusOnCharInfo()
44{
45 if (invflag || plr[myplr]._pStatPts <= 0)
46 return;
47
48 // Find the first incrementable stat.
49 int pc = plr[myplr]._pClass;
50 int stat = -1;
51 for (int i = 4; i >= 0; --i) {
52 switch (i) {
53 case ATTRIB_STR:
54 if (plr[myplr]._pBaseStr >= MaxStats[pc][ATTRIB_STR])
55 continue;
56 break;
57 case ATTRIB_MAG:
58 if (plr[myplr]._pBaseMag >= MaxStats[pc][ATTRIB_MAG])
59 continue;
60 break;
61 case ATTRIB_DEX:
62 if (plr[myplr]._pBaseDex >= MaxStats[pc][ATTRIB_DEX])
63 continue;
64 break;
65 case ATTRIB_VIT:
66 if (plr[myplr]._pBaseVit >= MaxStats[pc][ATTRIB_VIT])
67 continue;
68 break;
69 default:
70 continue;
71 }
72 stat = i;
73 }
74 if (stat == -1)
75 return;
76 const auto &rect = ChrBtnsRect[stat];
77 SetCursorPos(rect.x + (rect.w / 2), rect.y + (rect.h / 2));
78}
79
80static int translate_sdl_key(SDL_Keysym key)
81{

Callers 3

BlurInventoryFunction · 0.85
PeekMessageAFunction · 0.85
NextPlrLevelFunction · 0.85

Calls 1

SetCursorPosFunction · 0.85

Tested by

no test coverage detected