Commit 8e1b403a0aa37d40c6d8149bb0e81a18eec1b324

Authored by pifou
1 parent 022e6030

ajout des sources du jeu ninvaders

games/ninvaders/ninvaders-0.1.1/ChangeLog 0 → 100644
... ... @@ -0,0 +1,320 @@
  1 +
  2 +****** Release 0.1.1 ******
  3 +
  4 +2003-04-22 Alexander Hollinger <alexander.hollinger@gmx.net>
  5 +
  6 + * globas.c: changed version from 0.0.11 to 0.1.1
  7 +
  8 +2003-05-06 Sebastian Gutsfeld <segoh@gmx.net>
  9 +
  10 + * aliens.c (aliensMissileMove): added test if there is an alien
  11 + ship left when starting a new missile; this was the bug which is
  12 + responsible for freezing the game when shooting at the last alien
  13 +
  14 +2003-05-05 Sebastian Gutsfeld <segoh@gmx.net>
  15 +
  16 + * nInvaders.c (readInput): updated readInput for reading input in
  17 + different states (see status var)
  18 +
  19 + * nInvaders.c (handleTimer): added code for status GAME_HIGHSCORE
  20 + so a title screen with animation is shown; updated status
  21 + GAME_OVER
  22 +
  23 + * nInvaders.c (main): updated status initialisation from
  24 + GAME_NEXTLEVEL to GAME_HIGHSCORE
  25 +
  26 + * view.c: added WINDOW wTitleScreen; added titleScreenInit; added
  27 + titleScreenDisplay; added titleScreenClear; added battleFieldClear
  28 +
  29 + * view.c (aliensRefresh): formatted some code
  30 +
  31 + * view.c (ufoRefresh): fixed array length
  32 +
  33 + * view.c (gameOverDisplay): simpified function
  34 +
  35 + * view.c (graphicEngineInit): updated with titleScreenInit
  36 +
  37 + * view.h: sorted function declarations; updated gameOverDisplay,
  38 + titleScreenClear, titleScreenDisplay and battleFieldClear
  39 +
  40 +2003-04-22 Alexander Hollinger <alexander.hollinger@gmx.net>
  41 +
  42 + * globals.c (doSleep): added again. still needed in
  43 + view.c. added "#ifdef win32" instruction again.
  44 +
  45 +2003-04-22 Alexander Hollinger <alexander.hollinger@gmx.net>
  46 +
  47 + * globals.c (doSleep): deleted method. not used any more.
  48 +
  49 + * globals.c: incremented version number from 0.0.10 to 0.0.11
  50 +
  51 + * globals.c: removed '#ifdef win32' instruction.
  52 +
  53 + * *.c, *.h: added license notice to each file
  54 +
  55 + * renamed ToDo to TODO
  56 +
  57 +2003-04-18 Alexander Hollinger <alexander.hollinger@gmx.net>
  58 +
  59 + * nInvaders.c (finish): "barely mediocre" and "show promise"
  60 + both "< 10000". Changed latter to "< 12500"
  61 +
  62 +2003-04-17 Alexander Hollinger <alexander.hollinger@gmx.net>
  63 +
  64 + * view.c (statusDisplay): modified so that buffer is written
  65 + to wBattleField. new variable WINDOW* wStatus. added method
  66 + (statusInit) which does initialisation of WINDOW wStatus.
  67 + Problem: Alien missiles go right to the bottom of screen,
  68 + where status is located and overwritten with missile sprite.
  69 + Fix: see next point
  70 + Changed behaviour of display of lives. Now the _remaining_
  71 + lives are displayed. i.e. at the beginning you will see
  72 + two little spaceshuttles, because you have two lives left.
  73 +
  74 + * aliens.c (aliensMissileMove): added some checking, if missile
  75 + reached bottom where player moves. if so, do not move further
  76 + and reload missile. this reduces number of missiles which have
  77 + to be hit-tested each round, yet made it necessary to change
  78 + the shot-threshold otherwise too many missiles would have been
  79 + coming down. Not limiting ALIENS_MAX_MISSILES from 50 to 10 is
  80 + possible, because missiles are reloaded when they reach the
  81 + bottom. 10 concurrent missiles should be quite hard to manage..
  82 + Removed ALIENS_MAX_MISSILES-definition from view.h. Was defined
  83 + twice, now only in aliens.h.
  84 + optimized threshold-checking. calculation outside for-
  85 + instruction, and only comparison within.
  86 +
  87 +
  88 +2003-04-17 Alexander Hollinger <alexander.hollinger@gmx.net>
  89 +
  90 + * nInvaders.c (readInput): removed (ch==27) for exit
  91 + sequence. as dettus pointed out there would be problems
  92 + on some terminals. pressing some keys too long will send
  93 + an KEY_ESC and quit the game.
  94 +
  95 +2003-04-17 Alexander Hollinger <alexander.hollinger@gmx.net>
  96 +
  97 + * nInvaders.c (setUpTimer): changed method to call handleTimer.
  98 + The call signal(SIG_ALRM, handleTimer) didn't work on irix.
  99 + There, the timer was only fired once and then the programm
  100 + exited. Now using call to sigaction() with flag SA_RESTART.
  101 +
  102 +2003-04-16 Alexander Hollinger <alexander.hollinger@gmx.net>
  103 +
  104 + * nInvaders.c: added a real-time timer that does 50 fps. if you
  105 + want it slower toggle the constant FPS. the higher the slower.
  106 + A timer is created and does all the gaming stuff while key
  107 + checking is still done in (main). Gamehandling is done by
  108 + simulating a deterministic finite automaton by setting the
  109 + 'status'-attribute to e.g. GAME_LOOP, GAME_PAUSED, GAME_EXIT.
  110 + the following methods were modified/ added:
  111 + (setUpTimer): creates and initializes timer
  112 + (handleTimer): this method is called every 1/FPS seconds and
  113 + contains most code from old (main)
  114 + (readInput): changed so that the 'status'-variable is affected.
  115 + pressing of 'p' now changes 'status'
  116 + (main): most code moved to (handleTimer), calls setUpTimer and
  117 + sets 'status' to GAME_NEXTLEVEL
  118 + (gameOver): completely moved to handleTimer
  119 +
  120 + * view.c (graphicEngineInit): removed 'timeout(0);' no longer
  121 + needed as we now hava a timer. another advantage: call to
  122 + (readInput) in nInvaders.c no longer called permanently.
  123 + in (readInput) the getch()-call waits till a key is pressed.
  124 + doSleep(1) no longer needed in nInvaders.c (readInput).
  125 +
  126 +2003-04-08 Sebastian Gutsfeld <segoh@gmx.net>
  127 +
  128 + * ufo.c:replaced 'u' with 'ufo' (see ufo.h) and 'a' with 'aliens'
  129 +
  130 + * ufo.h: added typedef for Ufo and renamed 'u' into 'ufo',
  131 +
  132 + * player.c: added typedef for Player and renamed 'p' into 'player',
  133 + replaced 'p' with 'player and 'a' with 'aliens'
  134 +
  135 + * aliens.c: replaced 'a' with 'aliens' (see aliens.h)
  136 +
  137 + * aliens.h: added typedef for Aliens and renamed 'a' into 'aliens'
  138 +
  139 + * globals.c (RELEASE): updated release number
  140 +
  141 +2003-04-07 Sebastian Gutsfeld <segoh@gmx.net>
  142 +
  143 + * view.c (ufoRefresh): reverted 'frame' assignement
  144 +
  145 + * nInvaders.c (main): reverted to old ufo speed from revision 1.3
  146 +
  147 +2003-04-06 Alexander Hollinger <alexander.hollinger@gmx.net>
  148 +
  149 + * nInvaders.c (resetPlayer): added a call to playerMisisleClear();
  150 +
  151 + * view.c (aliensRefresh): fully encapsulated. access to aliens-Array
  152 + by pointer.
  153 +
  154 + * aliens.c (*HitCheck): moved hit_alien_test and hit_bunker_test to
  155 + aliens.c and renamed to aliensHitCheck and bunkersHitCheck. Added
  156 + comments and did improvement of bunkersHitCheck-Algorithm
  157 + (shoty < BUNKERY + BUNKERHEIGHT instead of <=).
  158 +
  159 + * nInvaders.c (finish): moved short version of GPL to globals.c
  160 + (showGplShort)
  161 +
  162 + * view.c (gameOverInit): fixed color code
  163 +
  164 + * player.h: removed lives from structPlayer. This variable belongs
  165 + more to the gamehandling in nInvaders.c that to the model of the
  166 + player in player.c. This is done because of better encapsulation
  167 + of player.c.
  168 +
  169 + * player.c (playerReset): added a playerDisplay. Removed playerDisplay
  170 + from nInvaders.c just before refreshScreen() and added another
  171 + playerDisplay in the player.c (playerMissileMove) so that the
  172 + playerMissileClear does not clear the middle of the player when
  173 + a new shot is fired.
  174 +
  175 + * aliens.c (aliensHitCheck): added support for return of alienType so
  176 + that different scoring according to type of aliens is possible.
  177 + had to change values für alien_type constants in nInvaders.h and
  178 + the order of scores in the points-array in nInvaders.c (doScoring).
  179 + ufo gets 500pt, aliens 100pt, 150pt or 200pt.
  180 +
  181 + * aliens.c (aliensReset): clears missiles of aliens, if any
  182 +
  183 + * nInvaders.c (main): changed some variable names (*_counter) and
  184 + contracted some if-statements.
  185 +
  186 + * view.c (playerExplosionDisplay): renamed from playerExplode. Added
  187 + player.c (playerExplode) which calls playerExplosionDisplay and
  188 + playerDisplay. Thus, I could remove the playerExplode(p.posX, p.posY)
  189 + from nInvaders.c and add a playerExplode(). All Elements of the
  190 + structure structPlayer now are "private".
  191 +
  192 +
  193 +2003-04-05 Sebastian Gutsfeld <segoh@gmx.net>
  194 +
  195 + * Makefile: Updated file for ufo
  196 +
  197 + * aliens.c (aliensMissileMove): fixed comment
  198 +
  199 + * aliens.h: fixed indentation
  200 +
  201 + * globals.h: fixed indentation
  202 +
  203 + * nInvaders.c: included ufo.h, fixed some comments and linebreaks
  204 +
  205 + * nInvaders.c (initlevel): added initialisation for ufo
  206 +
  207 + * nInvaders.c (main): added code for ufo
  208 +
  209 + * nInvaders.c (doScoring): different score for different alien types
  210 +
  211 + * nInvaders.h: added constants for alien types needed by
  212 + nInvaders.c (doScoring), fixed declaration of doScoring, fixed
  213 + Indentation
  214 +
  215 + * player.c: included ufo.h (needed for playerMoveMissile)
  216 +
  217 + * player.c (playerMoveMissile): added code needed for ufo, fixed
  218 + doScoring for alien type
  219 +
  220 + * player.h: fixed indentation, fixed declaration of doScoring
  221 +
  222 + * view.c: added WINDOW *wUfo, void ufoRefresh, static void ufoInit,
  223 + void ufoDisplay and void ufoClear
  224 +
  225 + * view.c (aliensRefresh): fixed indentation and color codes
  226 +
  227 + * view.c (graphicEngineInit): added ufoInit to last init section
  228 +
  229 + * view.h: fixed indentation, added constans UFOWIDTH and UFOPOSY, added
  230 + declarations of ufoDisplay, ufoRefresh and ufoClear
  231 +
  232 + * ufo.c: files for ufo handling (initial import into cvs)
  233 +
  234 + * ufo.h: header file for ufo.c (initial import into cvs)
  235 +
  236 +2003-04-04 Sebastian Gutsfeld <segoh@gmx.net>
  237 +
  238 + * nInvaders.h, player.c: updated every occurance of hit_player_test
  239 + to hit_alientest
  240 +
  241 + * nInvaders.c (hit_alien_test): renamed from 'hit_player_test'
  242 +
  243 +2003-04-05 Alexander Hollinger <alexander.hollinger@gmx.net>
  244 +
  245 + * [view.c] (bunkersDisplay): now fully encapsulated using pointer
  246 + *pBunker to get access to bunker-array. Method is called from
  247 + [aliens.c] (bunkersReset) instead of [aliens.c] (render) thus
  248 + saving some cpu-time. The bunker has to be displayed only at the
  249 + beginning of a new level. Then we use bunkerClearElement or
  250 + bunkerClear to remove bunker elements. No need why it was in
  251 + [aliens.c] (render).
  252 +
  253 +2003-04-04 Sebastian Gutsfeld <segoh@gmx.net>
  254 +
  255 + * nInvaders.c (readInput): draw new number of lives in live-cheat
  256 +
  257 + * aliens.c (aliensReset): put declaration of 'level' at
  258 + beginning of function
  259 +
  260 +2003-04-04 Alexander Hollinger <alexander.hollinger@gmx.net>
  261 +
  262 + * [nInvaders.c] added a new cheat: "L" gives player one new life
  263 + for better testing
  264 + * [aliens.c, player.c] (*Reset) forgot to reset alien-block and
  265 + bunkers-block. Now there is a bunkersReset in aliens.c
  266 + * [view.c] added method graphicEngineInit()
  267 + * [view.c] (refreshScreen) fixed problem with graphic display on some
  268 + terminals. bunker and player are now displayed at startup.
  269 + * removed init.c and init.h from project
  270 + * [globals.c] some minor changes to names of methods. moved code for
  271 + displaying version from nInvaders.c to globals.c. Added code to
  272 + redefine usleep for WIN32-platforms, this should hopefully fix the
  273 + bug that the game was too fast there.
  274 +
  275 +2003-04-03 Alexander Hollinger <alexander.hollinger@gmx.net>
  276 +
  277 + * removed deprecated multi-line-strings in globals.c and nInvaders.c
  278 +
  279 +2003-04-02 Alexander Hollinger <alexander.hollinger@gmx.net>
  280 +
  281 + * view.c now contains all methods which do graphical display
  282 + (by using ncurses)
  283 +
  284 + * added file aliens.c and aliens.h. Perhaps these can later melt
  285 + with player.c and player.h.
  286 +
  287 +2003-04-01 Sebastian Gutsfeld <segoh@gmx.net>
  288 +
  289 + * *.c (*): formatted with 'indent -kr -i8 -l90' and fixed
  290 + some linebreaks
  291 +
  292 +2003-03-30 Alexander Hollinger <alexander.hollinger@gmx.net>
  293 +
  294 + * added file "ToDo": put feature-requests and alike in here
  295 +
  296 + * player.c (player*Missile*): processing of missiles moved to these
  297 + functions to reduce size of main().
  298 +
  299 +
  300 +2003-03-29 Sebastian Gutsfeld <segoh@gmx.net>
  301 +
  302 + * init.c (initplayer): fixed comment
  303 +
  304 + * player.c (playerInit): put declaration of 'playerSprite' at beginning
  305 + of function
  306 +
  307 + * init.c (initshots): put declaration of 'a' at beginning of function
  308 +
  309 +2003-03-29 Alexander Hollinger <alexander.hollinger@gmx.net>
  310 +
  311 + * added more comments and added player.c which is intended to hold all
  312 + functions concearning the player
  313 +
  314 + * added method playerLaunchMissile in player.c
  315 +
  316 +2003-03-28 Alexander Hollinger <alexander.hollinger@gmx.net>
  317 +
  318 + * added some comments and split up some functions, especially in init.c.
  319 +
  320 +
