source: abuse/trunk/src/help.cpp @ 489

Last change on this file since 489 was 481, checked in by Sam Hocevar, 10 years ago

Fuck the history, I'm renaming all .hpp files to .h for my own sanity.

File size: 1.4 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *
5 *  This software was released into the Public Domain. As with most public
6 *  domain software, no warranty is made or implied by Crack dot Com or
7 *  Jonathan Clark.
8 */
9
10#include "config.h"
11
12#include "help.h"
13#include "game.h"
14#include "netcfg.h"
15
16int total_help_screens;
17int *help_screens;
18static int help_page=0;
19
20void fade_in(image *im, int steps);
21void fade_out(int steps);
22
23void draw_help()
24{
25  image *im=cache.img(help_screens[help_page]);
26  int x1=xres/2-im->width()/2,y1=yres/2-im->height()/2;
27  int x2=x1+im->width(),y2=y1+im->height();
28  im->put_image(screen,x1,y1);
29  screen->bar(0,0,x1-1,yres,0);
30  screen->bar(0,0,xres,y1-1,0);
31  screen->bar(x2,y1,xres,yres,0);
32  screen->bar(x1,y2,x2,yres,0);
33}
34
35void help_handle_event(event &ev)
36{
37  if (ev.window!=NULL) return ;
38
39  if (the_game->state!=HELP_STATE)
40  {
41    if (ev.type==EV_KEY && (ev.key=='h' || ev.key=='?' || ev.key==JK_F1) && help_screens)
42    {
43      if (!main_net_cfg || (main_net_cfg->state!=net_configuration::SERVER && main_net_cfg->state!=net_configuration::CLIENT))
44      {
45    the_game->state=HELP_STATE;
46    help_page=0;
47      }
48    }
49  } else if (ev.type==EV_KEY)
50  {
51    if (ev.key==JK_ESC || help_page>=total_help_screens-1)
52    {
53      the_game->state=RUN_STATE;
54      the_game->draw(0);
55    }
56    else
57      help_page++;
58  }
59}
Note: See TracBrowser for help on using the repository browser.