1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
4 // Copyright(C) 1993-1996 Id Software, Inc.
5 // Copyright(C) 2005 Simon Howard
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 // The status bar widget code.
25 //-----------------------------------------------------------------------------
48 extern boolean automapactive
;
54 // Hack display negative frags.
55 // Loads and store the stminus lump.
61 sttminus
= (patch_t
*) W_CacheLumpName(DEH_String("STTMINUS"), PU_STATIC
);
87 // A fairly efficient way to draw a number
88 // based on differences from the old number.
89 // Note: worth the trouble?
97 int numdigits
= n
->width
;
100 int w
= SHORT(n
->p
[0]->width
);
101 int h
= SHORT(n
->p
[0]->height
);
112 if (numdigits
== 2 && num
< -9)
114 else if (numdigits
== 3 && num
< -99)
121 x
= n
->x
- numdigits
*w
;
124 I_Error("drawNum: n->y - ST_Y < 0");
126 V_CopyRect(x
, n
->y
- ST_Y
, BG
, w
*numdigits
, h
, x
, n
->y
, FG
);
128 // if non-number, do not draw it
134 // in the special case of 0, you draw 0
136 V_DrawPatch(x
- w
, n
->y
, FG
, n
->p
[ 0 ]);
138 // draw the new number
139 while (num
&& numdigits
--)
142 V_DrawPatch(x
, n
->y
, FG
, n
->p
[ num
% 10 ]);
146 // draw a minus sign if necessary
148 V_DrawPatch(x
- 8, n
->y
, FG
, sttminus
);
158 if (*n
->on
) STlib_drawNum(n
, refresh
);
173 STlib_initNum(&p
->n
, x
, y
, pl
, num
, on
, 3);
185 if (refresh
&& *per
->n
.on
)
186 V_DrawPatch(per
->n
.x
, per
->n
.y
, FG
, per
->p
);
188 STlib_updateNum(&per
->n
, refresh
);
223 && (mi
->oldinum
!= *mi
->inum
|| refresh
)
226 if (mi
->oldinum
!= -1)
228 x
= mi
->x
- SHORT(mi
->p
[mi
->oldinum
]->leftoffset
);
229 y
= mi
->y
- SHORT(mi
->p
[mi
->oldinum
]->topoffset
);
230 w
= SHORT(mi
->p
[mi
->oldinum
]->width
);
231 h
= SHORT(mi
->p
[mi
->oldinum
]->height
);
234 I_Error("updateMultIcon: y - ST_Y < 0");
236 V_CopyRect(x
, y
-ST_Y
, BG
, w
, h
, x
, y
, FG
);
238 V_DrawPatch(mi
->x
, mi
->y
, FG
, mi
->p
[*mi
->inum
]);
239 mi
->oldinum
= *mi
->inum
;
275 && (bi
->oldval
!= *bi
->val
|| refresh
))
277 x
= bi
->x
- SHORT(bi
->p
->leftoffset
);
278 y
= bi
->y
- SHORT(bi
->p
->topoffset
);
279 w
= SHORT(bi
->p
->width
);
280 h
= SHORT(bi
->p
->height
);
283 I_Error("updateBinIcon: y - ST_Y < 0");
286 V_DrawPatch(bi
->x
, bi
->y
, FG
, bi
->p
);
288 V_CopyRect(x
, y
-ST_Y
, BG
, w
, h
, x
, y
, FG
);
290 bi
->oldval
= *bi
->val
;