... ...
games/ninvaders/ninvaders-0.1.1/Makefile 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +CC=gcc
  2 +CFLAGS=-O3 -Wall
  3 +LIBS=-lncurses
  4 +
  5 +CFILES=globals.c view.c aliens.c ufo.c player.c nInvaders.c
  6 +HFILES=globals.h view.h aliens.h ufo.h player.h nInvaders.h
  7 +OFILES=globals.o view.o aliens.o ufo.o player.o nInvaders.o
  8 +all: nInvaders
  9 +
  10 +nInvaders: $(OFILES) $(HFILES)
  11 + $(CC) $(LDFLAGS) -o$@ $(OFILES) $(LIBS)
  12 +
  13 +.c.o:
  14 + $(CC) -c -I. $(CFLAGS) $(OPTIONS) $<
  15 +clean:
  16 + rm -f nInvaders $(OFILES)
... ...
games/ninvaders/ninvaders-0.1.1/README 0 → 100644
... ... @@ -0,0 +1,52 @@
  1 +*** nInvaders
  2 +*** (C)opyleft 2k2 by dettus
  3 +*** dettus@matrixx-bielefeld.de
  4 +
  5 +Hello and welcome to nInvaders! Right now you are earth's only hope to save
  6 +it from alien invaders from space. Make your job, and make it good, mankind
  7 +believes in you...
  8 +
  9 +1. INSTALLING
  10 +-------------
  11 +Compiling and installing should be really straightforward, just type in
  12 +"make" on your command prompt and you'll get the binary file. If not, please
  13 +edit the makefile. Once you have compiled it, copy it (as root) to your
  14 +/usr/bin directory, or /usr/local/games, or just run it by typeing
  15 +./nInvaders.
  16 +
  17 +2. REQUIREMENTS
  18 +---------------
  19 +nInvaders is known to compile and run on Solaris, Linux and OpenBSD. On all of
  20 +them were ncurses 5.2 installed. If you are capable of running it on other
  21 +platforms, tell me!
  22 +
  23 +3. CONTROL KEYS
  24 +---------------
  25 +Controlling nInvaders is really simple. Just press the cursor left/right keys
  26 +to move it left or right, and press space to fire. The esc-key lets you quit
  27 +at any time you want.
  28 +
  29 +4. COMMAND LINE OPTIONS
  30 +-----------------------
  31 +nInvaders accepts the following command line options
  32 +-l x where x is your skill as a number between 0(nightmare) and 9(may i play
  33 + daddy)
  34 +-gpl prints out the license information.
  35 +
  36 +Any other option gives you a help screen.
  37 +
  38 +5. LICENSING
  39 +------------
  40 +nInvaders is protected under the laws of the GPL and other countries. Any re-
  41 +distribution, reselling or copying is strictly allowed. You should have received
  42 +a copy of it with this package, if not, write to the Free Software
  43 +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  44 +Or just start nInvaders with the -gpl option to learn more.
  45 +
  46 +6. GREETZ
  47 +---------
  48 +hello mom, hello dad, hello katja, hello there, hello elitza, hello wizzard,
  49 +hello walli, hello melanie, hello judith, hello you folks at freshmeat, hello
  50 +skyper, hello gamma, hello sunfreeware, hello abuse, hello linus, hello alan,
  51 +hello herr von boedefeld, hello god, hello world.
  52 +and thank you Mike Saarna for adding ANIMATION!
... ...
games/ninvaders/ninvaders-0.1.1/aliens.c 0 → 100644
... ... @@ -0,0 +1,308 @@
  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 "aliens.h"
  26 +#include "player.h"
  27 +#include "nInvaders.h"
  28 +
  29 +/**
  30 + * initialize aliens attributes
  31 + */
  32 +void aliensReset()
  33 +{
  34 + int i,j;
  35 +
  36 + // three different types of aliens [5], [10]
  37 + int level[ALIENS_MAX_NUMBER_Y][ALIENS_MAX_NUMBER_X]={
  38 + {1,1,1,1,1,1,1,1,1,1},
  39 + {2,2,2,2,2,2,2,2,2,2},
  40 + {2,2,2,2,2,2,2,2,2,2},
  41 + {3,3,3,3,3,3,3,3,3,3},
  42 + {3,3,3,3,3,3,3,3,3,3}
  43 + };
  44 +
  45 + aliensClear(aliens.posX, aliens.posY, aliens.right, aliens.bottom); // clear old position of aliens
  46 +
  47 + // reset alien position
  48 + aliens.posX = 0;
  49 + aliens.posY = 0;
  50 + aliens.right = 0;
  51 + aliens.bottom = 0;
  52 + aliens.left = 0;
  53 + aliens.speed = 1;
  54 +
  55 + // copy level-array to enemy-array
  56 + for (i=0;i<ALIENS_MAX_NUMBER_X;i++) {
  57 + for (j=0;j<ALIENS_MAX_NUMBER_Y;j++) {
  58 + alienBlock[j][i]=level[j][i];
  59 + }
  60 + }
  61 +
  62 + // reset missiles
  63 + for (i = 0; i < ALIENS_MAX_MISSILES; i++) {
  64 + if (alienshotx[i] != 0) {
  65 + aliensMissileClear(alienshotx[i],alienshoty[i]); // clear old position
  66 + }
  67 + alienshotx[i] = 0; // start with zero values
  68 + alienshoty[i] = 0; // start with zero values
  69 + }
  70 + alienshotnum = 1; // one missile at the same time
  71 + alienshotx[0] = 5; // x position of first alienshot
  72 + alienshoty[0] = 1; // y position of first alienshot
  73 +
  74 +}
  75 +
  76 +/**
  77 + * initialize bunkers attributes
  78 + */
  79 +void bunkersReset()
  80 +{
  81 + int a, b;
  82 +
  83 + // set position of bunker sprites. user graphical char bunkerd for better visual overview
  84 + // and set according to this the bunker-array
  85 + char bunkerd[BUNKERHEIGHT][BUNKERWIDTH+1] = {
  86 + " ### ### ### ### ",
  87 + " ##### ##### ##### ##### ",
  88 + " ####### ####### ####### ####### ",
  89 + " ## ## ## ## ## ## ## ## "
  90 + };
  91 + // 12345678901234567890123456789012345678901234567890123456789012345678901234567890
  92 + // 80 characters wide
  93 +
  94 + // copy graphical "bunkerd" to binary "bunker"
  95 + for (a = 0; a < BUNKERWIDTH; a++) {
  96 + for (b = 0; b < BUNKERHEIGHT; b++) {
  97 + if (bunkerd[b][a] == '#')
  98 + bunker[b][a] = 1;
  99 + else
  100 + bunker[b][a] = 0;
  101 + }
  102 + }
  103 +
  104 + // display bunkers sprite
  105 + bunkersDisplay(&bunker[0][0]);
  106 +}
  107 +
  108 +/**
  109 + * move aliens and test if they've reached the
  110 + * bottom of the windows or the bunkers.
  111 + */
  112 +int aliensMove()
  113 +{
  114 +
  115 + int cx,cy;
  116 + int fReachedPlayer=0; // return value
  117 +
  118 + render();
  119 + aliensClear(aliens.posX, aliens.posY, aliens.right, aliens.bottom); // clear old position of aliens
  120 +
  121 + aliens.posX = aliens.posX + aliens.speed; // move aliens left/ right
  122 +
  123 + // when aliens reached left or right screen-border
  124 + if (aliens.posX == (BUNKERWIDTH + BUNKERX - 5 - aliens.right) || aliens.posX == (BUNKERX + aliens.left)) {
  125 +
  126 + aliens.posY++; // move aliens downwards
  127 +
  128 + // aliens reached player
  129 + if (aliens.posY == SCREENHEIGHT - 2 - aliens.bottom) {
  130 + fReachedPlayer = 1; // set return value
  131 + }
  132 +
  133 + // aliens reached bunkers //funzt nicht ganz: todo
  134 + if (aliens.posY == BUNKERY - aliens.bottom) {
  135 + // clear bunkers
  136 + for(cx=0;cx<BUNKERWIDTH;cx++) {
  137 + for(cy=0;cy<BUNKERHEIGHT;cy++) {
  138 + bunker[cy][cx]=0;
  139 + }
  140 + }
  141 + bunkersClear(); // clear bunkers sprites
  142 + }
  143 +
  144 + aliens.speed = aliens.speed * (-1); // change direction of aliens' movements
  145 + }
  146 +
  147 + aliensDisplay(aliens.posX, aliens.posY, aliens.right, aliens.bottom); // display aliens at new position
  148 +
  149 + return fReachedPlayer; // return if aliens reached player
  150 +}
  151 +
  152 +
  153 +/**
  154 + * display alien animation, display remaining parts of aliens and bunker
  155 + */
  156 +void render()
  157 +{
  158 + int k,row;
  159 + int c=0;
  160 +
  161 + // calculate left, right, bottom, lowest_ship
  162 + aliens.left=1;
  163 + aliens.right=-1;
  164 + aliens.bottom=-1;
  165 + shipnum=0;
  166 + for (k=0;k<ALIENS_MAX_NUMBER_X;k++) {
  167 + lowest_ship[k]=-1;
  168 + }
  169 +
  170 + for (row=0;row<ALIENS_MAX_NUMBER_Y*2;row++) {
  171 + if ((row%2)==0){
  172 + for (k=0;k<ALIENS_MAX_NUMBER_X;k++) {
  173 + if (alienBlock[c][k] != 0) {
  174 + lowest_ship[k]=row;
  175 + shipnum++;
  176 + if (aliens.left==1 || -k>aliens.left) {aliens.left=-k;}
  177 + if (aliens.right==-1 || k>aliens.right) {aliens.right=k;}
  178 + if (aliens.bottom==-1 || c>aliens.bottom) {aliens.bottom=c;}
  179 + }
  180 + }
  181 + } else {
  182 + c++;
  183 + }
  184 + }
  185 + aliens.bottom=aliens.bottom*2; // every 2nd row is an empty row
  186 + aliens.left=aliens.left*3; // alien sprite is 3 chars wide
  187 + aliens.right=aliens.right*3; // alien sprite is 3 chars wide
  188 +
  189 + // display remaining aliens with animation
  190 + aliensRefresh(level, &alienBlock[0][0]);
  191 +
  192 +}
  193 +
  194 +
  195 +/**
  196 + * move aliens' missiles and do player/bunker hit testing
  197 + * a zero value in alienshotx indicates that the appropriate missile is loaded, but not fired
  198 + */
  199 +int aliensMissileMove()
  200 +{
  201 + int i, tmp;
  202 + int fPlayerWasHit = 0;
  203 + int shootThreshold;
  204 + static int alienshot_counter = 0;
  205 +
  206 +
  207 + // calculate threshold when next missile should be fired
  208 + // it is done here to save calculation time in for-instruction
  209 + shootThreshold = (skill_level * 8) * (shipnum + 2);
  210 + alienshot_counter = alienshot_counter + 10 ;
  211 +
  212 + // loop all possible missiles
  213 + for (i = 0; i < ALIENS_MAX_MISSILES; i++) {
  214 +
  215 + // if the current missile is flying we should do movements
  216 + if (alienshotx[i] != 0) {
  217 +
  218 + aliensMissileClear(alienshotx[i],alienshoty[i]); // clear old position
  219 +
  220 + // if missile hit the bunkers
  221 + if (bunkersHitCheck(alienshotx[i], alienshoty[i]) == 1) {
  222 + alienshotx[i] = 0; // value of zero reloads missile
  223 + }
  224 +
  225 + alienshoty[i]++; // move missile downwards
  226 +
  227 + // check if player was hit by an alien missile
  228 + if (playerHitCheck(alienshotx[i], alienshoty[i]) == 1) {
  229 + alienshotx[i] = 0; // value of zero reloads missile
  230 + fPlayerWasHit = 1;
  231 + }
  232 +
  233 +
  234 + } else { // missile not launched yet
  235 +
  236 + // start new missile if counter says so
  237 + if (alienshot_counter > shootThreshold && shipnum > 0) {// only shot if there's an alien left
  238 + alienshot_counter = 0; // reset counter
  239 + tmp = random() % ALIENS_MAX_NUMBER_X; // randomly select one of the ...
  240 + while (lowest_ship[tmp] == -1) { // ...aliens at the bottom of ...
  241 + tmp = random() % ALIENS_MAX_NUMBER_X; // ...a column to launch missile
  242 + }
  243 + alienshoty[i]=aliens.posY+lowest_ship[tmp]; // set y position of missile
  244 + alienshotx[i]=aliens.posX+tmp*3; // set x position of missile
  245 + }
  246 + } // if
  247 +
  248 + // display missiles if still running or just launched; could have been modified in the above code
  249 + if (alienshotx[i] != 0) {
  250 + // if missile is out of battlefield
  251 + if (alienshoty[i] == SCREENHEIGHT - 1) {
  252 + alienshotx[i] = 0; // reload missile
  253 + } else {
  254 + aliensMissileDisplay(alienshotx[i], alienshoty[i]); // display Missile at new position
  255 + }
  256 + }
  257 +
  258 + } // for
  259 +
  260 +
  261 + return fPlayerWasHit;
  262 +}
  263 +
  264 +
  265 +
  266 +/**
  267 + * check if missile hit an alien
  268 + */
  269 +int aliensHitCheck(int shotx, int shoty)
  270 +{
  271 + int alienType = 0;
  272 + int shipx, shipy;
  273 + // if missile is within alien-rectangle
  274 + if (shotx >= aliens.posX && shotx <= aliens.posX + ALIENS_MAX_NUMBER_X * 3 - 1
  275 + && shoty >= aliens.posY && shoty <= aliens.posY + (ALIENS_MAX_NUMBER_Y - 1) * 2) {
  276 + // calculate the ship that was hit
  277 + shipx = (shotx - aliens.posX) / 3;
  278 + shipy = (shoty - aliens.posY) / 2;
  279 + // if there is still a ship at this position
  280 + alienType = alienBlock[shipy][shipx];
  281 + if (alienType != 0) {
  282 + alienBlock[shipy][shipx] = 0; // delete alien ship
  283 + }
  284 + }
  285 + return alienType; // returns 0 if no alien was hit, else returns type-code of alien
  286 +}
  287 +
  288 +/**
  289 + * check if missile hit an element of bunker
  290 + */
  291 +int bunkersHitCheck(int shotx, int shoty)
  292 +{
  293 + int adjx, adjy;
  294 + int fBunkerWasHit = 0;
  295 + // if missile is within bunker-rectangle
  296 + if (shotx >= BUNKERX && shotx < BUNKERX + BUNKERWIDTH
  297 + && shoty >= BUNKERY && shoty < BUNKERY + BUNKERHEIGHT) {
  298 + // calculate the element of the bunker that was hit
  299 + adjy = shoty - BUNKERY;
  300 + adjx = shotx - BUNKERX;
  301 + // if there is still an element
  302 + if(bunker[adjy][adjx] == 1){
  303 + bunker[adjy][adjx] = 0; // delete element
  304 + fBunkerWasHit = 1; // bunker was hit!
  305 + }
  306 + }
  307 + return fBunkerWasHit;
  308 +}
