parent
ea628cb000
commit
56b1106ab2
@ -0,0 +1,127 @@
|
|||||||
|
/* $Id: help.c,v 1.1 2004/02/07 13:35:28 stpohle Exp $
|
||||||
|
* Display complex help text and information screen about the game
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bomberclone.h"
|
||||||
|
#include "menu.h"
|
||||||
|
|
||||||
|
#define HELP_MAXPAGES 3
|
||||||
|
|
||||||
|
void help () {
|
||||||
|
int page = 0, menuselect = 2, y = 0;
|
||||||
|
char title[255];
|
||||||
|
SDL_Rect rect;
|
||||||
|
|
||||||
|
menu_displaytext ("Please Wait", "Loading GFX Data");
|
||||||
|
tileset_load ("default", 32, 32);
|
||||||
|
gfx_load_players (gfx.block.x, gfx.block.y);
|
||||||
|
|
||||||
|
while (menuselect != -1 && menuselect != 1 && bman.state != GS_quit) {
|
||||||
|
if (page == 0) {
|
||||||
|
sprintf (title, "How To Play (%d/%d)", page + 1, HELP_MAXPAGES);
|
||||||
|
menu_new (title, 500, 400);
|
||||||
|
menu_create_text ("help", -1, 55, 53, 20,
|
||||||
|
"The goal of the game is to be the last one, "
|
||||||
|
"who is alive. You can drop bombs which will explode after "
|
||||||
|
"a certain time and destroy everything in horizontal and vertical "
|
||||||
|
"direction. So you can remove stones or kill other players. But take care. "
|
||||||
|
"Don't kill yourself otherwise the game will be over for you. During the "
|
||||||
|
"game you will find diffrenent powerups to raise your skills. If you are "
|
||||||
|
"running faster than your opponent and you have many bombs, you can catch "
|
||||||
|
"him within lots of bombs and he has no chance to escape.");
|
||||||
|
|
||||||
|
menu_create_text ("help", -1, 255, 53, 10,
|
||||||
|
"You will get points for every player you have killed. "
|
||||||
|
"If you win the game, you can earn additional points "
|
||||||
|
"depending on how many players played the game. ");
|
||||||
|
}
|
||||||
|
else if (page == 1) {
|
||||||
|
sprintf (title, "Powerups (%d/%d)", page + 1, HELP_MAXPAGES);
|
||||||
|
menu_new (title, 500, 400);
|
||||||
|
|
||||||
|
y = 50;
|
||||||
|
|
||||||
|
rect.x = rect.y = 0;
|
||||||
|
rect.w = gfx.block.x;
|
||||||
|
rect.h = gfx.block.y;
|
||||||
|
|
||||||
|
|
||||||
|
menu_create_text ("help", -1, y, 53, 10,
|
||||||
|
"In the game you will find some diffend kind of powerups. "
|
||||||
|
"There are the powerups who give you more power for the whole game "
|
||||||
|
"and the special powerups which will hold only for a certain time.");
|
||||||
|
y += 80;
|
||||||
|
|
||||||
|
menu_create_label ("Permanent Powerups", -1, y, 2);
|
||||||
|
y += (5 + font[2].size.y);
|
||||||
|
|
||||||
|
menu_create_image ("pwback", 5, y, 0, gfx.powerup[0].image, &rect);
|
||||||
|
menu_create_image ("bomb", 5, y, 1, gfx.field[FT_bomb].image, &rect);
|
||||||
|
menu_create_text ("help", 55, y, 45, 10,
|
||||||
|
"Give you another bomb to drop. Maximum number of bombs is %d.", MAX_BOMBS);
|
||||||
|
y += 40;
|
||||||
|
|
||||||
|
menu_create_image ("pwback", 5, y, 0, gfx.powerup[0].image, &rect);
|
||||||
|
menu_create_image ("fire", 5, y, 1, gfx.field[FT_fire].image, &rect);
|
||||||
|
menu_create_text ("help", 55, y, 45, 10,
|
||||||
|
"The range of your bombs will be increased. Maximum range is %d.", MAX_RANGE);
|
||||||
|
y += 40;
|
||||||
|
|
||||||
|
menu_create_image ("pwback", 5, y, 0, gfx.powerup[0].image, &rect);
|
||||||
|
menu_create_image ("shoe", 5, y, 1, gfx.field[FT_shoe].image, &rect);
|
||||||
|
menu_create_text ("help", 55, y, 45, 10,
|
||||||
|
"This will make your player run faster. The maximum speed will be %1.2f.", MAX_SPEED);
|
||||||
|
y += 40;
|
||||||
|
|
||||||
|
menu_create_text ("help", -1, y, 53, 10,
|
||||||
|
"Depends how the game is set up, you'll lose "
|
||||||
|
"these powerups if you die. Other players can collect them. "
|
||||||
|
"In the deathmatch mode you can keep the powerups you collected, "
|
||||||
|
"but this depends on the Game if you drop them or not.");
|
||||||
|
y += 40;
|
||||||
|
}
|
||||||
|
else if (page == 2) {
|
||||||
|
sprintf (title, "Powerups (%d/%d)", page + 1, HELP_MAXPAGES);
|
||||||
|
menu_new (title, 500, 400);
|
||||||
|
|
||||||
|
y = 50;
|
||||||
|
|
||||||
|
rect.x = rect.y = 0;
|
||||||
|
rect.w = gfx.block.x;
|
||||||
|
rect.h = gfx.block.y;
|
||||||
|
|
||||||
|
menu_create_label ("Special Powerups", -1, y, 2);
|
||||||
|
y += (10 + font[2].size.y);
|
||||||
|
|
||||||
|
menu_create_image ("pwback", 5, y, 0, gfx.powerup[2].image, &rect);
|
||||||
|
menu_create_image ("kick", 5, y, 1, gfx.field[FT_sp_kick].image, &rect);
|
||||||
|
menu_create_text ("help", 55, y, 45, 10,
|
||||||
|
"Give you another bomb to drop. Maximum number of bombs is %d.", MAX_BOMBS);
|
||||||
|
y += 40;
|
||||||
|
|
||||||
|
menu_create_image ("pwback", 5, y, 0, gfx.powerup[2].image, &rect);
|
||||||
|
menu_create_image ("push", 5, y, 1, gfx.field[FT_sp_push].image, &rect);
|
||||||
|
menu_create_text ("help", 55, y, 45, 10,
|
||||||
|
"Give you another bomb to drop. Maximum number of bombs is %d.", MAX_BOMBS);
|
||||||
|
y += 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
else break;
|
||||||
|
|
||||||
|
if (page > 0) menu_create_button ("Previous Page", 20, 370, 150, 0);
|
||||||
|
else if (menuselect == 0)
|
||||||
|
menuselect = 2;
|
||||||
|
menu_create_button ("Main Menu", -1, 370, 150, 1);
|
||||||
|
if (page < HELP_MAXPAGES-1) menu_create_button ("Next Page", 350, 370, 150, 2);
|
||||||
|
|
||||||
|
menu_focus_id (menuselect);
|
||||||
|
menuselect = menu_loop ();
|
||||||
|
if (menuselect == 0 && page > 0)
|
||||||
|
page--;
|
||||||
|
if (menuselect == 2 && page < HELP_MAXPAGES - 1)
|
||||||
|
page++;
|
||||||
|
menu_delete ();
|
||||||
|
}
|
||||||
|
gfx_free_players ();
|
||||||
|
tileset_free ();
|
||||||
|
};
|
@ -0,0 +1,64 @@
|
|||||||
|
/* $Id: menuimages.c,v 1.1 2004/02/07 13:35:28 stpohle Exp $
|
||||||
|
* Menuhandling: labels */
|
||||||
|
|
||||||
|
#include "basic.h"
|
||||||
|
#include "bomberclone.h"
|
||||||
|
#include "menu.h"
|
||||||
|
#include "menugui.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* draw the menuitem label
|
||||||
|
* menuitem->pos.[x|y] - Position inside the menu
|
||||||
|
* pos.w - Fontsize
|
||||||
|
* label - Text of the label
|
||||||
|
*/
|
||||||
|
void menu_draw_image (_menuitem *mi) {
|
||||||
|
SDL_Rect src, dest;
|
||||||
|
|
||||||
|
if (mi->type != MENU_image)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (mi->pos.x == -1)
|
||||||
|
dest.x = (menu.oldscreenpos.w - 2*menu.images[0]->w - mi->rect.w) / 2;
|
||||||
|
else
|
||||||
|
dest.x = mi->pos.x;
|
||||||
|
if (mi->pos.y == -1)
|
||||||
|
dest.y = (menu.oldscreenpos.h - 2*menu.images[0]->h - mi->rect.h) / 2;
|
||||||
|
else
|
||||||
|
dest.y = mi->pos.y;
|
||||||
|
|
||||||
|
src.w = dest.w = mi->rect.w;
|
||||||
|
src.h = dest.h = mi->rect.h;
|
||||||
|
src.x = mi->rect.x;
|
||||||
|
src.y = mi->rect.y;
|
||||||
|
dest.x += menu.oldscreenpos.x + menu.images[0]->w;
|
||||||
|
dest.y += menu.oldscreenpos.y + menu.images[0]->h;
|
||||||
|
|
||||||
|
gfx_blit ((SDL_Surface *) mi->ptrdata, &src, gfx.screen, &dest, 10000+mi->pos.w);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void menu_create_image (char *name, int x, int y, int layer, SDL_Surface *img, SDL_Rect *rect) {
|
||||||
|
int i = menu_getlastitem(menu.items);
|
||||||
|
|
||||||
|
if (i == -1) { /* first entry in the itemslist */
|
||||||
|
menu.items = &menuitems[0];
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
else if (i >= MENU_MAXENTRYS) { /* max items reached, ignore new item */
|
||||||
|
d_fatal ("menu_create_image: MENU_MAXENTRYS reached. Item Ignored\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else { /* add new item to the list */
|
||||||
|
menuitems[i].next = &menuitems[i+1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
menuitems[i].pos.x = x;
|
||||||
|
menuitems[i].pos.y = y;
|
||||||
|
menuitems[i].pos.w = layer;
|
||||||
|
menuitems[i].type = MENU_image;
|
||||||
|
menuitems[i].ptrdata = (char *) img;
|
||||||
|
menuitems[i].rect = *rect;
|
||||||
|
strncpy (menuitems[i].label, name, MENU_TITLELEN);
|
||||||
|
};
|
Loading…
Reference in new issue