14 static image_t
*g_panel
;
15 static image_t
*g_shot
;
16 static image_t
*g_icon
[ITEM_COUNT
];
17 static image_t
*g_bonus
;
19 static bool_t isPanelInit
= FALSE
;
21 bool_t
panel_is_inicialized()
28 assert(image_is_inicialized() == TRUE
);
29 assert(interface_is_inicialized() == TRUE
);
31 g_panel
= image_add("panel.png", IMAGE_ALPHA
, "panel", IMAGE_GROUP_BASE
);
32 g_shot
= image_add("panel_shot.png", IMAGE_ALPHA
, "panel_image_shot",IMAGE_GROUP_BASE
);
33 g_bonus
= image_add("graf.bonus.png", IMAGE_ALPHA
, "panel_graf_bonus", IMAGE_GROUP_BASE
);
34 g_icon
[GUN_SIMPLE
] = image_add("icon.gun.simple.png", IMAGE_ALPHA
, "panel_gun", IMAGE_GROUP_BASE
);
35 g_icon
[GUN_DUAL_SIMPLE
] = image_add("icon.gun.dual.simple.png", IMAGE_ALPHA
, "panel_dual", IMAGE_GROUP_BASE
);
36 g_icon
[GUN_TOMMY
] = image_add("icon.gun.tommy.png", IMAGE_ALPHA
, "panel_tommy", IMAGE_GROUP_BASE
);
37 g_icon
[GUN_SCATTER
] = image_add("icon.gun.scatter.png", IMAGE_ALPHA
, "panel_scatter", IMAGE_GROUP_BASE
);
38 g_icon
[GUN_LASSER
] = image_add("icon.gun.lasser.png", IMAGE_ALPHA
, "panel_lasser", IMAGE_GROUP_BASE
);
39 g_icon
[GUN_MINE
] = image_add("icon.gun.mine.png", IMAGE_ALPHA
, "panel_mine", IMAGE_GROUP_BASE
);
40 g_icon
[GUN_BOMBBALL
] = image_add("icon.gun.bombball.png", IMAGE_ALPHA
, "panel_bombball", IMAGE_GROUP_BASE
);
41 g_icon
[BONUS_SPEED
] = image_add("icon.bonus.speed.png", IMAGE_ALPHA
, "panel_speed", IMAGE_GROUP_BASE
);
42 g_icon
[BONUS_SHOT
] = image_add("icon.bonus.shot.png", IMAGE_ALPHA
, "panel_shot", IMAGE_GROUP_BASE
);
43 g_icon
[BONUS_TELEPORT
] = image_add("icon.bonus.teleport.png", IMAGE_ALPHA
, "panel_teleport", IMAGE_GROUP_BASE
);
44 g_icon
[BONUS_GHOST
] = image_add("icon.bonus.ghost.png", IMAGE_ALPHA
, "panel_ghost", IMAGE_GROUP_BASE
);
45 g_icon
[BONUS_4X
] = image_add("icon.bonus.4x.png", IMAGE_ALPHA
, "panel_4x", IMAGE_GROUP_BASE
);
46 g_icon
[BONUS_HIDDEN
] = image_add("icon.bonus.hidden.png", IMAGE_ALPHA
, "panel_hidden", IMAGE_GROUP_BASE
);
51 static void drawScore(tux_t
*tux_left
, tux_t
*tux_right
)
53 char strScoreLine
[STR_SIZE
];
56 if (tux_right
!= NULL
&& tux_left
!= NULL
) {
57 sprintf(strScoreLine
, "%d : %d", tux_right
->score
, tux_left
->score
);
58 } else if (tux_right
!= NULL
) {
59 sprintf(strScoreLine
, "%d", tux_right
->score
);
60 } else if (tux_left
!= NULL
) {
61 sprintf(strScoreLine
, "%d", tux_left
->score
);
64 font_text_size(strScoreLine
, &w
, &h
);
65 font_draw(strScoreLine
, PANEL_SCORE_LOCATION_X
, PANEL_SCORE_LOCATION_Y
, COLOR_WHITE
);
68 static void shot_draw(int n
, int x
, int y
)
70 image_draw(g_shot
, x
, y
, n
* PANEL_SHOT_WIDTH
, 0, PANEL_SHOT_WIDTH
, PANEL_SHOT_HEIGHT
);
73 static void shot_drawInfo(tux_t
*tux
, int x
, int y
)
77 if (tux
->pickup_time
> 0) {
78 for (i
= 0; i
< tux
->pickup_time
/ 3; i
++) {
79 shot_draw(PANEL_SHOT_LINE
, x
+ i
* PANEL_SHOT_WIDTH
, y
);
85 for (i
= 0; i
< GUN_MAX_SHOT
; i
++) {
86 if (tux
->shot
[tux
->gun
] > i
) {
87 shot_draw(PANEL_SHOT_FILL
, x
+ i
* (PANEL_SHOT_WIDTH
+ 2), y
);
89 shot_draw(PANEL_SHOT_EMPTY
, x
+ i
* (PANEL_SHOT_WIDTH
+ 2), y
);
94 static void drawGunInfo(tux_t
*tux
, int x
, int y
)
96 image_draw(g_icon
[tux
->gun
], x
, y
, 0, 0, g_icon
[tux
->gun
]->w
, g_icon
[tux
->gun
]->h
);
99 static void drawBonusInfo(tux_t
*tux
, int x
, int y
)
101 image_draw(g_icon
[tux
->bonus
], x
, y
, 0, 0, g_icon
[tux
->bonus
]->w
, g_icon
[tux
->bonus
]->h
);
104 static void drawGrafBonus(tux_t
*tux
, int x
, int y
)
108 offset
= tux
->bonus_time
/ 5;
109 image_draw(g_bonus
, x
, y
, 0, 0, g_bonus
->w
, g_bonus
->h
/ 2);
110 image_draw(g_bonus
, x
+ 1, y
, 0, g_bonus
->h
/ 2, offset
, g_bonus
->h
/ 2);
113 static void tux_drawRight(tux_t
*tux
)
119 shot_drawInfo(tux
, PANEL_LOCATION_X
+ 740, PANEL_LOCATION_Y
+ 34);
120 drawGunInfo(tux
, PANEL_LOCATION_X
+ 620, PANEL_LOCATION_Y
+ 30);
122 if (tux
->bonus
!= BONUS_NONE
) {
123 drawGrafBonus(tux
, PANEL_LOCATION_X
+ 460, PANEL_LOCATION_Y
+ 50);
124 drawBonusInfo(tux
, PANEL_LOCATION_X
+ 460, PANEL_LOCATION_Y
+ 30);
128 static void tux_drawLeft(tux_t
*tux
)
134 shot_drawInfo(tux
, PANEL_LOCATION_X
+ 8, PANEL_LOCATION_Y
+ 34);
135 drawGunInfo(tux
, PANEL_LOCATION_X
+ 130, PANEL_LOCATION_Y
+ 30);
137 if (tux
->bonus
!= BONUS_NONE
) {
138 drawGrafBonus(tux
, PANEL_LOCATION_X
+ 200, PANEL_LOCATION_Y
+ 50);
139 drawBonusInfo(tux
, PANEL_LOCATION_X
+ 200, PANEL_LOCATION_Y
+ 30);
143 void panel_draw(tux_t
*tux_right
, tux_t
*tux_left
)
145 image_draw(g_panel
, PANEL_LOCATION_X
, PANEL_LOCATION_Y
, 0, 0, g_panel
->w
, g_panel
->h
);
146 drawScore(tux_right
, tux_left
);
148 if (chat_is_recived_new_msg()) {
149 font_draw(_("Recived new chat message"), PANEL_LOCATION_X
, PANEL_LOCATION_Y
, COLOR_WHITE
);
152 tux_drawRight(tux_right
);
153 tux_drawLeft(tux_left
);