... ...
games/ninvaders/ninvaders-0.1.1/aliens.h 0 → 100644
... ... @@ -0,0 +1,78 @@
  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
... ...
games/ninvaders/ninvaders-0.1.1/debian/changelog 0 → 100644
... ... @@ -0,0 +1,75 @@
  1 +ninvaders (0.1.1-3) unstable; urgency=low
  2 +
  3 + * Fix overflow in lowest_ship array. Closes: #597036
  4 + Thanks to Matt Chapman for the bug report and patch.
  5 + * Time for a packaging overhaul:
  6 + - Bump to dh compat level 7.
  7 + - Bump standards-version to 3.9.1; no specific changes required.
  8 + - Add the now-necessary misc:Depends.
  9 + - Strip DH_COMPAT from debian/rules; move it to debian/compat.
  10 + - Move menu entry to Games/Action, and quote all values.
  11 + - Use dh_prep instead of dh_clean -k.
  12 + - Don't ignore make clean errors in the clean target.
  13 + - Enhance the copyright file.
  14 +
  15 + -- Matthew Palmer <mpalmer@debian.org> Tue, 05 Oct 2010 13:21:26 +1100
  16 +
  17 +ninvaders (0.1.1-2) unstable; urgency=low
  18 +
  19 + * Convert everything in the package to refer to the binary and related
  20 + materials (manpage) in the lowercase form (ninvaders). Closes: #300508.
  21 +
  22 + -- Matthew Palmer <mpalmer@debian.org> Thu, 29 Sep 2005 20:26:34 +1000
  23 +
  24 +ninvaders (0.1.1-1) unstable; urgency=low
  25 +
  26 + * New upstream release.
  27 + * Standards version bumped to 3.6.0.
  28 + * Build-depends on debhelper 4.
  29 +
  30 + -- Matthew Palmer <mpalmer@debian.org> Sun, 13 Jul 2003 22:57:37 +1000
  31 +
  32 +ninvaders (0.0.8-6) unstable; urgency=low
  33 +
  34 + * Converted great honking multi-line strings into something which GCC 3.3
  35 + can (hopefully) handle. Whoever thought that new feature was an
  36 + improvement should be hanged. Closes: #195161.
  37 + * Changed strings.h to string.h, because strings.h is not what was wanted.
  38 +
  39 + -- Matthew Palmer <mpalmer@debian.org> Sun, 1 Jun 2003 17:48:04 +1000
  40 +
  41 +ninvaders (0.0.8-5) unstable; urgency=low
  42 +
  43 + * Bumped standards-version to 3.5.7.
  44 +
  45 + -- Matthew Palmer <mpalmer@debian.org> Sun, 22 Sep 2002 16:57:47 +1000
  46 +
  47 +ninvaders (0.0.8-4) unstable; urgency=low
  48 +
  49 + * Developed patch to make the bunkers disappear one line at a time. Due
  50 + to the code, it will not be easily possible to make the bunkers
  51 + disappear as the aliens reach them, so this will have to do.
  52 + (Closes: #154330)
  53 +
  54 + -- Matthew Palmer <mpalmer@debian.org> Sun, 22 Sep 2002 16:33:45 +1000
  55 +
  56 +ninvaders (0.0.8-3) unstable; urgency=low
  57 +
  58 + * Patched to replace the whole text of the GPL (!) with a function to
  59 + print the GPL based on the text in /usr/share/common-licenses/GPL.
  60 + Thanks to Pete de Zwart for the patch.
  61 +
  62 + -- Matthew Palmer <mpalmer@debian.org> Tue, 30 Jul 2002 17:00:19 +1000
  63 +
  64 +ninvaders (0.0.8-2) unstable; urgency=low
  65 +
  66 + * Changed description in line with bug #154330.
  67 +
  68 + -- Matthew Palmer <mpalmer@debian.org> Fri, 26 Jul 2002 18:53:58 +1000
  69 +
  70 +ninvaders (0.0.8-1) unstable; urgency=low
  71 +
  72 + * Initial Release. (Closes: #153703)
  73 +
  74 + -- Matthew Palmer <mpalmer@debian.org> Sun, 21 Jul 2002 09:59:21 +1000
  75 +
... ...
games/ninvaders/ninvaders-0.1.1/debian/compat 0 → 100644
... ... @@ -0,0 +1 @@
  1 +7
... ...
games/ninvaders/ninvaders-0.1.1/debian/control 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +Source: ninvaders
  2 +Section: games
  3 +Priority: optional
  4 +Maintainer: Matthew Palmer <mpalmer@debian.org>
  5 +Build-Depends: debhelper (>= 7), libncurses5-dev
  6 +Standards-Version: 3.9.1
  7 +
  8 +Package: ninvaders
  9 +Architecture: any
  10 +Depends: ${shlibs:Depends}, ${misc:Depends}
  11 +Description: A space invaders-like game using ncurses
  12 + A Space Invaders type game with text-only graphics. Ever wanted to play
  13 + space invaders when you can't find a GUI? Now you can.
... ...
games/ninvaders/ninvaders-0.1.1/debian/copyright 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +Upstream: http://ninvaders.sourceforge.net/
  2 +
  3 +Upstream Authors: Thomas Dettbarn <dettus@matrixx-bielefeld.de>, with
  4 +contributions by others (see nInvaders -help for full details).
  5 +
  6 +Copyright:
  7 +
  8 +From nInvaders.c:
  9 +
  10 + * Copyright (C) 2002-2003 Dettus
  11 + *
  12 + * This program is free software; you can redistribute it and/or modify
  13 + * it under the terms of the GNU General Public License as published by
  14 + * the Free Software Foundation; either version 2 of the License, or
  15 + * (at your option) any later version.
  16 + *
  17 + * This program is distributed in the hope that it will be useful,
  18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20 + * GNU General Public License for more details.
  21 + *
  22 + * You should have received a copy of the GNU General Public License
  23 + * along with this program; if not, write to the Free Software
  24 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25 + *
  26 + * homepage: http://ninvaders.sourceforge.net
  27 + * mailto: ninvaders-devel@lists.sourceforge.net
  28 +
  29 +Released under the terms of the GPL. See /usr/share/common-licenses/GPL, or
  30 +nInvaders -gpl.
... ...
games/ninvaders/ninvaders-0.1.1/debian/dirs 0 → 100644
... ... @@ -0,0 +1 @@
  1 +usr/games
... ...
games/ninvaders/ninvaders-0.1.1/debian/docs 0 → 100644
... ... @@ -0,0 +1 @@
  1 +README
... ...
games/ninvaders/ninvaders-0.1.1/debian/links 0 → 100644
... ... @@ -0,0 +1 @@
  1 +usr/games/ninvaders usr/games/nInvaders
... ...
games/ninvaders/ninvaders-0.1.1/debian/menu 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +?package(ninvaders):needs="text" section="Games/Action"\
  2 + title="nInvaders" command="/usr/games/nInvaders"
... ...
games/ninvaders/ninvaders-0.1.1/debian/ninvaders.1 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +.\" Hey, EMACS: -*- nroff -*-
  2 +.\" First parameter, NAME, should be all caps
  3 +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
  4 +.\" other parameters are allowed: see man(7), man(1)
  5 +.TH NINVADERS 6 "July 21, 2002"
  6 +.\" Please adjust this date whenever revising the manpage.
  7 +.\"
  8 +.\" Some roff macros, for reference:
  9 +.\" .nh disable hyphenation
  10 +.\" .hy enable hyphenation
  11 +.\" .ad l left justify
  12 +.\" .ad b justify to both left and right margins
  13 +.\" .nf disable filling
  14 +.\" .fi enable filling
  15 +.\" .br insert line break
  16 +.\" .sp <n> insert n+1 empty lines
  17 +.\" for manpage-specific macros, see man(7)
  18 +.SH NAME
  19 +ninvaders \- ncurses version of space invaders
  20 +.SH SYNOPSIS
  21 +.B ninvaders
  22 +.SH DESCRIPTION
  23 +In short, this is a space invaders game written for the ncurses terminal
  24 +control library. It uses ASCII art to draw everything, and you can play it
  25 +just about anywhere. Space Invaders over dialup!
  26 +.PP
  27 +To play the game, simply run the program. You will be placed in the game
  28 +arena with a large block of aliens. To move your gun pod (at the bottom of
  29 +the screen) use the left and right arrow keys. To shoot, press space. You
  30 +can move faster if you hold the arrow keys down.
  31 +.PP
  32 +The object of the game is to shoot all the aliens (the multi-coloured moving
  33 +things) before they reach the ground. Since these aliens aren't friendly
  34 +(which is why you're trying to stop them) they will shoot back. Dodge the
  35 +descending bullets or hang about under the large stationary blocks for
  36 +cover.
  37 +.SH AUTHOR
  38 +This manual page was written by Matthew Palmer <mpalmer@debian.org>,
  39 +for the Debian GNU/Linux system (but may be used by others).
  40 +.PP
  41 +The ninvaders program was written by Thomas Dettbarn
  42 +<dettus@matrixx-bielefeld.de> and is released under the GPL.
... ...
games/ninvaders/ninvaders-0.1.1/debian/rules 0 → 100755
... ... @@ -0,0 +1,71 @@
  1 +#!/usr/bin/make -f
  2 +# Sample debian/rules that uses debhelper.
  3 +# GNU copyright 1997 to 1999 by Joey Hess.
  4 +
  5 +# Uncomment this to turn on verbose mode.
  6 +#export DH_VERBOSE=1
  7 +
  8 +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
  9 + CFLAGS += -g
  10 +endif
  11 +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  12 + INSTALL_PROGRAM += -s
  13 +endif
  14 +
  15 +configure: configure-stamp
  16 +configure-stamp:
  17 + dh_testdir
  18 + # Add here commands to configure the package.
  19 + touch configure-stamp
  20 +
  21 +build: build-stamp
  22 +
  23 +build-stamp: configure-stamp
  24 + dh_testdir
  25 + $(MAKE)
  26 + touch build-stamp
  27 +
  28 +clean:
  29 + dh_testdir
  30 + dh_testroot
  31 + rm -f build-stamp configure-stamp
  32 +
  33 + # Add here commands to clean up after the build process.
  34 + $(MAKE) clean
  35 +
  36 + dh_clean
  37 +
  38 +install: build
  39 + dh_testdir
  40 + dh_testroot
  41 + dh_prep
  42 + dh_installdirs
  43 +
  44 + # Add here commands to install the package into debian/ninvaders.
  45 + cp nInvaders $(CURDIR)/debian/ninvaders/usr/games/ninvaders
  46 +
  47 +# Build architecture-independent files here.
  48 +binary-indep: build install
  49 +# We have nothing to do here.
  50 +
  51 +# Build architecture-dependent files here.
  52 +binary-arch: build install
  53 + dh_testdir
  54 + dh_testroot
  55 + dh_installdirs
  56 + dh_installdocs
  57 + dh_installmenu
  58 + dh_installman debian/ninvaders.1
  59 + dh_link
  60 + dh_installchangelogs
  61 + dh_strip
  62 + dh_compress
  63 + dh_fixperms
  64 + dh_installdeb
  65 + dh_shlibdeps
  66 + dh_gencontrol
  67 + dh_md5sums
  68 + dh_builddeb
  69 +
  70 +binary: binary-indep binary-arch
  71 +.PHONY: build clean binary-indep binary-arch binary install configure
... ...
games/ninvaders/ninvaders-0.1.1/globals.c 0 → 100644
... ... @@ -0,0 +1,157 @@
  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 <stdio.h>
  26 +#include <unistd.h>
  27 +#include <stdlib.h>
  28 +
  29 +#include "globals.h"
  30 +
  31 +
  32 +#define MAJOR 0
  33 +#define MINOR 1
  34 +#define RELEASE 1
  35 +
  36 +
  37 +
  38 +#ifdef WIN32
  39 +#define usleep(x) Sleep(x/1000)
  40 +#endif
  41 +
  42 +
  43 +/**
  44 + * sleep for specified time
  45 + */
  46 +void doSleep(int microseconds)
  47 +{
  48 + usleep(microseconds);
  49 +}
  50 +
  51 +
  52 +/**
  53 + * show version information
  54 + */
  55 +void showVersion()
  56 +{
  57 + fprintf(stderr, "*** nInvaders %i.%i.%i\n", MAJOR, MINOR, RELEASE);
  58 + fprintf(stderr, "*** (C)opyleft 2k2 by Dettus\n");
  59 + fprintf(stderr, "*** dettus@matrixx-bielefeld.de\n");
  60 + fprintf(stderr, "Additional code by Mike Saarna,\n");
  61 + fprintf(stderr, "Sebastian Gutsfeld -> segoh@gmx.net,\n");
  62 + fprintf(stderr, "Alexander Hollinger -> alexander.hollinger@gmx.net and\n");
  63 + fprintf(stderr, "Matthias Thar -> hiast2@compuserve.de\n");
  64 +}
  65 +
  66 +
  67 +/**
  68 + * show usage of command line parameters
  69 + */
  70 +void showUsage()
  71 +{
  72 +
  73 + fprintf(stderr, "\n\nUsage: nInvaders [-l skill] [-gpl]\n");
  74 + fprintf(stderr, " where -l 0=NIGHTMARE\n");
  75 + fprintf(stderr, " -l 1=okay\n");
  76 + fprintf(stderr, " -l 9=May I play daddy?!\n");
  77 + fprintf(stderr, "\n -gpl shows you the license file\n");
  78 +}
  79 +
  80 +
  81 +/**
  82 + * wait for input of return to continue
  83 + */
  84 +void waitForReturn()
  85 +{
  86 + char b[2];
  87 + fprintf(stderr, "...Please press <Enter> to read on...");
  88 + fgets(b, sizeof(b), stdin);
  89 +}
  90 +
  91 +/**
  92 + * show short version of Gnu GPL
  93 + */
  94 +void showGplShort()
  95 +{
  96 + fprintf(stderr,"\n");
  97 + fprintf(stderr,"This program is free software; you can redistribute it and/or modify\n");
  98 + fprintf(stderr,"it under the terms of the GNU General Public License as published by\n");
  99 + fprintf(stderr,"the Free Software Foundation; either version 2 of the License, or\n");
  100 + fprintf(stderr,"(at your option) any later version.\n");
  101 + fprintf(stderr,"\n");
  102 + fprintf(stderr,"This program is distributed in the hope that it will be useful,\n");
  103 + fprintf(stderr,"but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
  104 + fprintf(stderr,"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n");
  105 + fprintf(stderr,"GNU General Public License for more details.\n");
  106 + fprintf(stderr,"\n");
  107 + fprintf(stderr,"You should have received a copy of the GNU General Public License\n");
  108 + fprintf(stderr,"along with this program; if not, write to the Free Software\n");
  109 + fprintf(stderr,"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n");
  110 + fprintf(stderr,"\n");
  111 + fprintf(stderr,"Use the -gpl command line switch to see the full license of this program\n");
  112 + fprintf(stderr,"Use the -help command line switch to see who wrote this program \n");
  113 + fprintf(stderr,"\n");
  114 +}
  115 +
  116 +/**
  117 + * show GNU GENERAL PUBLIC LICENSE
  118 + */
  119 +void showGpl()
  120 +{
  121 + /* Fix fuxored GPL display */
  122 +
  123 + FILE *GPL;
  124 +
  125 + char gpl_file[] = "/usr/share/common-licenses/GPL";
  126 + char *buff = NULL;
  127 + char *check = NULL;
  128 +
  129 + int lines = 23;
  130 + int buff_size = 4096;
  131 + int count = 0;
  132 +
  133 + if (!(GPL = fopen(gpl_file, "r"))) {
  134 + perror("gpl():\t");
  135 + return;
  136 + }
  137 +
  138 + if (!(buff = calloc(buff_size, sizeof(char)))) {
  139 + perror("gpl():\t");
  140 + fclose(GPL);
  141 + return;
  142 + }
  143 +
  144 + do {
  145 + while (count < lines && (check = fgets(buff, buff_size, GPL))) {
  146 + fputs(buff, stderr);
  147 + count++;
  148 + }
  149 +
  150 + /* Pause */
  151 + waitForReturn();
  152 + count = 0;
  153 + } while (check);
  154 +
  155 + fclose(GPL);
  156 + free(buff);
  157 +}
... ...
games/ninvaders/ninvaders-0.1.1/globals.h 0 → 100644
... ... @@ -0,0 +1,35 @@
  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 +#ifndef GLOBALS
  26 +#define GLOBALS
  27 +
  28 +extern void doSleep();
  29 +
  30 +extern void showUsage();
  31 +extern void showVersion();
  32 +extern void showGplShort();
  33 +extern void showGpl();
  34 +
  35 +#endif
... ...
games/ninvaders/ninvaders-0.1.1/gpl.txt 0 → 100644
... ... @@ -0,0 +1,340 @@
  1 + GNU GENERAL PUBLIC LICENSE
  2 + Version 2, June 1991
  3 +
  4 + Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  5 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  6 + Everyone is permitted to copy and distribute verbatim copies
  7 + of this license document, but changing it is not allowed.
  8 +
  9 + Preamble
  10 +
  11 + The licenses for most software are designed to take away your
  12 +freedom to share and change it. By contrast, the GNU General Public
  13 +License is intended to guarantee your freedom to share and change free
  14 +software--to make sure the software is free for all its users. This
  15 +General Public License applies to most of the Free Software
  16 +Foundation's software and to any other program whose authors commit to
  17 +using it. (Some other Free Software Foundation software is covered by
  18 +the GNU Library General Public License instead.) You can apply it to
  19 +your programs, too.
  20 +
  21 + When we speak of free software, we are referring to freedom, not
  22 +price. Our General Public Licenses are designed to make sure that you
  23 +have the freedom to distribute copies of free software (and charge for
  24 +this service if you wish), that you receive source code or can get it
  25 +if you want it, that you can change the software or use pieces of it
  26 +in new free programs; and that you know you can do these things.
  27 +
  28 + To protect your rights, we need to make restrictions that forbid
  29 +anyone to deny you these rights or to ask you to surrender the rights.
  30 +These restrictions translate to certain responsibilities for you if you
  31 +distribute copies of the software, or if you modify it.
  32 +
  33 + For example, if you distribute copies of such a program, whether
  34 +gratis or for a fee, you must give the recipients all the rights that
  35 +you have. You must make sure that they, too, receive or can get the
  36 +source code. And you must show them these terms so they know their
  37 +rights.
  38 +
  39 + We protect your rights with two steps: (1) copyright the software, and
  40 +(2) offer you this license which gives you legal permission to copy,
  41 +distribute and/or modify the software.
  42 +
  43 + Also, for each author's protection and ours, we want to make certain
  44 +that everyone understands that there is no warranty for this free
  45 +software. If the software is modified by someone else and passed on, we
  46 +want its recipients to know that what they have is not the original, so
  47 +that any problems introduced by others will not reflect on the original
  48 +authors' reputations.
  49 +
  50 + Finally, any free program is threatened constantly by software
  51 +patents. We wish to avoid the danger that redistributors of a free
  52 +program will individually obtain patent licenses, in effect making the
  53 +program proprietary. To prevent this, we have made it clear that any
  54 +patent must be licensed for everyone's free use or not licensed at all.
  55 +
  56 + The precise terms and conditions for copying, distribution and
  57 +modification follow.
  58 +
  59 + GNU GENERAL PUBLIC LICENSE
  60 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  61 +
  62 + 0. This License applies to any program or other work which contains
  63 +a notice placed by the copyright holder saying it may be distributed
  64 +under the terms of this General Public License. The "Program", below,
  65 +refers to any such program or work, and a "work based on the Program"
  66 +means either the Program or any derivative work under copyright law:
  67 +that is to say, a work containing the Program or a portion of it,
  68 +either verbatim or with modifications and/or translated into another
  69 +language. (Hereinafter, translation is included without limitation in
  70 +the term "modification".) Each licensee is addressed as "you".
  71 +
  72 +Activities other than copying, distribution and modification are not
  73 +covered by this License; they are outside its scope. The act of
  74 +running the Program is not restricted, and the output from the Program
  75 +is covered only if its contents constitute a work based on the
  76 +Program (independent of having been made by running the Program).
  77 +Whether that is true depends on what the Program does.
  78 +
  79 + 1. You may copy and distribute verbatim copies of the Program's
  80 +source code as you receive it, in any medium, provided that you
  81 +conspicuously and appropriately publish on each copy an appropriate
  82 +copyright notice and disclaimer of warranty; keep intact all the
  83 +notices that refer to this License and to the absence of any warranty;
  84 +and give any other recipients of the Program a copy of this License
  85 +along with the Program.
  86 +
  87 +You may charge a fee for the physical act of transferring a copy, and
  88 +you may at your option offer warranty protection in exchange for a fee.
  89 +
  90 + 2. You may modify your copy or copies of the Program or any portion
  91 +of it, thus forming a work based on the Program, and copy and
  92 +distribute such modifications or work under the terms of Section 1
  93 +above, provided that you also meet all of these conditions:
  94 +
  95 + a) You must cause the modified files to carry prominent notices
  96 + stating that you changed the files and the date of any change.
  97 +
  98 + b) You must cause any work that you distribute or publish, that in
  99 + whole or in part contains or is derived from the Program or any
  100 + part thereof, to be licensed as a whole at no charge to all third
  101 + parties under the terms of this License.
  102 +
  103 + c) If the modified program normally reads commands interactively
  104 + when run, you must cause it, when started running for such
  105 + interactive use in the most ordinary way, to print or display an
  106 + announcement including an appropriate copyright notice and a
  107 + notice that there is no warranty (or else, saying that you provide
  108 + a warranty) and that users may redistribute the program under
  109 + these conditions, and telling the user how to view a copy of this
  110 + License. (Exception: if the Program itself is interactive but
  111 + does not normally print such an announcement, your work based on
  112 + the Program is not required to print an announcement.)
  113 +
  114 +These requirements apply to the modified work as a whole. If
  115 +identifiable sections of that work are not derived from the Program,
  116 +and can be reasonably considered independent and separate works in
  117 +themselves, then this License, and its terms, do not apply to those
  118 +sections when you distribute them as separate works. But when you
  119 +distribute the same sections as part of a whole which is a work based
  120 +on the Program, the distribution of the whole must be on the terms of
  121 +this License, whose permissions for other licensees extend to the
  122 +entire whole, and thus to each and every part regardless of who wrote it.
  123 +
  124 +Thus, it is not the intent of this section to claim rights or contest
  125 +your rights to work written entirely by you; rather, the intent is to
  126 +exercise the right to control the distribution of derivative or
  127 +collective works based on the Program.
  128 +
  129 +In addition, mere aggregation of another work not based on the Program
  130 +with the Program (or with a work based on the Program) on a volume of
  131 +a storage or distribution medium does not bring the other work under
  132 +the scope of this License.
  133 +
  134 + 3. You may copy and distribute the Program (or a work based on it,
  135 +under Section 2) in object code or executable form under the terms of
  136 +Sections 1 and 2 above provided that you also do one of the following:
  137 +
  138 + a) Accompany it with the complete corresponding machine-readable
  139 + source code, which must be distributed under the terms of Sections
  140 + 1 and 2 above on a medium customarily used for software interchange; or,
  141 +
  142 + b) Accompany it with a written offer, valid for at least three
  143 + years, to give any third party, for a charge no more than your
  144 + cost of physically performing source distribution, a complete
  145 + machine-readable copy of the corresponding source code, to be
  146 + distributed under the terms of Sections 1 and 2 above on a medium
  147 + customarily used for software interchange; or,
  148 +
  149 + c) Accompany it with the information you received as to the offer
  150 + to distribute corresponding source code. (This alternative is
  151 + allowed only for noncommercial distribution and only if you
  152 + received the program in object code or executable form with such
  153 + an offer, in accord with Subsection b above.)
  154 +
  155 +The source code for a work means the preferred form of the work for
  156 +making modifications to it. For an executable work, complete source
  157 +code means all the source code for all modules it contains, plus any
  158 +associated interface definition files, plus the scripts used to
  159 +control compilation and installation of the executable. However, as a
  160 +special exception, the source code distributed need not include
  161 +anything that is normally distributed (in either source or binary
  162 +form) with the major components (compiler, kernel, and so on) of the
  163 +operating system on which the executable runs, unless that component
  164 +itself accompanies the executable.
  165 +
  166 +If distribution of executable or object code is made by offering
  167 +access to copy from a designated place, then offering equivalent
  168 +access to copy the source code from the same place counts as
  169 +distribution of the source code, even though third parties are not
  170 +compelled to copy the source along with the object code.
  171 +
  172 + 4. You may not copy, modify, sublicense, or distribute the Program
  173 +except as expressly provided under this License. Any attempt
  174 +otherwise to copy, modify, sublicense or distribute the Program is
  175 +void, and will automatically terminate your rights under this License.
  176 +However, parties who have received copies, or rights, from you under
  177 +this License will not have their licenses terminated so long as such
  178 +parties remain in full compliance.
  179 +
  180 + 5. You are not required to accept this License, since you have not
  181 +signed it. However, nothing else grants you permission to modify or
  182 +distribute the Program or its derivative works. These actions are
  183 +prohibited by law if you do not accept this License. Therefore, by
  184 +modifying or distributing the Program (or any work based on the
  185 +Program), you indicate your acceptance of this License to do so, and
  186 +all its terms and conditions for copying, distributing or modifying
  187 +the Program or works based on it.
  188 +
  189 + 6. Each time you redistribute the Program (or any work based on the
  190 +Program), the recipient automatically receives a license from the
  191 +original licensor to copy, distribute or modify the Program subject to
  192 +these terms and conditions. You may not impose any further
  193 +restrictions on the recipients' exercise of the rights granted herein.
  194 +You are not responsible for enforcing compliance by third parties to
  195 +this License.
  196 +
  197 + 7. If, as a consequence of a court judgment or allegation of patent
  198 +infringement or for any other reason (not limited to patent issues),
  199 +conditions are imposed on you (whether by court order, agreement or
  200 +otherwise) that contradict the conditions of this License, they do not
  201 +excuse you from the conditions of this License. If you cannot
  202 +distribute so as to satisfy simultaneously your obligations under this
  203 +License and any other pertinent obligations, then as a consequence you
  204 +may not distribute the Program at all. For example, if a patent
  205 +license would not permit royalty-free redistribution of the Program by
  206 +all those who receive copies directly or indirectly through you, then
  207 +the only way you could satisfy both it and this License would be to
  208 +refrain entirely from distribution of the Program.
  209 +
  210 +If any portion of this section is held invalid or unenforceable under
  211 +any particular circumstance, the balance of the section is intended to
  212 +apply and the section as a whole is intended to apply in other
  213 +circumstances.
  214 +
  215 +It is not the purpose of this section to induce you to infringe any
  216 +patents or other property right claims or to contest validity of any
  217 +such claims; this section has the sole purpose of protecting the
  218 +integrity of the free software distribution system, which is
  219 +implemented by public license practices. Many people have made
  220 +generous contributions to the wide range of software distributed
  221 +through that system in reliance on consistent application of that
  222 +system; it is up to the author/donor to decide if he or she is willing
  223 +to distribute software through any other system and a licensee cannot
  224 +impose that choice.
  225 +
  226 +This section is intended to make thoroughly clear what is believed to
  227 +be a consequence of the rest of this License.
  228 +
  229 + 8. If the distribution and/or use of the Program is restricted in
  230 +certain countries either by patents or by copyrighted interfaces, the
  231 +original copyright holder who places the Program under this License
  232 +may add an explicit geographical distribution limitation excluding
  233 +those countries, so that distribution is permitted only in or among
  234 +countries not thus excluded. In such case, this License incorporates
  235 +the limitation as if written in the body of this License.
  236 +
  237 + 9. The Free Software Foundation may publish revised and/or new versions
  238 +of the General Public License from time to time. Such new versions will
  239 +be similar in spirit to the present version, but may differ in detail to
  240 +address new problems or concerns.
  241 +
  242 +Each version is given a distinguishing version number. If the Program
  243 +specifies a version number of this License which applies to it and "any
  244 +later version", you have the option of following the terms and conditions
  245 +either of that version or of any later version published by the Free
  246 +Software Foundation. If the Program does not specify a version number of
  247 +this License, you may choose any version ever published by the Free Software
  248 +Foundation.
  249 +
  250 + 10. If you wish to incorporate parts of the Program into other free
  251 +programs whose distribution conditions are different, write to the author
  252 +to ask for permission. For software which is copyrighted by the Free
  253 +Software Foundation, write to the Free Software Foundation; we sometimes
  254 +make exceptions for this. Our decision will be guided by the two goals
  255 +of preserving the free status of all derivatives of our free software and
  256 +of promoting the sharing and reuse of software generally.
  257 +
  258 + NO WARRANTY
  259 +
  260 + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  261 +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
  262 +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  263 +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  264 +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  265 +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
  266 +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
  267 +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  268 +REPAIR OR CORRECTION.
  269 +
  270 + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  271 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  272 +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  273 +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  274 +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  275 +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  276 +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  277 +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  278 +POSSIBILITY OF SUCH DAMAGES.
  279 +
  280 + END OF TERMS AND CONDITIONS
  281 +
  282 + How to Apply These Terms to Your New Programs
  283 +
  284 + If you develop a new program, and you want it to be of the greatest
  285 +possible use to the public, the best way to achieve this is to make it
  286 +free software which everyone can redistribute and change under these terms.
  287 +
  288 + To do so, attach the following notices to the program. It is safest
  289 +to attach them to the start of each source file to most effectively
  290 +convey the exclusion of warranty; and each file should have at least
  291 +the "copyright" line and a pointer to where the full notice is found.
  292 +
  293 + <one line to give the program's name and a brief idea of what it does.>
  294 + Copyright (C) <year> <name of author>
  295 +
  296 + This program is free software; you can redistribute it and/or modify
  297 + it under the terms of the GNU General Public License as published by
  298 + the Free Software Foundation; either version 2 of the License, or
  299 + (at your option) any later version.
  300 +
  301 + This program is distributed in the hope that it will be useful,
  302 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  303 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  304 + GNU General Public License for more details.
  305 +
  306 + You should have received a copy of the GNU General Public License
  307 + along with this program; if not, write to the Free Software
  308 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  309 +
  310 +
  311 +Also add information on how to contact you by electronic and paper mail.
  312 +
  313 +If the program is interactive, make it output a short notice like this
  314 +when it starts in an interactive mode:
  315 +
  316 + Gnomovision version 69, Copyright (C) year name of author
  317 + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  318 + This is free software, and you are welcome to redistribute it
  319 + under certain conditions; type `show c' for details.
  320 +
  321 +The hypothetical commands `show w' and `show c' should show the appropriate
  322 +parts of the General Public License. Of course, the commands you use may
  323 +be called something other than `show w' and `show c'; they could even be
  324 +mouse-clicks or menu items--whatever suits your program.
  325 +
  326 +You should also get your employer (if you work as a programmer) or your
  327 +school, if any, to sign a "copyright disclaimer" for the program, if
  328 +necessary. Here is a sample; alter the names:
  329 +
  330 + Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  331 + `Gnomovision' (which makes passes at compilers) written by James Hacker.
  332 +
  333 + <signature of Ty Coon>, 1 April 1989
  334 + Ty Coon, President of Vice
  335 +
  336 +This General Public License does not permit incorporating your program into
  337 +proprietary programs. If your program is a subroutine library, you may
  338 +consider it more useful to permit linking proprietary applications with the
  339 +library. If this is what you want to do, use the GNU Library General
  340 +Public License instead of this License.
... ...
games/ninvaders/ninvaders-0.1.1/ind.html 0 → 100644
... ... @@ -0,0 +1,111 @@
  1 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  2 +<HTML>
  3 +<HEAD>
  4 + <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
  5 + <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; Linux 2.3.99-pre3 i686) [Netscape]">
  6 + <META NAME="Author" CONTENT="johnie@debian.org (Johnie Ingram)">
  7 + <META NAME="Description" CONTENT="The initial installation of Debian/GNU Apache.">
  8 + <TITLE>Welcome to Your New Home Page!</TITLE>
  9 +</HEAD>
  10 +<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EF" VLINK="#55188A" ALINK="#FF0000">
  11 +
  12 +<BR>
  13 +
  14 +<H1>Welcome to Your New Home in Cyberspace!</H1>
  15 +
  16 +<HR NOSHADE>
  17 +<BR>
  18 +
  19 +<IMG ALIGN="right" ALT="" HEIGHT="247" WIDTH="278" SRC="icons/jhe061.gif">
  20 +
  21 +<P>This is a placeholder page installed by the <A HREF="http://www.debian.org/">Debian</A>
  22 +release of the <A HREF="http://www.apache.org/">Apache</A> Web server package,
  23 +because no home page was installed on this host. You may want to replace
  24 +this as soon as possible with your own web pages, of course....
  25 +
  26 +<BLOCKQUOTE>
  27 +This computer has installed the Debian GNU/Linux operating system but has
  28 +nothing to do with the Debian GNU/Linux project. If you want to
  29 +report something about this host's behavior or domain, please contact the
  30 +ISPs involved directly, <strong>not</strong> the Debian Project.
  31 +<P>See the <A HREF="http://www.abuse.net/">Network Abuse Clearinghouse</A>
  32 +for how to do this.
  33 +</BLOCKQUOTE>
  34 +
  35 +<P>Unless you changed its configuration, your new server is configured as follows:
  36 +<UL>
  37 +<LI>
  38 +Configuration files can be found in <TT>/etc/apache</TT>.</LI>
  39 +
  40 +<LI>
  41 +The <TT>DocumentRoot</TT>, which is the directory under which all your
  42 +HTML files should exist, is set to <TT>/var/www</TT>.</LI>
  43 +
  44 +<LI>
  45 +CGI scripts are looked for in <TT>/usr/lib/cgi-bin</TT>, which is where
  46 +Debian packages will place their scripts.</LI>
  47 +
  48 +<LI>
  49 +Log files are placed in <TT>/var/log/apache</TT>, and will be rotated
  50 +daily. The frequency of rotation can be easily changed by editing
  51 +<TT>/etc/apache/cron.conf</TT>.</LI>
  52 +
  53 +<LI>
  54 +The default directory index is <TT>index.html</TT>, meaning that requests
  55 +for a directory <TT>/foo/bar/</TT> will give the contents of the file <TT>/var/www/foo/bar/index.html</TT>
  56 +if it exists (assuming that <TT>/var/www</TT> is your <TT>DocumentRoot</TT>).</LI>
  57 +
  58 +<LI>
  59 +User directories are enabled, and user documents will be looked for in
  60 +the <TT>public_html</TT> directory of the users' homes. These dirs
  61 +should be under /home, and users will not be able to symlink to files
  62 +they don't own.</LI>
  63 +
  64 +</UL>
  65 +All standard Apache modules are available with this release and can be
  66 +chosen with the <TT>apacheconfig</TT> script. Installing a new module on
  67 +your system is just a matter of compiling it (with the apache-dev package)
  68 +and adding a line to your <TT>httpd.conf</TT> configuration file.
  69 +
  70 +<P>More documentation on Apache can be found on:
  71 +<UL>
  72 +<LI>
  73 +The <A HREF="/doc/apache/">Apache documentation</A> stored on your server.</LI>
  74 +
  75 +<LI>
  76 +The <A HREF="http://www.apache.org/">Apache Project</A> home site.</LI>
  77 +
  78 +<LI>
  79 +The <A HREF="http://www.apacheweek.com/">ApacheWeek</A> newsletter.</LI>
  80 +
  81 +<LI>
  82 +The <A HREF="http://www.debian.org/doc/">Debian Project
  83 +Documentation</A> which contains HOWTOs, FAQs, and software updates.</LI>
  84 +</UL>
  85 +
  86 +<P>You can also consult the list of <A HREF="http://www.boutell.com/faq/">World
  87 +Wide Web Frequently Asked Questions</A> for information.
  88 +
  89 +<P>If you find a bug in this Apache package, or in Apache itself,
  90 +please file a bug report on it. Instructions on doing this, and the
  91 +list of <A HREF="http://bugs.debian.org/apache">known bugs</A> of this
  92 +package, can be found in the <A
  93 +HREF="http://www.debian.org/Bugs/">Debian Bug Tracking System</A>.
  94 +
  95 +<P>Thanks for using this package, and congratulations for your choice of
  96 +a Debian system!
  97 +
  98 +<BR>
  99 +<P ALIGN="CENTER">
  100 +<IMG HEIGHT="30" WIDTH="25" SRC="icons/debian/openlogo-25.jpg" ALT="Debian">
  101 +<IMG HEIGHT="32" WIDTH="259" SRC="icons/apache_pb.gif" ALT="Apache"></P>
  102 +
  103 +<BR>
  104 +
  105 +<P>
  106 +<HR NOSHADE>
  107 +<FONT SIZE=-1><A HREF="http://netgod.net/">Johnie Ingram</A>,
  108 +Treasure Island, California &nbsp;&nbsp; 13 October 2001.</FONT>
  109 +
  110 +</BODY>
  111 +</HTML>
... ...
games/ninvaders/ninvaders-0.1.1/nInvaders.c 0 → 100644
... ... @@ -0,0 +1,367 @@
  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 <stdio.h>
  26 +#include <string.h>
  27 +#include <sys/time.h>
  28 +#include "nInvaders.h"
  29 +#include "player.h"
  30 +#include "aliens.h"
  31 +#include "ufo.h"
  32 +
  33 +#define FPS 50
  34 +
  35 +int lives;
  36 +long score;
  37 +int status; // status handled in timer
  38 +
  39 +#define GAME_LOOP 1
  40 +#define GAME_NEXTLEVEL 2
  41 +#define GAME_PAUSED 3
  42 +#define GAME_OVER 4
  43 +#define GAME_EXIT 5
  44 +#define GAME_HIGHSCORE 6
  45 +
  46 +
  47 +
  48 +
  49 +/**
  50 + * initialize level: reset attributes of most units
  51 + */
  52 +static void initLevel()
  53 +{
  54 + playerReset();
  55 + aliensReset();
  56 + ufoReset();
  57 + bunkersReset();
  58 + render();
  59 + drawscore();
  60 +}
  61 +
  62 +
  63 +/**
  64 + * evaluate command line parameters
  65 + */
  66 +static void evaluateCommandLine(int argc, char **argv)
  67 +{
  68 +
  69 + // -l : set skill level
  70 + if (argc == 3 && strcmp(argv[1], "-l") == 0) {
  71 + if (argv[2][0] >= '0' && argv[2][0] <= '9') {
  72 + skill_level = argv[2][0] - 48;
  73 + } else {
  74 + argc = 2;
  75 + }
  76 + }
  77 +
  78 + // -gpl : show GNU GPL
  79 + if (argc == 2 && strcmp(argv[1], "-gpl") == 0) {
  80 + showGpl();
  81 + }
  82 +
  83 + // wrong command line: show usage
  84 + if (argc == 2 || (argc == 3 && strcmp(argv[1], "-l") != 0)) {
  85 + showVersion();
  86 + showUsage();
  87 + exit(1);
  88 + }
  89 +}
  90 +
  91 +
  92 +static void finish(int sig)
  93 +{
  94 + endwin();
  95 + showGplShort();
  96 +
  97 + fprintf(stderr,"\n");
  98 + fprintf(stderr,"\n");
  99 + fprintf(stderr,"=========================================================================\n");
  100 + fprintf(stderr,"\n");
  101 +
  102 + fprintf(stderr,"Final score: %7.7ld, Final level: %2.2d\nFinal rating... ",score,level);
  103 + if (lives>0)
  104 + fprintf(stderr,"Quitter\n\n");
  105 + else if(score<5000)
  106 + fprintf(stderr,"Alien Fodder\n\n");
  107 + else if(score<7500)
  108 + fprintf(stderr,"Easy Target\n\n");
  109 + else if(score<10000)
  110 + fprintf(stderr,"Barely Mediocre\n\n");
  111 + else if(score<12500)
  112 + fprintf(stderr,"Shows Promise\n\n");
  113 + else if(score<15000)
  114 + fprintf(stderr,"Alien Blaster\n\n");
  115 + else if(score<20000)
  116 + fprintf(stderr,"Earth Defender\n\n");
  117 + else if(score>19999)
  118 + fprintf(stderr,"Supreme Protector\n\n");
  119 +
  120 + showVersion();
  121 + exit(0);
  122 +}
  123 +
  124 +
  125 +void drawscore()
  126 +{
  127 + statusDisplay(level, score, lives);
  128 +}
  129 +
  130 +
  131 +/**
  132 + * reads input from keyboard and do action
  133 + */
  134 +void readInput()
  135 +{
  136 + int ch;
  137 + static int lastmove;
  138 +
  139 + ch = getch(); // get key pressed
  140 +
  141 + switch (status) {
  142 +
  143 + case GAME_PAUSED:
  144 +
  145 + if (ch == 'p') {
  146 + status = GAME_LOOP;
  147 + }
  148 + break;
  149 +
  150 + case GAME_HIGHSCORE:
  151 +
  152 + if (ch == ' ') {
  153 + titleScreenClear();
  154 + level = 0; // reset level
  155 + score = 0; // reset score
  156 + lives = 3; // restore lives
  157 + status = GAME_NEXTLEVEL;
  158 + } else if (ch == 'q') { // quit game
  159 + status = GAME_EXIT;
  160 + }
  161 + break;
  162 +
  163 + case GAME_OVER:
  164 + break; // don't do anything
  165 +
  166 + default:
  167 +
  168 + if (ch == 'l' || ch == KEY_RIGHT) { // move player right
  169 + if (lastmove == 'l') {
  170 + playerTurboOn(); // enable Turbo
  171 + } else {
  172 + playerTurboOff(); // disable Turbo
  173 + }
  174 + playerMoveRight(); // move player
  175 + lastmove = 'l'; // remember last move for turbo mode
  176 + } else if (ch == 'h' || ch == KEY_LEFT) { // move player left
  177 + if (lastmove == 'h') {
  178 + playerTurboOn(); // enable Turbo
  179 + } else {
  180 + playerTurboOff(); // disable Turbo
  181 + }
  182 + playerMoveLeft(); // move player
  183 + lastmove = 'h'; // remember last move for turbo mode
  184 + } else if (ch == 'k' || ch == ' ') { // shoot missile
  185 + playerLaunchMissile();
  186 + } else if (ch == 'p') { // pause game until 'p' pressed again
  187 + // set status to game paused
  188 + status = GAME_PAUSED;
  189 + } else if (ch == 'W') { // cheat: goto next level
  190 + status = GAME_NEXTLEVEL;
  191 + } else if (ch == 'L') { // cheat: one more live
  192 + lives++;
  193 + drawscore();
  194 + } else if (ch == 'q') { // quit game
  195 + status = GAME_EXIT;
  196 + } else { // disable turbo mode if key is not kept pressed
  197 + lastmove = ' ';
  198 + }
  199 +
  200 + } // switch
  201 +
  202 +}
  203 +
  204 +
  205 +/**
  206 + * timer
  207 + * this method is executed every 1 / FPS seconds
  208 + */
  209 +void handleTimer()
  210 +{
  211 + static int aliens_move_counter = 0;
  212 + static int aliens_shot_counter = 0;
  213 + static int player_shot_counter = 0;
  214 + static int ufo_move_counter = 0;
  215 + static int title_animation_counter = 0;
  216 + static int game_over_counter = 0;
  217 +
  218 + switch (status) {
  219 +
  220 + case GAME_NEXTLEVEL: // go to next level
  221 +
  222 + level++; // increase level
  223 +
  224 + initLevel(); // initialize level
  225 +
  226 + aliens_move_counter = 0;
  227 + aliens_shot_counter = 0;
  228 + player_shot_counter = 0;
  229 + ufo_move_counter = 0;
  230 +
  231 + weite = (shipnum+(skill_level*10)-(level*5)+5)/10;
  232 +
  233 + if (weite < 0) {
  234 + weite = 0;
  235 + }
  236 +
  237 + // change status and start game!
  238 + status = GAME_LOOP;
  239 +
  240 + case GAME_LOOP: // do game handling
  241 +
  242 + // move aliens
  243 + if (aliens_move_counter == 0 && aliensMove() == 1) {
  244 + // aliens reached player
  245 + lives = 0;
  246 + status = GAME_OVER;
  247 + }
  248 +
  249 + // move player missile
  250 + if (player_shot_counter == 0 && playerMoveMissile() == 1) {
  251 + // no aliens left
  252 + status = GAME_NEXTLEVEL;
  253 + }
  254 +
  255 + // move aliens' missiles
  256 + if (aliens_shot_counter == 0 && aliensMissileMove() == 1) {
  257 + // player was hit
  258 + lives--; // player looses one life
  259 + drawscore(); // draw score
  260 + playerExplode(); // display some explosion graphics
  261 + if (lives == 0) { // if no lives left ...
  262 + status = GAME_OVER; // ... exit game
  263 + }
  264 + }
  265 +
  266 + // move ufo
  267 + if (ufo_move_counter == 0 && ufoShowUfo() == 1) {
  268 + ufoMoveLeft(); // move it one position to the left
  269 + }
  270 +
  271 +
  272 + if (aliens_shot_counter++ >= 5) {aliens_shot_counter=0;} // speed of alien shot
  273 + if (player_shot_counter++ >= 1) {player_shot_counter=0;} // speed of player shot
  274 + if (aliens_move_counter++ >= weite) {aliens_move_counter=0;} // speed of aliend
  275 + if (ufo_move_counter++ >= 3) {ufo_move_counter=0;} // speed of ufo
  276 +
  277 + refreshScreen();
  278 + break;
  279 +
  280 + case GAME_PAUSED: // game is paused
  281 + break;
  282 +
  283 + case GAME_OVER: // game over
  284 + if (game_over_counter == 100) {
  285 + battleFieldClear();
  286 + status = GAME_HIGHSCORE;
  287 + game_over_counter = 0;
  288 + } else {
  289 + gameOverDisplay();
  290 + game_over_counter++;
  291 + }
  292 + break;
  293 +
  294 + case GAME_EXIT: // exit game
  295 + finish(0);
  296 + break;
  297 +
  298 + case GAME_HIGHSCORE: // display highscore
  299 + if (title_animation_counter == 0) {
  300 + titleScreenDisplay();
  301 + }
  302 +
  303 + if (title_animation_counter++ >= 6) {title_animation_counter = 0;} // speed of animation
  304 + break;
  305 +
  306 + }
  307 +}
  308 +
  309 +
  310 +/**
  311 + * set up timer
  312 + */
  313 +void setUpTimer()
  314 +{
  315 + struct itimerval myTimer;
  316 + struct sigaction myAction;
  317 + myTimer.it_value.tv_sec = 0;
  318 + myTimer.it_value.tv_usec = 1000000 / FPS;
  319 + myTimer.it_interval.tv_sec = 0;
  320 + myTimer.it_interval.tv_usec = 1000000 / FPS;
  321 + setitimer(ITIMER_REAL, &myTimer, NULL);
  322 +
  323 + myAction.sa_handler = &handleTimer;
  324 + myAction.sa_flags = SA_RESTART;
  325 + sigaction(SIGALRM, &myAction, NULL);
  326 +}
  327 +
  328 +
  329 +int main(int argc, char **argv)
  330 +{
  331 + weite = 0;
  332 + score = 0;
  333 + lives = 3;
  334 + level = 0;
  335 + skill_level = 1;
  336 +
  337 + evaluateCommandLine(argc, argv); // evaluate command line parameters
  338 + graphicEngineInit(); // initialize graphic engine
  339 +
  340 + // set up timer/ game handling
  341 + setUpTimer();
  342 + status = GAME_HIGHSCORE;
  343 +
  344 + // read keyboard input
  345 + do {
  346 + // do movements and key-checking
  347 + readInput();
  348 + } while (0 == 0);
  349 +
  350 + return 0;
  351 +}
  352 +
  353 +
  354 +void doScoring(int alienType)
  355 +{
  356 + int points[4] = {500, 200, 150, 100}; // 0: ufo, 1:red, 2:green, 3:blue
  357 +
  358 + score += points[alienType]; // every alien type does different scoring points
  359 +
  360 + // every 6000 pts player gets a new live
  361 + if (score % 6000 == 0){
  362 + lives++;
  363 + }
  364 +
  365 + drawscore(); // display score
  366 +}
  367 +
... ...
games/ninvaders/ninvaders-0.1.1/nInvaders.h 0 → 100644
... ... @@ -0,0 +1,60 @@
  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 <stdio.h>
  26 +#include <stdlib.h>
  27 +#include "view.h"
  28 +#include "globals.h"
  29 +
  30 +
  31 +#ifndef NINVADERS
  32 +#define NINVADERS
  33 +
  34 +#define UFO_ALIEN_TYPE 0
  35 +#define RED_ALIEN_TYPE 1
  36 +#define GREEN_ALIEN_TYPE 2
  37 +#define BLUE_ALIEN_TYPE 3
  38 +
  39 +int main(int argv, char **argc); // hey! it has to start somewhere!
  40 +
  41 +extern void render(void);
  42 +
  43 +void game_over(int a);
  44 +void drawscore();
  45 +
  46 +void doScoring(int alienType);
  47 +
  48 +// todo: let's try to not having to declare these "public"
  49 +int weite;
  50 +int level;
  51 +int skill_level;
  52 +
  53 +// included from globals.h
  54 +extern void doSleep();
  55 +extern void showUsage();
  56 +extern void showVersion();
  57 +extern void showGplShort();
  58 +extern void showGpl();
  59 +
  60 +#endif
... ...
games/ninvaders/ninvaders-0.1.1/player.c 0 → 100644
... ... @@ -0,0 +1,240 @@
  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 "player.h"
  26 +#include "aliens.h"
  27 +#include "ufo.h"
  28 +#include "nInvaders.h"
  29 +
  30 +typedef struct Player Player;
  31 +
  32 +struct Player {
  33 + int posX; // horizontal position of player
  34 + int posY; // vertical position of player
  35 + int speed; // 0: no movement; 1: one per turn; etc.
  36 + int missileFired; // 0: missile not running; 1: missile running
  37 + int missileX; // horizontal position of missile
  38 + int missileY; // vertical position of missile
  39 +};
  40 +
  41 +Player player;
  42 +
  43 +/**
  44 + * initialize player attributes
  45 + */
  46 +void playerReset()
  47 +{
  48 + // if missile was fired clear that position
  49 + if (player.missileFired == 1) {
  50 + playerMissileClear(player.missileX, player.missileY);
  51 + }
  52 +
  53 + playerClear(player.posX, player.posY); // clear old position of player
  54 +
  55 + player.posY = PLAYERPOSY; // set vertical Position
  56 + player.posX = 0; // set horizontal Position
  57 + player.speed = 1;
  58 + player.missileFired = 0;
  59 + player.missileX=0;
  60 + player.missileY=0;
  61 +
  62 + playerDisplay(player.posX, player.posY); // display new position of player
  63 +}
  64 +
  65 +
  66 +/**
  67 + * move player horizontally to position newPosX
  68 + */
  69 +static void playerMove(int newPosX)
  70 +{
  71 + playerClear(player.posX, player.posY); // clear sprite
  72 + player.posX = newPosX; // make movement
  73 + playerDisplay(player.posX, player.posY); // display sprite
  74 +}
  75 +
  76 +
  77 +/**
  78 + * move player left
  79 + */
  80 +void playerMoveLeft()
  81 +{
  82 + // check if space between player and border of screen is big enough
  83 + if (player.posX > 0 + player.speed) {
  84 + // desired movement is possible
  85 + playerMove(player.posX - player.speed);
  86 + } else {
  87 + // space too small, move to left-most position
  88 + playerMove(0);
  89 + }
  90 +}
  91 +
  92 +
  93 +/**
  94 + * move player right
  95 + */
  96 +void playerMoveRight()
  97 +{
  98 + // check if space between player and border of screen is big enough
  99 + if (player.posX < SCREENWIDTH - PLAYERWIDTH - player.speed) {
  100 + // desired movement is possible
  101 + playerMove(player.posX + player.speed);
  102 + } else {
  103 + // space too small, move to right-most position
  104 + playerMove(SCREENWIDTH - PLAYERWIDTH);
  105 + }
  106 +}
  107 +
  108 +
  109 +/**
  110 + * toggle turbo mode on (if key is kept pressed)
  111 + */
  112 +void playerTurboOn()
  113 +{
  114 + player.speed = 2;
  115 +}
  116 +
  117 +
  118 +/**
  119 + * toggle turbo mode off (if key is kept pressed)
  120 + */
  121 +void playerTurboOff()
  122 +{
  123 + player.speed = 1;
  124 +}
  125 +
  126 +
  127 +/**
  128 + * player was hit by an alien shot
  129 + */
  130 +int playerHitCheck(int hostileShotX, int hostileShotY)
  131 +{
  132 + int fPlayerWasHit = 0;
  133 +
  134 + // if shot reached vertikal position of player
  135 + if (hostileShotY == PLAYERPOSY) {
  136 + // if shot hits player
  137 + if (hostileShotX >= player.posX && hostileShotX <= player.posX + PLAYERWIDTH -1) {
  138 + fPlayerWasHit = 1; // set return value
  139 + }
  140 + }
  141 +
  142 + return fPlayerWasHit; // return if player was hit
  143 +}
  144 +
  145 +
  146 +/**
  147 + * Launch Missile
  148 + */
  149 +void playerLaunchMissile()
  150 +{
  151 + // only launch missile if no other is on its way
  152 + if (player.missileFired == 0) {
  153 + player.missileFired = 1; // missile is on its way
  154 + player.missileX = player.posX + PLAYERWIDTH / 2; // launched from the middle of player...
  155 + player.missileY = PLAYERPOSY; // ...at same horizontal position
  156 + }
  157 +}
  158 +
  159 +
  160 +/**
  161 + * Reload Missile
  162 + */
  163 +static void playerReloadMissile()
  164 +{
  165 + player.missileFired = 0; // no player missile flying
  166 +}
  167 +
  168 +
  169 +/**
  170 + * move player missile and do alien/bunker hit testing
  171 + * return value - 0: still some aliens left, 1: no aliens left
  172 + */
  173 +int playerMoveMissile()
  174 +{
  175 + int fNoAliensLeft = 0; // return value
  176 + int alienTypeHit = 0;
  177 +
  178 + // only do movements if there is a missile to move
  179 + if (player.missileFired == 1) {
  180 +
  181 + playerMissileClear(player.missileX, player.missileY); // clear old missile position
  182 + playerDisplay(player.posX, player.posY); // todo: check if this can be removed later if missiled is fired,
  183 + //the middle of player is cleared
  184 + player.missileY--; // move missile
  185 +
  186 + // if missile out of battlefield
  187 + if (player.missileY < 0) {
  188 + playerReloadMissile(); // reload missile
  189 + } else {
  190 + playerMissileDisplay(player.missileX, player.missileY); // display missile at new position
  191 + }
  192 +
  193 + // if missile hits an alien (TODO)
  194 + alienTypeHit = aliensHitCheck(player.missileX, player.missileY);
  195 + if (alienTypeHit != 0) {
  196 +
  197 + doScoring(alienTypeHit); // increase score
  198 + playerReloadMissile(); // reload missile
  199 +
  200 + aliensClear(aliens.posX, aliens.posY, aliens.right, aliens.bottom); // clear old posiiton of aliens
  201 +
  202 + render();
  203 + if (shipnum == 0) {
  204 + fNoAliensLeft = 1;
  205 + }
  206 +
  207 + // speed of aliens
  208 + weite = (shipnum + (skill_level * 10) - (level * 5) + 5) / 10;
  209 + if (weite < 0) {
  210 + weite = 0;
  211 + }
  212 +
  213 + playerMissileClear(player.missileX, player.missileY); // clear old missile position
  214 + aliensDisplay(aliens.posX, aliens.posY, aliens.right, aliens.bottom); // display aliens
  215 + }
  216 +
  217 + // if missile hits a bunker
  218 + if (bunkersHitCheck(player.missileX, player.missileY) == 1) {
  219 + bunkersClearElement(player.missileX, player.missileY); // clear element of bunker
  220 + playerReloadMissile(); // reload player missile
  221 + }
  222 +
  223 + // if missile hits ufo
  224 + if (ufoHitCheck(player.missileX, player.missileY) == 1) {
  225 + doScoring(UFO_ALIEN_TYPE);
  226 + playerReloadMissile();
  227 + }
  228 + }
  229 +
  230 + return fNoAliensLeft;
  231 +
  232 +}
  233 +
  234 +/**
  235 + * let player explode
  236 + */
  237 +void playerExplode(){
  238 + playerExplosionDisplay(player.posX, player.posY);
  239 + playerDisplay(player.posX, player.posY);
  240 +}
... ...
games/ninvaders/ninvaders-0.1.1/player.h 0 → 100644
... ... @@ -0,0 +1,55 @@
  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 +#ifndef PLAYER
  26 +#define PLAYER
  27 +
  28 +#include "view.h"
  29 +
  30 +
  31 +void playerReset();
  32 +
  33 +void playerMoveLeft();
  34 +void playerMoveRight();
  35 +void playerTurboOn();
  36 +void playerTurboOff();
  37 +int playerHitCheck(int hostileShotX, int hostileShotY);
  38 +void playerLaunchMissile();
  39 +int playerMoveMissile();
  40 +void playerExplode();
  41 +
  42 +// methods that handle graphic display, from view.c
  43 +extern void playerInit();
  44 +extern void playerDisplay(int x, int y);
  45 +extern void playerClear(int x, int y);
  46 +extern void playerMissileInit();
  47 +extern void playerMissileDisplay(int x, int y);
  48 +extern void playerMissileClear(int x, int y);
  49 +extern void playerExplosionDisplay(int x, int y);
  50 +extern void bunkersClearElement(int x, int y);
  51 +
  52 +extern void doScoring(int alienType);
  53 +
  54 +#endif
  55 +
... ...
games/ninvaders/ninvaders-0.1.1/ufo.c 0 → 100644
... ... @@ -0,0 +1,101 @@
  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 "ufo.h"
  26 +#include "aliens.h"
  27 +#include "nInvaders.h"
  28 +
  29 +static int fShowUfo = 0;
  30 +
  31 +/**
  32 + * initialize ufo attributes
  33 + */
  34 +void ufoReset()
  35 +{
  36 + ufoClear(ufo.posX, ufo.posY); // clear old position of player
  37 +
  38 + fShowUfo = 0; // do not show ufo
  39 + ufo.posY = UFOPOSY; // set vertical Position
  40 + ufo.posX = SCREENWIDTH - UFOWIDTH;// set horizontal Position
  41 +}
  42 +
  43 +/**
  44 + * move ufo horizontally to position posX
  45 + */
  46 +static void ufoMove(int posX)
  47 +{
  48 + ufoClear(ufo.posX, ufo.posY); // clear sprite
  49 + ufo.posX = posX;
  50 + ufoRefresh();
  51 + ufoDisplay(ufo.posX, ufo.posY);
  52 +}
  53 +
  54 +
  55 +/**
  56 + * move ufo and check if it reached the left screen border
  57 + */
  58 +void ufoMoveLeft()
  59 +{
  60 + // check if space between ufo and screen border is big enough
  61 + if (ufo.posX > 1) {
  62 + // desired movement is possible
  63 + ufoMove(ufo.posX - 1);
  64 + } else {
  65 + ufoReset();
  66 + }
  67 +}
  68 +
  69 +/**
  70 + * check if the first screen line is free for the ufo and
  71 + * display it randomly
  72 + */
  73 +int ufoShowUfo()
  74 +{
  75 + if (aliens.posY > 0 && fShowUfo == 0) { // aliens one line down
  76 + if ((random() % 200) == 0) {
  77 + fShowUfo = 1;
  78 + }
  79 + }
  80 +
  81 + return fShowUfo;
  82 +}
  83 +
  84 +/**
  85 + * check if ufo was hit by player and delete it from screen
  86 + */
  87 +int ufoHitCheck(int shotX, int shotY)
  88 +{
  89 + int fUfoWasHit = 0;
  90 +
  91 + // if shot reached vertikal position of ufo
  92 + if (shotY == UFOPOSY) {
  93 + // if shot hits ufo
  94 + if (shotX >= ufo.posX && shotX <= ufo.posX + UFOWIDTH -1) {
  95 + ufoReset();
  96 + fUfoWasHit = 1;
  97 + }
  98 + }
  99 +
  100 + return fUfoWasHit;
  101 +}
... ...
games/ninvaders/ninvaders-0.1.1/ufo.h 0 → 100644
... ... @@ -0,0 +1,49 @@
  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 UFO
  28 +#define UFO
  29 +
  30 +typedef struct Ufo Ufo;
  31 +
  32 +struct Ufo {
  33 + int posX; // horizontal position of aliens
  34 + int posY; // vertical position of aliens
  35 +};
  36 +
  37 +Ufo ufo;
  38 +
  39 +void ufoReset();
  40 +int ufoShowUfo();
  41 +void ufoMoveLeft();
  42 +int ufoHitCheck(int shotX, int shotY);
  43 +
  44 +// methods that handle graphic display, from view.c
  45 +extern void ufoDisplay(int x, int y);
  46 +extern void ufoRefresh();
  47 +extern void ufoClear(int x, int y);
  48 +
  49 +#endif
... ...
games/ninvaders/ninvaders-0.1.1/view.c 0 → 100644
... ... @@ -0,0 +1,589 @@
  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 +#include "globals.h"
  27 +#include <stdlib.h>
  28 +#include <unistd.h>
  29 +#include <signal.h>
  30 +
  31 +#define RED 1
  32 +#define GREEN 2
  33 +#define YELLOW 3
  34 +#define BLUE 4
  35 +#define CYAN 5
  36 +#define MAGENTA 6
  37 +#define WHITE 7
  38 +
  39 +WINDOW *wBattleField;
  40 +WINDOW *wEmpty;
  41 +WINDOW *wScores;
  42 +
  43 +WINDOW *wPlayer;
  44 +WINDOW *wPlayerMissile;
  45 +WINDOW *wAliens;
  46 +WINDOW *wAliensMissile;
  47 +WINDOW *wBunkers;
  48 +WINDOW *wGameOver;
  49 +WINDOW *wUfo;
  50 +WINDOW *wStatus;
  51 +WINDOW *wTitleScreen;
  52 +
  53 +/**
  54 + * initialize player sprites
  55 + */
  56 +static void playerInit()
  57 +{
  58 + wPlayer = newpad(1, PLAYERWIDTH); // new pad with appropriate size
  59 + wclear(wPlayer); // clear pad
  60 + wattrset(wPlayer,COLOR_PAIR(YELLOW)); // set color
  61 + waddstr(wPlayer,"/-^-\\"); // set sprite
  62 +}
  63 +
  64 +
  65 +/**
  66 + * display player sprite
  67 + */
  68 +void playerDisplay(int x, int y)
  69 +{
  70 + copywin(wPlayer,wBattleField,0,0,y,x,y,x+PLAYERWIDTH-1,0);
  71 +}
  72 +
  73 +
  74 +/**
  75 + * clear player sprite
  76 + */
  77 +void playerClear(int x, int y)
  78 +{
  79 + copywin(wEmpty,wBattleField,0,0,y,x,y,x+PLAYERWIDTH-1,0);
  80 +}
  81 +
  82 +
  83 +/**
  84 + * initialize missile sprites
  85 + */
  86 +static void playerMissileInit()
  87 +{
  88 + wPlayerMissile = newpad(1, 1); // new pad with appropriate size
  89 + wclear(wPlayerMissile); // clear pad
  90 + wattrset(wPlayerMissile,COLOR_PAIR(WHITE)); // set color
  91 + waddch(wPlayerMissile,'!'); // set sprite
  92 + wrefresh(wPlayerMissile);
  93 +}
  94 +
  95 +
  96 +/**
  97 + * display missile sprite
  98 + */
  99 +void playerMissileDisplay(int x, int y)
  100 +{
  101 + copywin(wPlayerMissile,wBattleField,0,0,y,x,y,x,0);
  102 +}
  103 +
  104 +
  105 +/**
  106 + * clear missile sprite
  107 + */
  108 +void playerMissileClear(int x, int y)
  109 +{
  110 + copywin(wEmpty,wBattleField,0,0,y,x,y,x,0);
  111 +}
  112 +
  113 +
  114 +/**
  115 + * some explosion animation
  116 + */
  117 +void playerExplosionDisplay(int x, int y)
  118 +{
  119 + WINDOW* wPlayerExplosion;
  120 + char playerExplosionChars[16+1]="@~`.,^#*-_=\\/%{}";
  121 + int t,s;
  122 +
  123 + wPlayerExplosion=newpad(1,PLAYERWIDTH); // new pad
  124 + wattrset(wPlayerExplosion,COLOR_PAIR(YELLOW)); // set color
  125 +
  126 + for(t=0;t<5;t++){ // 5 frames
  127 + wclear(wPlayerExplosion); // clear pad
  128 + for(s=0;s<PLAYERWIDTH;s++){
  129 + waddch(wPlayerExplosion,playerExplosionChars[rand()%16]); // sprite
  130 + }
  131 +
  132 + copywin(wPlayerExplosion,wBattleField,0,0,y,x,y,x+PLAYERWIDTH-1,0); // display explostion
  133 + wrefresh(wBattleField); // refresh battelfield to display explosion frames
  134 + doSleep(100000); // play animation not too fast
  135 + }
  136 +
  137 +
  138 +} // todo: kann man bestimmt noch besser machen.
  139 +
  140 +
  141 +/**
  142 + * initialize aliens sprites
  143 + */
  144 +static void aliensInit()
  145 +{
  146 + wAliens = newpad(ALIENS_MAX_NUMBER_Y*2,ALIENS_MAX_NUMBER_X*3);
  147 + wclear(wAliens);
  148 +}
  149 +
  150 +
  151 +/**
  152 + * display aliens sprite
  153 + */
  154 +void aliensDisplay(int x, int y, int wid, int hgt)
  155 +{
  156 + copywin(wAliens,wBattleField,0,0,y,x,y+hgt,x+wid+2,0);
  157 +}
  158 +
  159 +
  160 +/**
  161 + * clear aliens sprite
  162 + */
  163 +void aliensClear(int x, int y, int wid, int hgt)
  164 +{
  165 + copywin(wEmpty,wBattleField,0,0,y,x,y+hgt,x+wid+2,0);
  166 +}
  167 +
  168 +
  169 +/**
  170 + * initialize missile sprites
  171 + */
  172 +static void aliensMissileInit()
  173 +{
  174 + wAliensMissile = newpad(1, 1); // new pad
  175 + wclear(wAliensMissile); // clear pad
  176 + wattrset(wAliensMissile, COLOR_PAIR(CYAN)); // set color
  177 + waddch(wAliensMissile, ':'); // set sprite
  178 +}
  179 +
  180 +
  181 +/**
  182 + * display missile sprite
  183 + */
  184 +void aliensMissileDisplay(int x, int y)
  185 +{
  186 + copywin(wAliensMissile,wBattleField,0,0,y,x,y,x,0);
  187 +}
  188 +
  189 +
  190 +/**
  191 + * clear missile sprite
  192 + */
  193 +void aliensMissileClear(int x, int y)
  194 +{
  195 + copywin(wEmpty,wBattleField,0,0,y,x,y,x,0);
  196 +}
  197 +
  198 +
  199 +/**
  200 + * refresh aliens sprite
  201 + */
  202 +void aliensRefresh(int level, int *pAliens)
  203 +{
  204 + static int frame = 0; // used for animation; mod 2 == 0: frame1, mod2 == 1: frame2
  205 + int k,row;
  206 + int c = 0;
  207 + int alienType = 0;
  208 + char ships[2][9][3+1] = {
  209 + {",^,", "_O-", "-o-", "o=o", "<O>", "_x_", "*^*", "\\_/", "o o"},
  210 + {".-.", "-O_", "/o\\", "o-o", "<o>", "-x-", "o^o", "/~\\", "oo "}
  211 + };
  212 + int colors[9] = {RED, GREEN, BLUE, RED, YELLOW, WHITE, WHITE, YELLOW, RED};
  213 +
  214 + wclear(wAliens); // clear pad
  215 + wattrset(wAliens,COLOR_PAIR(RED)); // set color
  216 +
  217 + frame++; // next frame
  218 +
  219 + // draw alien if there is one
  220 + for (row = 0; row < ALIENS_MAX_NUMBER_Y*2; row++) {
  221 + for (k = 0; k < ALIENS_MAX_NUMBER_X; k++) {
  222 + if ((row % 2) == 0) { // display aliens every even row
  223 + alienType = *(pAliens + c * (ALIENS_MAX_NUMBER_X) + k); // get type of alien //alienBlock[c][k]
  224 +
  225 + if (alienType != 0) { // if there is an alien to display
  226 + wattrset(wAliens,COLOR_PAIR(colors[alienType-1])); // set color
  227 + waddch(wAliens,ships[frame%2][alienType-1+(3*((level-1)%3))][0]); // set char1
  228 + waddch(wAliens,ships[frame%2][alienType-1+(3*((level-1)%3))][1]); // set char2
  229 + waddch(wAliens,ships[frame%2][alienType-1+(3*((level-1)%3))][2]); // set char3
  230 + if (alienType > 4) {
  231 + *(pAliens + c * ALIENS_MAX_NUMBER_X + k) = (alienType + 1) % 9;
  232 + } // todo: what's that? If alien_type > 4 then do a modulo operation???
  233 + } else {
  234 + waddstr(wAliens," "); // no alien
  235 + }
  236 +
  237 + } else {
  238 + waddstr(wAliens," "); // no aliens at odd rows
  239 + }
  240 + }
  241 + if ((row % 2) == 1) {c++;} // goto next row at alienblock
  242 + }
  243 +}
  244 +
  245 +
  246 +/**
  247 + * initialize bunkers sprites
  248 + */
  249 +static void bunkersInit()
  250 +{
  251 + wBunkers = newpad(BUNKERHEIGHT, BUNKERWIDTH); // new pad data
  252 + wclear(wBunkers);
  253 +}
  254 +
  255 +
  256 +/**
  257 + * display bunkers sprite
  258 + * needs pointer to bunker-array
  259 + */
  260 +void bunkersDisplay(int *pBunker)
  261 +{
  262 + int l, k;
  263 + wclear(wBunkers);
  264 + wattrset(wBunkers,COLOR_PAIR(CYAN));
  265 + for (l=0;l<BUNKERHEIGHT;l++) {
  266 + for (k=0;k<BUNKERWIDTH;k++) {
  267 + if (*(pBunker + (l * (BUNKERWIDTH + 1)) + k) == 1) { //if (pBunker[l][k]==1) {
  268 + waddch(wBunkers,'#');
  269 + } else {
  270 + waddch(wBunkers,' ');
  271 + }
  272 + }
  273 + }
  274 +
  275 + copywin(wBunkers, wBattleField, 0, 0, BUNKERY, BUNKERX, BUNKERY + BUNKERHEIGHT - 1, BUNKERX + BUNKERWIDTH - 1, 0);
  276 +}
  277 +
  278 +
  279 +/**
  280 + * clear bunkers sprite
  281 + */
  282 +void bunkersClear()
  283 +{
  284 + copywin(wEmpty, wBattleField, 0, 0, BUNKERY, BUNKERX, BUNKERY + BUNKERHEIGHT - 1, BUNKERX + BUNKERWIDTH - 1, 0);
  285 +}
  286 +
  287 +
  288 +/**
  289 + * clear one element of bunkers sprite at position (x, y)
  290 + */
  291 +void bunkersClearElement(int x, int y)
  292 +{
  293 + copywin(wEmpty, wBattleField, 0, 0, y, x, y, x, 0);
  294 +}
  295 +
  296 +
  297 +/**
  298 + * set actual sprite for ufo animation
  299 + */
  300 +void ufoRefresh()
  301 +{
  302 + char ufo[4][6] = {"<o o>", "<oo >", "<o o>", "< oo>"};
  303 + static int frame = 0;
  304 +
  305 + wclear(wUfo);
  306 + wattrset(wUfo, COLOR_PAIR(MAGENTA));
  307 + waddstr(wUfo, ufo[frame % 4]);
  308 +
  309 + frame++;
  310 +}
  311 +
  312 +
  313 +/**
  314 + * initialize ufo sprite
  315 + */
  316 +static void ufoInit()
  317 +{
  318 + wUfo = newpad(1, UFOWIDTH); // new pad with appropriate size
  319 + wclear(wUfo); // clear pad
  320 + wattrset(wUfo, COLOR_PAIR(MAGENTA)); // set color
  321 +}
  322 +
  323 +
  324 +/**
  325 + * display ufo sprite
  326 + */
  327 +void ufoDisplay(int x, int y)
  328 +{
  329 + copywin(wUfo, wBattleField, 0, 0, y, x, y, x + UFOWIDTH - 1, 0);
  330 +}
  331 +
  332 +
  333 +/**
  334 + * clear ufo sprite
  335 + */
  336 +void ufoClear(int x, int y)
  337 +{
  338 + copywin(wEmpty, wBattleField, 0, 0, y, x, y, x + UFOWIDTH - 1, 0);
  339 +}
  340 +
  341 +
  342 +/**
  343 + * initialize gameover graphic
  344 + */
  345 +static void gameOverInit()
  346 +{
  347 + // init game-over banner
  348 + wGameOver = newpad(13, 31);
  349 + wclear(wGameOver);
  350 + wattrset(wGameOver, COLOR_PAIR(WHITE));
  351 + waddstr(wGameOver, " ");
  352 + waddstr(wGameOver, " ##### #### ## ## ###### ");
  353 + waddstr(wGameOver, " ## ## ## ####### ## ");
  354 + waddstr(wGameOver, " ## ### ###### ## # ## ##### ");
  355 + waddstr(wGameOver, " ## ## ## ## ## ## ## ");
  356 + waddstr(wGameOver, " ##### ## ## ## ## ###### ");
  357 + waddstr(wGameOver, " ");
  358 + waddstr(wGameOver, " #### ## ## ###### ###### ");
  359 + waddstr(wGameOver, " ## ## ## ## ## ## ## ");
  360 + waddstr(wGameOver, " ## ## ## ## ##### ###### ");
  361 + waddstr(wGameOver, " ## ## ## ## ## ## ## ");
  362 + waddstr(wGameOver, " #### ### ###### ## ## ");
  363 + waddstr(wGameOver, " ");
  364 +}
  365 +
  366 +/**
  367 + * display game over graphic
  368 + */
  369 +void gameOverDisplay()
  370 +{
  371 + int x = (SCREENWIDTH / 2) - (31 / 2);
  372 + int y = (SCREENHEIGHT / 2) - (13 / 2);
  373 + copywin(wGameOver, wBattleField, 0, 0, y, x, y + 12, x + 30, 0);
  374 + wrefresh(wBattleField);
  375 +}
  376 +
  377 +
  378 +/**
  379 + * initialize title screen
  380 + */
  381 +static void titleScreenInit()
  382 +{
  383 + wTitleScreen = newpad(SCREENHEIGHT, SCREENWIDTH);
  384 + wclear(wTitleScreen);
  385 +}
  386 +
  387 +
  388 +/**
  389 + * display title screen
  390 + */
  391 +void titleScreenDisplay()
  392 +{
  393 + static int frame = 0;
  394 + int x, y;
  395 + int i;
  396 + WINDOW *wTitleText;
  397 + WINDOW *wAliens;
  398 + WINDOW *wStartText;
  399 + char ufo[4][6] = {"<o o>", "<oo >", "<o o>", "< oo>"};
  400 + char aliens[2][9][3+1] = {
  401 + {",^,", "_O-", "-o-", "o=o", "<O>", "_x_", "*^*", "\\_/", "o o"},
  402 + {".-.", "-O_", "/o\\", "o-o", "<o>", "-x-", "o^o", "/~\\", "oo "}
  403 + };
  404 + int score[3] = {200, 150, 100};
  405 + int colors[9] = {RED, GREEN, BLUE, RED, GREEN, BLUE, RED, GREEN, BLUE};
  406 + char buffer[12];
  407 + static int alien_type = 0;
  408 +
  409 + wTitleText = newpad(4, 41);
  410 + wclear(wTitleText);
  411 + wattrset(wTitleText, COLOR_PAIR(YELLOW));
  412 + waddstr(wTitleText, " ____ __ ");
  413 + waddstr(wTitleText, " ___ / _/__ _ _____ ___/ /__ _______");
  414 + waddstr(wTitleText, " / _ \\_/ // _ \\ |/ / _ `/ _ / -_) __(_-<");
  415 + waddstr(wTitleText, "/_//_/___/_//_/___/\\_,_/\\_,_/\\__/_/ /___/");
  416 +
  417 + frame++;
  418 + wAliens = newpad(7, 11);
  419 + wclear(wAliens);
  420 + snprintf(buffer, sizeof(buffer),"%s = 500", ufo[frame % 4]);
  421 + wattrset(wAliens, COLOR_PAIR(MAGENTA));
  422 + waddstr(wAliens, buffer);
  423 + if ((frame = frame % 60) == 0) {
  424 + alien_type = 0;
  425 + } else if (frame == 20) {
  426 + alien_type = 3;
  427 + } else if (frame == 40) {
  428 + alien_type = 6;
  429 + }
  430 + for (i = alien_type; i < alien_type + 3; i++) {
  431 + waddstr(wAliens, " ");
  432 + snprintf(buffer, sizeof(buffer), "%s = %d", aliens[frame % 2][i], score[i % 3]);
  433 + wattrset(wAliens, COLOR_PAIR(colors[i]));
  434 + waddstr(wAliens, buffer);
  435 + }
  436 +
  437 + wStartText = newpad(1, 20);
  438 + wclear(wStartText);
  439 + wattrset(wStartText, COLOR_PAIR(RED));
  440 + waddstr(wStartText, "Press SPACE to start");
  441 +
  442 + x = (SCREENWIDTH / 2) - (41 / 2);
  443 + y = 0;
  444 + copywin(wTitleText, wTitleScreen, 0, 0, y, x, y + 3, x + 40, 0);
  445 +
  446 + x = (SCREENWIDTH / 2) - (11 / 2);
  447 + y = 8;
  448 + copywin(wAliens, wTitleScreen, 0, 0, y, x , y + 6, x + 10, 0);
  449 +
  450 + x = (SCREENWIDTH / 2) - (20 / 2);
  451 + y = SCREENHEIGHT - 2;
  452 + copywin(wStartText, wTitleScreen, 0, 0, y, x, y, x + 19, 0);
  453 +
  454 + copywin(wTitleScreen, wBattleField, 0, 0, 0, 0, SCREENHEIGHT-1, SCREENWIDTH-1, 0);
  455 +
  456 + wrefresh(wBattleField);
  457 +}
  458 +
  459 +
  460 +/**
  461 + * clear title screen
  462 + */
  463 +void titleScreenClear()
  464 +{
  465 + battleFieldClear();
  466 +}
  467 +
  468 +
  469 +/**
  470 + * initialize scores
  471 + */
  472 +void statusInit()
  473 +{
  474 + wStatus = newpad(1, 55);
  475 + wclear(wStatus);
  476 +}
  477 +
  478 +
  479 +/**
  480 + * display scores
  481 + */
  482 +void statusDisplay(int level, int score, int lives)
  483 +{
  484 + int t, xOffset;
  485 + char strStatus[55];
  486 + // "Level: 01 Score: 0001450 Lives: /-\ /-\ /-\ /-\ /-\ "
  487 + // "1234567890123456789012345678901234567890123456789012"
  488 +
  489 +
  490 + xOffset = (SCREENWIDTH / 2) - 24;
  491 +
  492 +
  493 +
  494 + sprintf (strStatus, "Level: %2.2d Score: %2.7d Lives: ", level, score);
  495 +
  496 + wclear(wStatus);
  497 + wattrset(wStatus, COLOR_PAIR(RED));
  498 + waddstr(wStatus, strStatus);
  499 +
  500 + // show maximal five lives
  501 + for (t = 1; ((t <= 5) && (t < lives)); t++){
  502 + waddstr(wStatus, "/-\\ ");
  503 + }
  504 +
  505 + copywin(wStatus, wBattleField, 0, 0, SCREENHEIGHT-1, xOffset, SCREENHEIGHT-1, xOffset + 54, 0);
  506 +
  507 +
  508 +}
  509 +
  510 +
  511 +/**
  512 + * initialize battlefield
  513 + */
  514 +static void battleFieldInit()
  515 +{
  516 + wEmpty = newpad(SCREENHEIGHT, SCREENWIDTH);
  517 + wclear(wEmpty);
  518 +
  519 + wBattleField = newwin(SCREENHEIGHT, SCREENWIDTH, 0, 0); // new window
  520 + wclear(wBattleField); // clear window
  521 + mvwin(wBattleField, 0, 0); // move window
  522 +}
  523 +
  524 +
  525 +/**
  526 + * clear battlefield
  527 + */
  528 +void battleFieldClear()
  529 +{
  530 + copywin(wEmpty,wBattleField,0,0,0,0,SCREENHEIGHT-1,SCREENWIDTH-1,0);
  531 +}
  532 +
  533 +
  534 +/**
  535 + * refresh screen so that modified graphic buffers get visible
  536 + */
  537 +void refreshScreen()
  538 +{
  539 + redrawwin(wBattleField); // needed to display graphics properly at startup on some terminals
  540 + wrefresh(wBattleField);
  541 +
  542 +}
  543 +
  544 +
  545 +/**
  546 + * do proper cleanup
  547 + */
  548 +static void finish(int sig)
  549 +{
  550 + endwin(); // <curses.h> reset terminal into proper non-visual mode
  551 + exit(0);
  552 +}
  553 +
  554 +
  555 +/**
  556 + * initialize n_courses
  557 + */
  558 +void graphicEngineInit()
  559 +{
  560 + (void) signal(SIGINT, finish); // <signal.h> on signal "SIGINT" call method "finish"
  561 + (void) initscr(); // <curses.h> do initialization work
  562 + keypad(stdscr, TRUE); // <curses.h> enable keypad for input
  563 + (void) nonl(); // <curses.h> disable translation return/ newline for detection of return key
  564 + (void) cbreak(); // <curses.h> do not buffer typed characters, use at once
  565 + (void) noecho(); // <curses.h> do not echo typed characters
  566 + start_color(); // <curses.h> use colors
  567 + init_pair(RED, COLOR_RED, COLOR_BLACK); // <curses.h> define color-pair
  568 + init_pair(GREEN, COLOR_GREEN, COLOR_BLACK); // <curses.h> define color-pair
  569 + init_pair(YELLOW, COLOR_YELLOW, COLOR_BLACK); // <curses.h> define color-pair
  570 + init_pair(BLUE, COLOR_BLUE, COLOR_BLACK); // <curses.h> define color-pair
  571 + init_pair(CYAN, COLOR_CYAN, COLOR_BLACK); // <curses.h> define color-pair
  572 + init_pair(MAGENTA, COLOR_MAGENTA, COLOR_BLACK); // <curses.h> define color-pair
  573 + init_pair(WHITE, COLOR_WHITE, COLOR_BLACK); // <curses.h> define color-pair
  574 +
  575 + //timeout(0); // <curses.h> do not wait for input
  576 +
  577 + // initialize sprites
  578 + battleFieldInit();
  579 + playerInit();
  580 + playerMissileInit();
  581 + aliensInit();
  582 + aliensMissileInit();
  583 + bunkersInit();
  584 + ufoInit();
  585 + gameOverInit();
  586 + statusInit();
  587 + titleScreenInit();
  588 +}
  589 +
