1 /***************************************************************************
2 ****************************************************************************
3 ****************************************************************************
4 * Nighthawk
5 * Copyright (C) 1996-2004 Jason Nunn et al
6 * Developed by Jason Nunn et al (see README for Acknowledgements)
7 *
8 * Project head and maintainer--
9 *   Eric Gillespie (The Viking)
10 *   Email: viking667@users.sourceforge.net
11 *   http://night-hawk.sourceforge.net
12 *
13 * Original Author--
14 *   Jason Nunn
15 *   http://jsno.leal.com.au
16 *
17 *   C/- Jason Nunn
18 *   PO Box 15
19 *   Birdwood SA 5234
20 *   Australia
21 *
22 * This software is Open Source GPL. Please read COPYING notice.
23 * ==================================================================
24 * power bay routines
25 *
26 ****************************************************************************
27 ****************************************************************************
28 ***************************************************************************/
29 #include "defs.h"
30 #include "protos.p"
31 
32 #include "tfloor.h"
33 
34 /***************************************************************************
35 *
36 ***************************************************************************/
tpower_bay(void)37 tpower_bay::tpower_bay(void)
38 {
39   anim_len = 5.0;
40   anim_ptr = 0.0;
41   anim_speed = 0.2;
42   bm = &power_bay_bm[0];
43 }
44 
init(int px,int py)45 void tpower_bay::init(int px, int py)
46 {
47   pos_x = px;
48   pos_y = py;
49 }
50 
draw(int px,int py)51 void tpower_bay::draw(int px, int py)
52 {
53   int ix, iy;
54 
55   ix = (pos_x - px) + SCREEN_HSIZE_X - SPRITE_HSIZE_X;
56   iy = (pos_y - py) + SCREEN_HSIZE_Y - SPRITE_HSIZE_Y;
57 
58  /*
59   * don't need to set colour, set in floor draw
60   */
61   blit_bm(&bm[(int)anim_ptr], ix, iy);
62 }
63 
bg_calc(void)64 void tpower_bay::bg_calc(void)
65 {
66   anim_ptr += anim_speed * get_time_lapse();
67   anim_ptr = fmod(anim_ptr, anim_len);
68 }
69