Commit | Line | Data |
---|---|---|
21c4e167 H |
1 | /** |
2 | * nInvaders - a space invaders clone for ncurses | |
3 | * Copyright (C) 2002-2003 Dettus | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation; either version 2 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program; if not, write to the Free Software | |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | * | |
19 | * homepage: http://ninvaders.sourceforge.net | |
20 | * mailto: ninvaders-devel@lists.sourceforge.net | |
21 | * | |
22 | */ | |
23 | ||
24 | ||
25 | #include "view.h" | |
26 | ||
27 | #ifndef ALIENS | |
28 | #define ALIENS | |
29 | ||
30 | typedef struct Aliens Aliens; | |
31 | ||
32 | struct Aliens { | |
33 | int posX; // horizontal position of aliens | |
34 | int posY; // vertical position of aliens | |
35 | int right; | |
36 | int left; | |
37 | int bottom; | |
38 | int speed; // 0: no movement; 1: one per turn; etc. | |
39 | }; | |
40 | ||
41 | Aliens aliens; | |
42 | ||
43 | int shipnum; | |
44 | ||
45 | #define ALIENS_MAX_NUMBER_X 10 | |
46 | #define ALIENS_MAX_NUMBER_Y 5 | |
47 | #define ALIENS_MAX_MISSILES 10 | |
48 | ||
49 | // todo: move to structure | |
50 | int lowest_ship[ALIENS_MAX_NUMBER_X]; | |
51 | int alienshotx[ALIENS_MAX_MISSILES]; | |
52 | int alienshoty[ALIENS_MAX_MISSILES]; | |
53 | int alienshotnum; | |
54 | int alienBlock[ALIENS_MAX_NUMBER_Y][ALIENS_MAX_NUMBER_X]; | |
55 | ||
56 | int bunker[BUNKERHEIGHT][BUNKERWIDTH + 1]; | |
57 | ||
58 | ||
59 | void aliensReset(); | |
60 | void bunkersReset(); | |
61 | int aliensMove(); | |
62 | int aliensMissileMove(); | |
63 | void render(); | |
64 | int aliensHitCheck(int shotx, int shoty); | |
65 | int bunkersHitCheck(int shotx, int shoty); | |
66 | ||
67 | ||
68 | // methods that handle graphic display, from view.c | |
69 | extern void aliensDisplay(int x, int y, int wid, int hgt); | |
70 | extern void aliensClear(int x, int y, int wid, int hgt); | |
71 | extern void aliensRefresh(int level, int *pAliens); | |
72 | extern void aliensMissileDisplay(int x, int y); | |
73 | extern void aliensMissileClear(int x, int y); | |
74 | extern void bunkersClearElement(int x, int y); | |
75 | extern void bunkersClear(); | |
76 | extern void bunkersRefresh(); | |
77 | ||
78 | #endif |