... ...
games/ninvaders/ninvaders-0.1.1/view.h 0 → 100644
... ... @@ -0,0 +1,78 @@
  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 <ncurses.h>
  26 +#include <unistd.h>
  27 +#include <signal.h>
  28 +
  29 +#ifndef VIEW
  30 +#define VIEW
  31 +
  32 +#include "globals.h"
  33 +
  34 +#define SCREENHEIGHT 24
  35 +#define SCREENWIDTH 80
  36 +
  37 +#define PLAYERWIDTH 5
  38 +#define PLAYERPOSY (SCREENHEIGHT-2)
  39 +
  40 +#define BUNKERWIDTH 80
  41 +#define BUNKERHEIGHT 4
  42 +#define BUNKERX 0
  43 +#define BUNKERY (SCREENHEIGHT-8)
  44 +
  45 +#define ALIENS_MAX_NUMBER_X 10
  46 +#define ALIENS_MAX_NUMBER_Y 5
  47 +
  48 +#define UFOWIDTH 5
  49 +#define UFOPOSY 0
  50 +
  51 +
  52 +void graphicEngineInit();
  53 +
  54 +void aliensClear(int x, int y, int wid, int hgt);
  55 +void aliensDisplay(int x, int y, int wid, int hgt);
  56 +void aliensMissileClear(int x, int y);
  57 +void aliensMissileDisplay(int x, int y);
  58 +void aliensRefresh(int level, int *pAliens);
  59 +void battleFieldClear();
  60 +void bunkersClear();
  61 +void bunkersClearElement(int x, int y);
  62 +void bunkersDisplay(int *pBunker);
  63 +void gameOverDisplay();
  64 +void playerClear(int x, int y);
  65 +void playerDisplay(int x, int y);
  66 +void playerExplosionDisplay(int x, int y);
  67 +void playerMissileClear(int x, int y);
  68 +void playerMissileDisplay(int x, int y);
  69 +void titleScreenClear();
  70 +void titleScreenDisplay();
  71 +void ufoClear(int x, int y);
  72 +void ufoDisplay(int x, int y);
  73 +void ufoRefresh();
  74 +
  75 +void statusDisplay(int level, int score, int lives);
  76 +void refreshScreen();
  77 +
  78 +#endif
