OSDN Git Service

日本語版
[nazghul-jp/nazghul-jp.git] / src / ztats_arms.c
1 /*
2  * nazghul - an old-school RPG engine
3  * Copyright (C) 2008 Gordon McNutt
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the Free
7  * Software Foundation; either version 2 of the License, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Foundation, Inc., 59 Temple Place,
17  * Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Gordon McNutt
20  * gmcnutt@users.sourceforge.net
21  */
22
23 #include "ztats_arms.h"
24
25 #include "Arms.h"
26 #include "screen.h"
27 #include "sprite.h"
28 #include "ztats.h"
29 #include "ztats_container_pane.h"
30
31
32 static void ztats_arms_paint_item(struct inv_entry *ie, SDL_Rect *rect)
33 {
34         ArmsType *arms = (ArmsType*)ie->type;
35         
36         assert(ie->count);
37         
38         /* sprite */
39         sprite_paint(arms->getSprite(), 0, rect->x, rect->y);
40         rect->x += TILE_W;
41         
42         /* quantity and name */
43         if (ie->ref) {
44                 screenPrint(rect, 0, "%2d %s ^c+%c[%d »ÈÍÑÃæ]^c-", ie->count, arms->getName(), STAT_INUSE_CLR, ie->ref);
45         } else {
46                 screenPrint(rect, 0, "%2d %s", ie->count, arms->getName());
47         }
48         rect->y += ASCII_H;
49         
50         /* stats */
51         status_show_arms_stats(rect, arms);
52         rect->x -= TILE_W;
53 }
54
55 static bool ztats_arms_filter_cb(struct inv_entry *ie, void *fdata)
56 {
57         return (ie->type->isReadyable());
58 }
59
60
61 void ztats_arms_init(void)
62 {
63         static struct ztats_container_pane pane;
64         static struct ztats_container_pane_ops ops = {
65                 ztats_arms_paint_item
66         };
67         static struct filter filter = {
68                 ztats_arms_filter_cb,
69                 NULL
70         };
71
72         ztats_container_pane_init(&pane, "ÉðÁõ", &filter, &ops);
73         ztats_add_pane(&pane.base);
74 }