... ...
games/ninvaders/ninvaders_0.1.1-3.diff.gz 0 → 100644
No preview for this file type
games/ninvaders/ninvaders_0.1.1-3.dsc 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +-----BEGIN PGP SIGNED MESSAGE-----
  2 +Hash: SHA1
  3 +
  4 +Format: 1.0
  5 +Source: ninvaders
  6 +Binary: ninvaders
  7 +Architecture: any
  8 +Version: 0.1.1-3
  9 +Maintainer: Matthew Palmer <mpalmer@debian.org>
  10 +Standards-Version: 3.9.1
  11 +Build-Depends: debhelper (>= 7), libncurses5-dev
  12 +Checksums-Sha1:
  13 + 5ab825694b108cbfa988377ca216188fa9a76e89 31275 ninvaders_0.1.1.orig.tar.gz
  14 + 38760243b3404fecb143f1b372f7c2cad76696f2 12831 ninvaders_0.1.1-3.diff.gz
  15 +Checksums-Sha256:
  16 + bfbc5c378704d9cf5e7fed288dac88859149bee5ed0850175759d310b61fd30b 31275 ninvaders_0.1.1.orig.tar.gz
  17 + 30297a890afd6ea21b11c514d55ebbfe26ab5e9dcbee3499f0f223a3fd52de4c 12831 ninvaders_0.1.1-3.diff.gz
  18 +Files:
  19 + 97b2c3fb082241ab5c56ab728522622b 31275 ninvaders_0.1.1.orig.tar.gz
  20 + 56a98ddce225b5f9f9302f64209916f0 12831 ninvaders_0.1.1-3.diff.gz
  21 +
  22 +-----BEGIN PGP SIGNATURE-----
  23 +Version: GnuPG v1.4.9 (GNU/Linux)
  24 +
  25 +iD8DBQFMqpNMBEnrTWk1E4cRAl63AJ0bMEmA1mEyY2qE/1FJ5MPJ0wnppQCgo8F0
  26 +fPFphbmDT6OBCUb7xtk++QQ=
  27 +=AcHr
  28 +-----END PGP SIGNATURE-----
... ...
games/ninvaders/ninvaders_0.1.1.orig.tar.gz 0 → 100644
No preview for this file type