From 0ed3f14864fcd819a7f8ee61d54636e5c904a9c9 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 22 Jan 2019 21:14:42 +0100 Subject: [PATCH] terminé ! --- games/ninvaders/ChangeLog | 320 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/README | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/aliens.c | 308 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/aliens.h | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/arduino.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/arduino.h | 25 +++++++++++++++++++++++++ games/ninvaders/debian/changelog | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/debian/compat | 1 + games/ninvaders/debian/control | 13 +++++++++++++ games/ninvaders/debian/copyright | 30 ++++++++++++++++++++++++++++++ games/ninvaders/debian/dirs | 1 + games/ninvaders/debian/docs | 1 + games/ninvaders/debian/links | 1 + games/ninvaders/debian/menu | 2 ++ games/ninvaders/debian/ninvaders.1 | 42 ++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/debian/rules | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/globals.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/globals.h | 35 +++++++++++++++++++++++++++++++++++ games/ninvaders/gpl.txt | 340 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/ind.html | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/makefile | 20 ++++++++++++++++++++ games/ninvaders/nInvaders.c | 431 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/nInvaders.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/ninvaders-0.1.1/ChangeLog | 320 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/README | 52 ---------------------------------------------------- games/ninvaders/ninvaders-0.1.1/aliens.c | 308 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/aliens.h | 78 ------------------------------------------------------------------------------ games/ninvaders/ninvaders-0.1.1/aliens.o | Bin 10384 -> 0 bytes games/ninvaders/ninvaders-0.1.1/arduino.c | 130 ---------------------------------------------------------------------------------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/arduino.h | 19 ------------------- games/ninvaders/ninvaders-0.1.1/debian/changelog | 75 --------------------------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/debian/compat | 1 - games/ninvaders/ninvaders-0.1.1/debian/control | 13 ------------- games/ninvaders/ninvaders-0.1.1/debian/copyright | 30 ------------------------------ games/ninvaders/ninvaders-0.1.1/debian/dirs | 1 - games/ninvaders/ninvaders-0.1.1/debian/docs | 1 - games/ninvaders/ninvaders-0.1.1/debian/links | 1 - games/ninvaders/ninvaders-0.1.1/debian/menu | 2 -- games/ninvaders/ninvaders-0.1.1/debian/ninvaders.1 | 42 ------------------------------------------ games/ninvaders/ninvaders-0.1.1/debian/rules | 71 ----------------------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/globals.c | 157 ------------------------------------------------------------------------------------------------------------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/globals.h | 35 ----------------------------------- games/ninvaders/ninvaders-0.1.1/globals.o | Bin 8656 -> 0 bytes games/ninvaders/ninvaders-0.1.1/gpl.txt | 340 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/ind.html | 111 --------------------------------------------------------------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/makefile | 20 -------------------- games/ninvaders/ninvaders-0.1.1/nInvaders.c | 406 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/nInvaders.h | 60 ------------------------------------------------------------ games/ninvaders/ninvaders-0.1.1/player.c | 240 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ games/ninvaders/ninvaders-0.1.1/player.h | 55 ------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/player.o | Bin 6288 -> 0 bytes games/ninvaders/ninvaders-0.1.1/ufo.c | 101 ----------------------------------------------------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/ufo.h | 49 ------------------------------------------------- games/ninvaders/ninvaders-0.1.1/ufo.o | Bin 3208 -> 0 bytes games/ninvaders/ninvaders-0.1.1/view.c | 589 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- games/ninvaders/ninvaders-0.1.1/view.h | 78 ------------------------------------------------------------------------------ games/ninvaders/ninvaders-0.1.1/view.o | Bin 17808 -> 0 bytes games/ninvaders/player.c | 240 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/player.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/ufo.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/ufo.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/view.c | 589 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ games/ninvaders/view.h | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 63 files changed, 3414 insertions(+), 3385 deletions(-) create mode 100644 games/ninvaders/ChangeLog create mode 100644 games/ninvaders/README create mode 100644 games/ninvaders/aliens.c create mode 100644 games/ninvaders/aliens.h create mode 100644 games/ninvaders/arduino.c create mode 100644 games/ninvaders/arduino.h create mode 100644 games/ninvaders/debian/changelog create mode 100644 games/ninvaders/debian/compat create mode 100644 games/ninvaders/debian/control create mode 100644 games/ninvaders/debian/copyright create mode 100644 games/ninvaders/debian/dirs create mode 100644 games/ninvaders/debian/docs create mode 100644 games/ninvaders/debian/links create mode 100644 games/ninvaders/debian/menu create mode 100644 games/ninvaders/debian/ninvaders.1 create mode 100755 games/ninvaders/debian/rules create mode 100644 games/ninvaders/globals.c create mode 100644 games/ninvaders/globals.h create mode 100644 games/ninvaders/gpl.txt create mode 100644 games/ninvaders/ind.html create mode 100644 games/ninvaders/makefile create mode 100644 games/ninvaders/nInvaders.c create mode 100644 games/ninvaders/nInvaders.h delete mode 100644 games/ninvaders/ninvaders-0.1.1/ChangeLog delete mode 100644 games/ninvaders/ninvaders-0.1.1/README delete mode 100644 games/ninvaders/ninvaders-0.1.1/aliens.c delete mode 100644 games/ninvaders/ninvaders-0.1.1/aliens.h delete mode 100644 games/ninvaders/ninvaders-0.1.1/aliens.o delete mode 100644 games/ninvaders/ninvaders-0.1.1/arduino.c delete mode 100644 games/ninvaders/ninvaders-0.1.1/arduino.h delete mode 100644 games/ninvaders/ninvaders-0.1.1/debian/changelog delete mode 100644 games/ninvaders/ninvaders-0.1.1/debian/compat delete mode 100644 games/ninvaders/ninvaders-0.1.1/debian/control delete mode 100644 games/ninvaders/ninvaders-0.1.1/debian/copyright delete mode 100644 games/ninvaders/ninvaders-0.1.1/debian/dirs delete mode 100644 games/ninvaders/ninvaders-0.1.1/debian/docs delete mode 100644 games/ninvaders/ninvaders-0.1.1/debian/links delete mode 100644 games/ninvaders/ninvaders-0.1.1/debian/menu delete mode 100644 games/ninvaders/ninvaders-0.1.1/debian/ninvaders.1 delete mode 100755 games/ninvaders/ninvaders-0.1.1/debian/rules delete mode 100644 games/ninvaders/ninvaders-0.1.1/globals.c delete mode 100644 games/ninvaders/ninvaders-0.1.1/globals.h delete mode 100644 games/ninvaders/ninvaders-0.1.1/globals.o delete mode 100644 games/ninvaders/ninvaders-0.1.1/gpl.txt delete mode 100644 games/ninvaders/ninvaders-0.1.1/ind.html delete mode 100644 games/ninvaders/ninvaders-0.1.1/makefile delete mode 100644 games/ninvaders/ninvaders-0.1.1/nInvaders.c delete mode 100644 games/ninvaders/ninvaders-0.1.1/nInvaders.h delete mode 100644 games/ninvaders/ninvaders-0.1.1/player.c delete mode 100644 games/ninvaders/ninvaders-0.1.1/player.h delete mode 100644 games/ninvaders/ninvaders-0.1.1/player.o delete mode 100644 games/ninvaders/ninvaders-0.1.1/ufo.c delete mode 100644 games/ninvaders/ninvaders-0.1.1/ufo.h delete mode 100644 games/ninvaders/ninvaders-0.1.1/ufo.o delete mode 100644 games/ninvaders/ninvaders-0.1.1/view.c delete mode 100644 games/ninvaders/ninvaders-0.1.1/view.h delete mode 100644 games/ninvaders/ninvaders-0.1.1/view.o create mode 100644 games/ninvaders/player.c create mode 100644 games/ninvaders/player.h create mode 100644 games/ninvaders/ufo.c create mode 100644 games/ninvaders/ufo.h create mode 100644 games/ninvaders/view.c create mode 100644 games/ninvaders/view.h diff --git a/games/ninvaders/ChangeLog b/games/ninvaders/ChangeLog new file mode 100644 index 0000000..f6ba535 --- /dev/null +++ b/games/ninvaders/ChangeLog @@ -0,0 +1,320 @@ + +****** Release 0.1.1 ****** + +2003-04-22 Alexander Hollinger + + * globas.c: changed version from 0.0.11 to 0.1.1 + +2003-05-06 Sebastian Gutsfeld + + * aliens.c (aliensMissileMove): added test if there is an alien + ship left when starting a new missile; this was the bug which is + responsible for freezing the game when shooting at the last alien + +2003-05-05 Sebastian Gutsfeld + + * nInvaders.c (readInput): updated readInput for reading input in + different states (see status var) + + * nInvaders.c (handleTimer): added code for status GAME_HIGHSCORE + so a title screen with animation is shown; updated status + GAME_OVER + + * nInvaders.c (main): updated status initialisation from + GAME_NEXTLEVEL to GAME_HIGHSCORE + + * view.c: added WINDOW wTitleScreen; added titleScreenInit; added + titleScreenDisplay; added titleScreenClear; added battleFieldClear + + * view.c (aliensRefresh): formatted some code + + * view.c (ufoRefresh): fixed array length + + * view.c (gameOverDisplay): simpified function + + * view.c (graphicEngineInit): updated with titleScreenInit + + * view.h: sorted function declarations; updated gameOverDisplay, + titleScreenClear, titleScreenDisplay and battleFieldClear + +2003-04-22 Alexander Hollinger + + * globals.c (doSleep): added again. still needed in + view.c. added "#ifdef win32" instruction again. + +2003-04-22 Alexander Hollinger + + * globals.c (doSleep): deleted method. not used any more. + + * globals.c: incremented version number from 0.0.10 to 0.0.11 + + * globals.c: removed '#ifdef win32' instruction. + + * *.c, *.h: added license notice to each file + + * renamed ToDo to TODO + +2003-04-18 Alexander Hollinger + + * nInvaders.c (finish): "barely mediocre" and "show promise" + both "< 10000". Changed latter to "< 12500" + +2003-04-17 Alexander Hollinger + + * view.c (statusDisplay): modified so that buffer is written + to wBattleField. new variable WINDOW* wStatus. added method + (statusInit) which does initialisation of WINDOW wStatus. + Problem: Alien missiles go right to the bottom of screen, + where status is located and overwritten with missile sprite. + Fix: see next point + Changed behaviour of display of lives. Now the _remaining_ + lives are displayed. i.e. at the beginning you will see + two little spaceshuttles, because you have two lives left. + + * aliens.c (aliensMissileMove): added some checking, if missile + reached bottom where player moves. if so, do not move further + and reload missile. this reduces number of missiles which have + to be hit-tested each round, yet made it necessary to change + the shot-threshold otherwise too many missiles would have been + coming down. Not limiting ALIENS_MAX_MISSILES from 50 to 10 is + possible, because missiles are reloaded when they reach the + bottom. 10 concurrent missiles should be quite hard to manage.. + Removed ALIENS_MAX_MISSILES-definition from view.h. Was defined + twice, now only in aliens.h. + optimized threshold-checking. calculation outside for- + instruction, and only comparison within. + + +2003-04-17 Alexander Hollinger + + * nInvaders.c (readInput): removed (ch==27) for exit + sequence. as dettus pointed out there would be problems + on some terminals. pressing some keys too long will send + an KEY_ESC and quit the game. + +2003-04-17 Alexander Hollinger + + * nInvaders.c (setUpTimer): changed method to call handleTimer. + The call signal(SIG_ALRM, handleTimer) didn't work on irix. + There, the timer was only fired once and then the programm + exited. Now using call to sigaction() with flag SA_RESTART. + +2003-04-16 Alexander Hollinger + + * nInvaders.c: added a real-time timer that does 50 fps. if you + want it slower toggle the constant FPS. the higher the slower. + A timer is created and does all the gaming stuff while key + checking is still done in (main). Gamehandling is done by + simulating a deterministic finite automaton by setting the + 'status'-attribute to e.g. GAME_LOOP, GAME_PAUSED, GAME_EXIT. + the following methods were modified/ added: + (setUpTimer): creates and initializes timer + (handleTimer): this method is called every 1/FPS seconds and + contains most code from old (main) + (readInput): changed so that the 'status'-variable is affected. + pressing of 'p' now changes 'status' + (main): most code moved to (handleTimer), calls setUpTimer and + sets 'status' to GAME_NEXTLEVEL + (gameOver): completely moved to handleTimer + + * view.c (graphicEngineInit): removed 'timeout(0);' no longer + needed as we now hava a timer. another advantage: call to + (readInput) in nInvaders.c no longer called permanently. + in (readInput) the getch()-call waits till a key is pressed. + doSleep(1) no longer needed in nInvaders.c (readInput). + +2003-04-08 Sebastian Gutsfeld + + * ufo.c:replaced 'u' with 'ufo' (see ufo.h) and 'a' with 'aliens' + + * ufo.h: added typedef for Ufo and renamed 'u' into 'ufo', + + * player.c: added typedef for Player and renamed 'p' into 'player', + replaced 'p' with 'player and 'a' with 'aliens' + + * aliens.c: replaced 'a' with 'aliens' (see aliens.h) + + * aliens.h: added typedef for Aliens and renamed 'a' into 'aliens' + + * globals.c (RELEASE): updated release number + +2003-04-07 Sebastian Gutsfeld + + * view.c (ufoRefresh): reverted 'frame' assignement + + * nInvaders.c (main): reverted to old ufo speed from revision 1.3 + +2003-04-06 Alexander Hollinger + + * nInvaders.c (resetPlayer): added a call to playerMisisleClear(); + + * view.c (aliensRefresh): fully encapsulated. access to aliens-Array + by pointer. + + * aliens.c (*HitCheck): moved hit_alien_test and hit_bunker_test to + aliens.c and renamed to aliensHitCheck and bunkersHitCheck. Added + comments and did improvement of bunkersHitCheck-Algorithm + (shoty < BUNKERY + BUNKERHEIGHT instead of <=). + + * nInvaders.c (finish): moved short version of GPL to globals.c + (showGplShort) + + * view.c (gameOverInit): fixed color code + + * player.h: removed lives from structPlayer. This variable belongs + more to the gamehandling in nInvaders.c that to the model of the + player in player.c. This is done because of better encapsulation + of player.c. + + * player.c (playerReset): added a playerDisplay. Removed playerDisplay + from nInvaders.c just before refreshScreen() and added another + playerDisplay in the player.c (playerMissileMove) so that the + playerMissileClear does not clear the middle of the player when + a new shot is fired. + + * aliens.c (aliensHitCheck): added support for return of alienType so + that different scoring according to type of aliens is possible. + had to change values für alien_type constants in nInvaders.h and + the order of scores in the points-array in nInvaders.c (doScoring). + ufo gets 500pt, aliens 100pt, 150pt or 200pt. + + * aliens.c (aliensReset): clears missiles of aliens, if any + + * nInvaders.c (main): changed some variable names (*_counter) and + contracted some if-statements. + + * view.c (playerExplosionDisplay): renamed from playerExplode. Added + player.c (playerExplode) which calls playerExplosionDisplay and + playerDisplay. Thus, I could remove the playerExplode(p.posX, p.posY) + from nInvaders.c and add a playerExplode(). All Elements of the + structure structPlayer now are "private". + + +2003-04-05 Sebastian Gutsfeld + + * Makefile: Updated file for ufo + + * aliens.c (aliensMissileMove): fixed comment + + * aliens.h: fixed indentation + + * globals.h: fixed indentation + + * nInvaders.c: included ufo.h, fixed some comments and linebreaks + + * nInvaders.c (initlevel): added initialisation for ufo + + * nInvaders.c (main): added code for ufo + + * nInvaders.c (doScoring): different score for different alien types + + * nInvaders.h: added constants for alien types needed by + nInvaders.c (doScoring), fixed declaration of doScoring, fixed + Indentation + + * player.c: included ufo.h (needed for playerMoveMissile) + + * player.c (playerMoveMissile): added code needed for ufo, fixed + doScoring for alien type + + * player.h: fixed indentation, fixed declaration of doScoring + + * view.c: added WINDOW *wUfo, void ufoRefresh, static void ufoInit, + void ufoDisplay and void ufoClear + + * view.c (aliensRefresh): fixed indentation and color codes + + * view.c (graphicEngineInit): added ufoInit to last init section + + * view.h: fixed indentation, added constans UFOWIDTH and UFOPOSY, added + declarations of ufoDisplay, ufoRefresh and ufoClear + + * ufo.c: files for ufo handling (initial import into cvs) + + * ufo.h: header file for ufo.c (initial import into cvs) + +2003-04-04 Sebastian Gutsfeld + + * nInvaders.h, player.c: updated every occurance of hit_player_test + to hit_alientest + + * nInvaders.c (hit_alien_test): renamed from 'hit_player_test' + +2003-04-05 Alexander Hollinger + + * [view.c] (bunkersDisplay): now fully encapsulated using pointer + *pBunker to get access to bunker-array. Method is called from + [aliens.c] (bunkersReset) instead of [aliens.c] (render) thus + saving some cpu-time. The bunker has to be displayed only at the + beginning of a new level. Then we use bunkerClearElement or + bunkerClear to remove bunker elements. No need why it was in + [aliens.c] (render). + +2003-04-04 Sebastian Gutsfeld + + * nInvaders.c (readInput): draw new number of lives in live-cheat + + * aliens.c (aliensReset): put declaration of 'level' at + beginning of function + +2003-04-04 Alexander Hollinger + + * [nInvaders.c] added a new cheat: "L" gives player one new life + for better testing + * [aliens.c, player.c] (*Reset) forgot to reset alien-block and + bunkers-block. Now there is a bunkersReset in aliens.c + * [view.c] added method graphicEngineInit() + * [view.c] (refreshScreen) fixed problem with graphic display on some + terminals. bunker and player are now displayed at startup. + * removed init.c and init.h from project + * [globals.c] some minor changes to names of methods. moved code for + displaying version from nInvaders.c to globals.c. Added code to + redefine usleep for WIN32-platforms, this should hopefully fix the + bug that the game was too fast there. + +2003-04-03 Alexander Hollinger + + * removed deprecated multi-line-strings in globals.c and nInvaders.c + +2003-04-02 Alexander Hollinger + + * view.c now contains all methods which do graphical display + (by using ncurses) + + * added file aliens.c and aliens.h. Perhaps these can later melt + with player.c and player.h. + +2003-04-01 Sebastian Gutsfeld + + * *.c (*): formatted with 'indent -kr -i8 -l90' and fixed + some linebreaks + +2003-03-30 Alexander Hollinger + + * added file "ToDo": put feature-requests and alike in here + + * player.c (player*Missile*): processing of missiles moved to these + functions to reduce size of main(). + + +2003-03-29 Sebastian Gutsfeld + + * init.c (initplayer): fixed comment + + * player.c (playerInit): put declaration of 'playerSprite' at beginning + of function + + * init.c (initshots): put declaration of 'a' at beginning of function + +2003-03-29 Alexander Hollinger + + * added more comments and added player.c which is intended to hold all + functions concearning the player + + * added method playerLaunchMissile in player.c + +2003-03-28 Alexander Hollinger + + * added some comments and split up some functions, especially in init.c. + + diff --git a/games/ninvaders/README b/games/ninvaders/README new file mode 100644 index 0000000..288819e --- /dev/null +++ b/games/ninvaders/README @@ -0,0 +1,52 @@ +*** nInvaders +*** (C)opyleft 2k2 by dettus +*** dettus@matrixx-bielefeld.de + +Hello and welcome to nInvaders! Right now you are earth's only hope to save +it from alien invaders from space. Make your job, and make it good, mankind +believes in you... + +1. INSTALLING +------------- +Compiling and installing should be really straightforward, just type in +"make" on your command prompt and you'll get the binary file. If not, please +edit the makefile. Once you have compiled it, copy it (as root) to your +/usr/bin directory, or /usr/local/games, or just run it by typeing +./nInvaders. + +2. REQUIREMENTS +--------------- +nInvaders is known to compile and run on Solaris, Linux and OpenBSD. On all of +them were ncurses 5.2 installed. If you are capable of running it on other +platforms, tell me! + +3. CONTROL KEYS +--------------- +Controlling nInvaders is really simple. Just press the cursor left/right keys +to move it left or right, and press space to fire. The esc-key lets you quit +at any time you want. + +4. COMMAND LINE OPTIONS +----------------------- +nInvaders accepts the following command line options +-l x where x is your skill as a number between 0(nightmare) and 9(may i play + daddy) +-gpl prints out the license information. + +Any other option gives you a help screen. + +5. LICENSING +------------ +nInvaders is protected under the laws of the GPL and other countries. Any re- +distribution, reselling or copying is strictly allowed. You should have received +a copy of it with this package, if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Or just start nInvaders with the -gpl option to learn more. + +6. GREETZ +--------- +hello mom, hello dad, hello katja, hello there, hello elitza, hello wizzard, +hello walli, hello melanie, hello judith, hello you folks at freshmeat, hello +skyper, hello gamma, hello sunfreeware, hello abuse, hello linus, hello alan, +hello herr von boedefeld, hello god, hello world. +and thank you Mike Saarna for adding ANIMATION! diff --git a/games/ninvaders/aliens.c b/games/ninvaders/aliens.c new file mode 100644 index 0000000..9da4337 --- /dev/null +++ b/games/ninvaders/aliens.c @@ -0,0 +1,308 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#include "aliens.h" +#include "player.h" +#include "nInvaders.h" + +/** + * initialize aliens attributes + */ +void aliensReset() +{ + int i,j; + + // three different types of aliens [5], [10] + int level[ALIENS_MAX_NUMBER_Y][ALIENS_MAX_NUMBER_X]={ + {1,1,1,1,1,1,1,1,1,1}, + {2,2,2,2,2,2,2,2,2,2}, + {2,2,2,2,2,2,2,2,2,2}, + {3,3,3,3,3,3,3,3,3,3}, + {3,3,3,3,3,3,3,3,3,3} + }; + + aliensClear(aliens.posX, aliens.posY, aliens.right, aliens.bottom); // clear old position of aliens + + // reset alien position + aliens.posX = 0; + aliens.posY = 0; + aliens.right = 0; + aliens.bottom = 0; + aliens.left = 0; + aliens.speed = 1; + + // copy level-array to enemy-array + for (i=0;ialiens.left) {aliens.left=-k;} + if (aliens.right==-1 || k>aliens.right) {aliens.right=k;} + if (aliens.bottom==-1 || c>aliens.bottom) {aliens.bottom=c;} + } + } + } else { + c++; + } + } + aliens.bottom=aliens.bottom*2; // every 2nd row is an empty row + aliens.left=aliens.left*3; // alien sprite is 3 chars wide + aliens.right=aliens.right*3; // alien sprite is 3 chars wide + + // display remaining aliens with animation + aliensRefresh(level, &alienBlock[0][0]); + +} + + +/** + * move aliens' missiles and do player/bunker hit testing + * a zero value in alienshotx indicates that the appropriate missile is loaded, but not fired + */ +int aliensMissileMove() +{ + int i, tmp; + int fPlayerWasHit = 0; + int shootThreshold; + static int alienshot_counter = 0; + + + // calculate threshold when next missile should be fired + // it is done here to save calculation time in for-instruction + shootThreshold = (skill_level * 8) * (shipnum + 2); + alienshot_counter = alienshot_counter + 10 ; + + // loop all possible missiles + for (i = 0; i < ALIENS_MAX_MISSILES; i++) { + + // if the current missile is flying we should do movements + if (alienshotx[i] != 0) { + + aliensMissileClear(alienshotx[i],alienshoty[i]); // clear old position + + // if missile hit the bunkers + if (bunkersHitCheck(alienshotx[i], alienshoty[i]) == 1) { + alienshotx[i] = 0; // value of zero reloads missile + } + + alienshoty[i]++; // move missile downwards + + // check if player was hit by an alien missile + if (playerHitCheck(alienshotx[i], alienshoty[i]) == 1) { + alienshotx[i] = 0; // value of zero reloads missile + fPlayerWasHit = 1; + } + + + } else { // missile not launched yet + + // start new missile if counter says so + if (alienshot_counter > shootThreshold && shipnum > 0) {// only shot if there's an alien left + alienshot_counter = 0; // reset counter + tmp = random() % ALIENS_MAX_NUMBER_X; // randomly select one of the ... + while (lowest_ship[tmp] == -1) { // ...aliens at the bottom of ... + tmp = random() % ALIENS_MAX_NUMBER_X; // ...a column to launch missile + } + alienshoty[i]=aliens.posY+lowest_ship[tmp]; // set y position of missile + alienshotx[i]=aliens.posX+tmp*3; // set x position of missile + } + } // if + + // display missiles if still running or just launched; could have been modified in the above code + if (alienshotx[i] != 0) { + // if missile is out of battlefield + if (alienshoty[i] == SCREENHEIGHT - 1) { + alienshotx[i] = 0; // reload missile + } else { + aliensMissileDisplay(alienshotx[i], alienshoty[i]); // display Missile at new position + } + } + + } // for + + + return fPlayerWasHit; +} + + + +/** + * check if missile hit an alien + */ +int aliensHitCheck(int shotx, int shoty) +{ + int alienType = 0; + int shipx, shipy; + // if missile is within alien-rectangle + if (shotx >= aliens.posX && shotx <= aliens.posX + ALIENS_MAX_NUMBER_X * 3 - 1 + && shoty >= aliens.posY && shoty <= aliens.posY + (ALIENS_MAX_NUMBER_Y - 1) * 2) { + // calculate the ship that was hit + shipx = (shotx - aliens.posX) / 3; + shipy = (shoty - aliens.posY) / 2; + // if there is still a ship at this position + alienType = alienBlock[shipy][shipx]; + if (alienType != 0) { + alienBlock[shipy][shipx] = 0; // delete alien ship + } + } + return alienType; // returns 0 if no alien was hit, else returns type-code of alien +} + +/** + * check if missile hit an element of bunker + */ +int bunkersHitCheck(int shotx, int shoty) +{ + int adjx, adjy; + int fBunkerWasHit = 0; + // if missile is within bunker-rectangle + if (shotx >= BUNKERX && shotx < BUNKERX + BUNKERWIDTH + && shoty >= BUNKERY && shoty < BUNKERY + BUNKERHEIGHT) { + // calculate the element of the bunker that was hit + adjy = shoty - BUNKERY; + adjx = shotx - BUNKERX; + // if there is still an element + if(bunker[adjy][adjx] == 1){ + bunker[adjy][adjx] = 0; // delete element + fBunkerWasHit = 1; // bunker was hit! + } + } + return fBunkerWasHit; +} diff --git a/games/ninvaders/aliens.h b/games/ninvaders/aliens.h new file mode 100644 index 0000000..040d93f --- /dev/null +++ b/games/ninvaders/aliens.h @@ -0,0 +1,78 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#include "view.h" + +#ifndef ALIENS +#define ALIENS + +typedef struct Aliens Aliens; + +struct Aliens { + int posX; // horizontal position of aliens + int posY; // vertical position of aliens + int right; + int left; + int bottom; + int speed; // 0: no movement; 1: one per turn; etc. +}; + +Aliens aliens; + +int shipnum; + +#define ALIENS_MAX_NUMBER_X 10 +#define ALIENS_MAX_NUMBER_Y 5 +#define ALIENS_MAX_MISSILES 10 + +// todo: move to structure +int lowest_ship[ALIENS_MAX_NUMBER_X]; +int alienshotx[ALIENS_MAX_MISSILES]; +int alienshoty[ALIENS_MAX_MISSILES]; +int alienshotnum; +int alienBlock[ALIENS_MAX_NUMBER_Y][ALIENS_MAX_NUMBER_X]; + +int bunker[BUNKERHEIGHT][BUNKERWIDTH + 1]; + + +void aliensReset(); +void bunkersReset(); +int aliensMove(); +int aliensMissileMove(); +void render(); +int aliensHitCheck(int shotx, int shoty); +int bunkersHitCheck(int shotx, int shoty); + + +// methods that handle graphic display, from view.c +extern void aliensDisplay(int x, int y, int wid, int hgt); +extern void aliensClear(int x, int y, int wid, int hgt); +extern void aliensRefresh(int level, int *pAliens); +extern void aliensMissileDisplay(int x, int y); +extern void aliensMissileClear(int x, int y); +extern void bunkersClearElement(int x, int y); +extern void bunkersClear(); +extern void bunkersRefresh(); + +#endif diff --git a/games/ninvaders/arduino.c b/games/ninvaders/arduino.c new file mode 100644 index 0000000..a15f257 --- /dev/null +++ b/games/ninvaders/arduino.c @@ -0,0 +1,128 @@ +#include +#include +#include +#include +#include +#include "arduino.h" + +void init(libusb_context **context, libusb_device ***devices, ssize_t *devices_count){ + int status = libusb_init(context); + if(status != 0){perror("libusb_init"); exit(-1);} + + *devices_count = libusb_get_device_list(*context, devices); + if(*devices_count < 0){perror("libusb_get_device_list"); exit(-1);} +} + +libusb_device* searchArduino(libusb_device **devices, ssize_t devices_count){ + for(int i=0; ibConfigurationValue; + + // detach kernel + for(int j=0; j<(*config_desc)->bNumInterfaces; j++){ + int interface = (*config_desc)->interface[j].altsetting[0].bInterfaceNumber; + if(libusb_kernel_driver_active(*handle, interface)){ + status = libusb_detach_kernel_driver(*handle, interface); + if(status != 0){ perror("libusb_detach_kernel_driver"); exit(-1); } + } + } + + // use config + status = libusb_set_configuration(*handle, configuration); + if(status != 0){ perror("libusb_set_configuration"); exit(-1); } + + // claim interfaces + for(int j=0; j<(*config_desc)->bNumInterfaces; j++){ + struct libusb_interface_descriptor interface_desc = (*config_desc)->interface[j].altsetting[0]; + int interface = interface_desc.bInterfaceNumber; + + status = libusb_claim_interface(*handle, interface); + if(status != 0){ perror("libusb_claim_interface"); exit(-1); } + } +} + +void getEndpoints(struct libusb_config_descriptor *config_desc, struct libusb_endpoint_descriptor *endpoint_desc_list){ + int count = 0; + // in interfaces + for(int j=0; jbNumInterfaces; j++){ + // find endpoints + for(int k=0; kinterface[j].altsetting[0].bNumEndpoints; k++){ + if(count > ENDPOINTS_NUMBER){ printf("getEndpoints: Array out of bound :%d:", count); exit(-1); } + *(endpoint_desc_list + count) = config_desc->interface[j].altsetting[0].endpoint[k]; + count++; + } + } + //if(count != ENDPOINTS_NUMBER){ printf("Wrong number of endpoints.\nIs this the good device ?\n"); exit(-1); } +} + +void start(libusb_context **context, libusb_device ***devices, libusb_device_handle **handle, struct libusb_config_descriptor **config_desc, struct libusb_endpoint_descriptor *endpoint_desc_list){ + // init + ssize_t devices_count; + init(context, devices, &devices_count); + + // get arduino device + libusb_device *arduino = searchArduino(*devices, devices_count); + if(arduino == NULL){ printf("Arduino device not found\n"); exit(-1); } + + // open connection, use config, detach kernel and claim interfaces + openConnection(arduino, handle, config_desc); + + // get enpoints + getEndpoints(*config_desc, endpoint_desc_list); +} + +void stop(struct libusb_config_descriptor *config_desc, libusb_device_handle *handle, libusb_device **devices, libusb_context *context){ + // release interfaces + for(int j=0; jbNumInterfaces; j++){ + struct libusb_interface_descriptor interface_desc = config_desc->interface[j].altsetting[0]; + int interface = interface_desc.bInterfaceNumber; + + int status = libusb_release_interface(handle, interface); + if(status != 0){ perror("libusb_release_interface"); exit(-1); } + } + + // free config + libusb_free_config_descriptor(config_desc); + + // close connection + libusb_close(handle); + + // free device list + libusb_free_device_list(devices, 1); + + // libusb exit + libusb_exit(context); +} + +void sendData(int endpoint_id, uint8_t data, libusb_device_handle *handle, struct libusb_endpoint_descriptor *endpoint_desc_list){ + if(endpoint_id < 0 || endpoint_id > 1){ printf("(sendData) Wrong endpoint !\nMust be 0 or 1\n"); return; } + libusb_interrupt_transfer(handle, endpoint_desc_list[endpoint_id].bEndpointAddress, (unsigned char *) &data, 1, NULL, TIMEOUT); + +} + +void receiveData(int endpoint_id, uint8_t *data, libusb_device_handle *handle, struct libusb_endpoint_descriptor *endpoint_desc_list){ + if(endpoint_id < 2 || endpoint_id > 3){ printf("(sendData) Wrong endpoint !\nMust be 2 or 3\n"); return; } + libusb_interrupt_transfer(handle, endpoint_desc_list[endpoint_id].bEndpointAddress, (unsigned char *) data, 1, NULL, TIMEOUT); +} diff --git a/games/ninvaders/arduino.h b/games/ninvaders/arduino.h new file mode 100644 index 0000000..89ec1c1 --- /dev/null +++ b/games/ninvaders/arduino.h @@ -0,0 +1,25 @@ +#ifndef ARDUINO +#define ARDUINO + +#include +#include +#include +#include +#include + +#define ID_VENDOR 0x2341 +#define ID_PRODUCT 0x01 +#define ENDPOINTS_NUMBER 4 +#define TIMEOUT 10 +#define MAX_DATA 50 + +void init(libusb_context **context, libusb_device ***devices, ssize_t *devices_count); +libusb_device* searchArduino(libusb_device **devices, ssize_t devices_count); +void openConnection(libusb_device *arduino, libusb_device_handle **handle, struct libusb_config_descriptor **config_desc); +void getEndpoints(struct libusb_config_descriptor *config_desc, struct libusb_endpoint_descriptor *endpoint_desc_list); +void start(libusb_context **context, libusb_device ***devices, libusb_device_handle **handle, struct libusb_config_descriptor **config_desc, struct libusb_endpoint_descriptor *endpoint_desc_list); +void stop(struct libusb_config_descriptor *config_desc, libusb_device_handle *handle, libusb_device **devices, libusb_context *context); +void sendData(int endpoint_id, uint8_t data, libusb_device_handle *handle, struct libusb_endpoint_descriptor *endpoint_desc_list); +void receiveData(int endpoint_id, uint8_t *data, libusb_device_handle *handle, struct libusb_endpoint_descriptor *endpoint_desc_list); + +#endif diff --git a/games/ninvaders/debian/changelog b/games/ninvaders/debian/changelog new file mode 100644 index 0000000..e59a980 --- /dev/null +++ b/games/ninvaders/debian/changelog @@ -0,0 +1,75 @@ +ninvaders (0.1.1-3) unstable; urgency=low + + * Fix overflow in lowest_ship array. Closes: #597036 + Thanks to Matt Chapman for the bug report and patch. + * Time for a packaging overhaul: + - Bump to dh compat level 7. + - Bump standards-version to 3.9.1; no specific changes required. + - Add the now-necessary misc:Depends. + - Strip DH_COMPAT from debian/rules; move it to debian/compat. + - Move menu entry to Games/Action, and quote all values. + - Use dh_prep instead of dh_clean -k. + - Don't ignore make clean errors in the clean target. + - Enhance the copyright file. + + -- Matthew Palmer Tue, 05 Oct 2010 13:21:26 +1100 + +ninvaders (0.1.1-2) unstable; urgency=low + + * Convert everything in the package to refer to the binary and related + materials (manpage) in the lowercase form (ninvaders). Closes: #300508. + + -- Matthew Palmer Thu, 29 Sep 2005 20:26:34 +1000 + +ninvaders (0.1.1-1) unstable; urgency=low + + * New upstream release. + * Standards version bumped to 3.6.0. + * Build-depends on debhelper 4. + + -- Matthew Palmer Sun, 13 Jul 2003 22:57:37 +1000 + +ninvaders (0.0.8-6) unstable; urgency=low + + * Converted great honking multi-line strings into something which GCC 3.3 + can (hopefully) handle. Whoever thought that new feature was an + improvement should be hanged. Closes: #195161. + * Changed strings.h to string.h, because strings.h is not what was wanted. + + -- Matthew Palmer Sun, 1 Jun 2003 17:48:04 +1000 + +ninvaders (0.0.8-5) unstable; urgency=low + + * Bumped standards-version to 3.5.7. + + -- Matthew Palmer Sun, 22 Sep 2002 16:57:47 +1000 + +ninvaders (0.0.8-4) unstable; urgency=low + + * Developed patch to make the bunkers disappear one line at a time. Due + to the code, it will not be easily possible to make the bunkers + disappear as the aliens reach them, so this will have to do. + (Closes: #154330) + + -- Matthew Palmer Sun, 22 Sep 2002 16:33:45 +1000 + +ninvaders (0.0.8-3) unstable; urgency=low + + * Patched to replace the whole text of the GPL (!) with a function to + print the GPL based on the text in /usr/share/common-licenses/GPL. + Thanks to Pete de Zwart for the patch. + + -- Matthew Palmer Tue, 30 Jul 2002 17:00:19 +1000 + +ninvaders (0.0.8-2) unstable; urgency=low + + * Changed description in line with bug #154330. + + -- Matthew Palmer Fri, 26 Jul 2002 18:53:58 +1000 + +ninvaders (0.0.8-1) unstable; urgency=low + + * Initial Release. (Closes: #153703) + + -- Matthew Palmer Sun, 21 Jul 2002 09:59:21 +1000 + diff --git a/games/ninvaders/debian/compat b/games/ninvaders/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/games/ninvaders/debian/compat @@ -0,0 +1 @@ +7 diff --git a/games/ninvaders/debian/control b/games/ninvaders/debian/control new file mode 100644 index 0000000..831879f --- /dev/null +++ b/games/ninvaders/debian/control @@ -0,0 +1,13 @@ +Source: ninvaders +Section: games +Priority: optional +Maintainer: Matthew Palmer +Build-Depends: debhelper (>= 7), libncurses5-dev +Standards-Version: 3.9.1 + +Package: ninvaders +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: A space invaders-like game using ncurses + A Space Invaders type game with text-only graphics. Ever wanted to play + space invaders when you can't find a GUI? Now you can. diff --git a/games/ninvaders/debian/copyright b/games/ninvaders/debian/copyright new file mode 100644 index 0000000..93cfc42 --- /dev/null +++ b/games/ninvaders/debian/copyright @@ -0,0 +1,30 @@ +Upstream: http://ninvaders.sourceforge.net/ + +Upstream Authors: Thomas Dettbarn , with +contributions by others (see nInvaders -help for full details). + +Copyright: + +From nInvaders.c: + + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + +Released under the terms of the GPL. See /usr/share/common-licenses/GPL, or +nInvaders -gpl. diff --git a/games/ninvaders/debian/dirs b/games/ninvaders/debian/dirs new file mode 100644 index 0000000..33359b8 --- /dev/null +++ b/games/ninvaders/debian/dirs @@ -0,0 +1 @@ +usr/games diff --git a/games/ninvaders/debian/docs b/games/ninvaders/debian/docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/games/ninvaders/debian/docs @@ -0,0 +1 @@ +README diff --git a/games/ninvaders/debian/links b/games/ninvaders/debian/links new file mode 100644 index 0000000..0cd6025 --- /dev/null +++ b/games/ninvaders/debian/links @@ -0,0 +1 @@ +usr/games/ninvaders usr/games/nInvaders diff --git a/games/ninvaders/debian/menu b/games/ninvaders/debian/menu new file mode 100644 index 0000000..893a29c --- /dev/null +++ b/games/ninvaders/debian/menu @@ -0,0 +1,2 @@ +?package(ninvaders):needs="text" section="Games/Action"\ + title="nInvaders" command="/usr/games/nInvaders" diff --git a/games/ninvaders/debian/ninvaders.1 b/games/ninvaders/debian/ninvaders.1 new file mode 100644 index 0000000..b5d1473 --- /dev/null +++ b/games/ninvaders/debian/ninvaders.1 @@ -0,0 +1,42 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH NINVADERS 6 "July 21, 2002" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +ninvaders \- ncurses version of space invaders +.SH SYNOPSIS +.B ninvaders +.SH DESCRIPTION +In short, this is a space invaders game written for the ncurses terminal +control library. It uses ASCII art to draw everything, and you can play it +just about anywhere. Space Invaders over dialup! +.PP +To play the game, simply run the program. You will be placed in the game +arena with a large block of aliens. To move your gun pod (at the bottom of +the screen) use the left and right arrow keys. To shoot, press space. You +can move faster if you hold the arrow keys down. +.PP +The object of the game is to shoot all the aliens (the multi-coloured moving +things) before they reach the ground. Since these aliens aren't friendly +(which is why you're trying to stop them) they will shoot back. Dodge the +descending bullets or hang about under the large stationary blocks for +cover. +.SH AUTHOR +This manual page was written by Matthew Palmer , +for the Debian GNU/Linux system (but may be used by others). +.PP +The ninvaders program was written by Thomas Dettbarn + and is released under the GPL. diff --git a/games/ninvaders/debian/rules b/games/ninvaders/debian/rules new file mode 100755 index 0000000..a339169 --- /dev/null +++ b/games/ninvaders/debian/rules @@ -0,0 +1,71 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + $(MAKE) + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + # Add here commands to install the package into debian/ninvaders. + cp nInvaders $(CURDIR)/debian/ninvaders/usr/games/ninvaders + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do here. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdirs + dh_installdocs + dh_installmenu + dh_installman debian/ninvaders.1 + dh_link + dh_installchangelogs + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/games/ninvaders/globals.c b/games/ninvaders/globals.c new file mode 100644 index 0000000..6112a1c --- /dev/null +++ b/games/ninvaders/globals.c @@ -0,0 +1,157 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#include +#include +#include + +#include "globals.h" + + +#define MAJOR 0 +#define MINOR 1 +#define RELEASE 1 + + + +#ifdef WIN32 +#define usleep(x) Sleep(x/1000) +#endif + + +/** + * sleep for specified time + */ +void doSleep(int microseconds) +{ + usleep(microseconds); +} + + +/** + * show version information + */ +void showVersion() +{ + fprintf(stderr, "*** nInvaders %i.%i.%i\n", MAJOR, MINOR, RELEASE); + fprintf(stderr, "*** (C)opyleft 2k2 by Dettus\n"); + fprintf(stderr, "*** dettus@matrixx-bielefeld.de\n"); + fprintf(stderr, "Additional code by Mike Saarna,\n"); + fprintf(stderr, "Sebastian Gutsfeld -> segoh@gmx.net,\n"); + fprintf(stderr, "Alexander Hollinger -> alexander.hollinger@gmx.net and\n"); + fprintf(stderr, "Matthias Thar -> hiast2@compuserve.de\n"); +} + + +/** + * show usage of command line parameters + */ +void showUsage() +{ + + fprintf(stderr, "\n\nUsage: nInvaders [-l skill] [-gpl]\n"); + fprintf(stderr, " where -l 0=NIGHTMARE\n"); + fprintf(stderr, " -l 1=okay\n"); + fprintf(stderr, " -l 9=May I play daddy?!\n"); + fprintf(stderr, "\n -gpl shows you the license file\n"); +} + + +/** + * wait for input of return to continue + */ +void waitForReturn() +{ + char b[2]; + fprintf(stderr, "...Please press to read on..."); + fgets(b, sizeof(b), stdin); +} + +/** + * show short version of Gnu GPL + */ +void showGplShort() +{ + fprintf(stderr,"\n"); + fprintf(stderr,"This program is free software; you can redistribute it and/or modify\n"); + fprintf(stderr,"it under the terms of the GNU General Public License as published by\n"); + fprintf(stderr,"the Free Software Foundation; either version 2 of the License, or\n"); + fprintf(stderr,"(at your option) any later version.\n"); + fprintf(stderr,"\n"); + fprintf(stderr,"This program is distributed in the hope that it will be useful,\n"); + fprintf(stderr,"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); + fprintf(stderr,"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); + fprintf(stderr,"GNU General Public License for more details.\n"); + fprintf(stderr,"\n"); + fprintf(stderr,"You should have received a copy of the GNU General Public License\n"); + fprintf(stderr,"along with this program; if not, write to the Free Software\n"); + fprintf(stderr,"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"); + fprintf(stderr,"\n"); + fprintf(stderr,"Use the -gpl command line switch to see the full license of this program\n"); + fprintf(stderr,"Use the -help command line switch to see who wrote this program \n"); + fprintf(stderr,"\n"); +} + +/** + * show GNU GENERAL PUBLIC LICENSE + */ +void showGpl() +{ + /* Fix fuxored GPL display */ + + FILE *GPL; + + char gpl_file[] = "/usr/share/common-licenses/GPL"; + char *buff = NULL; + char *check = NULL; + + int lines = 23; + int buff_size = 4096; + int count = 0; + + if (!(GPL = fopen(gpl_file, "r"))) { + perror("gpl():\t"); + return; + } + + if (!(buff = calloc(buff_size, sizeof(char)))) { + perror("gpl():\t"); + fclose(GPL); + return; + } + + do { + while (count < lines && (check = fgets(buff, buff_size, GPL))) { + fputs(buff, stderr); + count++; + } + + /* Pause */ + waitForReturn(); + count = 0; + } while (check); + + fclose(GPL); + free(buff); +} diff --git a/games/ninvaders/globals.h b/games/ninvaders/globals.h new file mode 100644 index 0000000..7eacb9a --- /dev/null +++ b/games/ninvaders/globals.h @@ -0,0 +1,35 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#ifndef GLOBALS +#define GLOBALS + +extern void doSleep(); + +extern void showUsage(); +extern void showVersion(); +extern void showGplShort(); +extern void showGpl(); + +#endif diff --git a/games/ninvaders/gpl.txt b/games/ninvaders/gpl.txt new file mode 100644 index 0000000..5b6e7c6 --- /dev/null +++ b/games/ninvaders/gpl.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/games/ninvaders/ind.html b/games/ninvaders/ind.html new file mode 100644 index 0000000..6a8b438 --- /dev/null +++ b/games/ninvaders/ind.html @@ -0,0 +1,111 @@ + + + + + + + + Welcome to Your New Home Page! + + + +
+ +

Welcome to Your New Home in Cyberspace!

+ +
+
+ + + +

This is a placeholder page installed by the Debian +release of the Apache Web server package, +because no home page was installed on this host. You may want to replace +this as soon as possible with your own web pages, of course.... + +

+This computer has installed the Debian GNU/Linux operating system but has +nothing to do with the Debian GNU/Linux project. If you want to +report something about this host's behavior or domain, please contact the +ISPs involved directly, not the Debian Project. +

See the Network Abuse Clearinghouse +for how to do this. +

+ +

Unless you changed its configuration, your new server is configured as follows: +

    +
  • +Configuration files can be found in /etc/apache.
  • + +
  • +The DocumentRoot, which is the directory under which all your +HTML files should exist, is set to /var/www.
  • + +
  • +CGI scripts are looked for in /usr/lib/cgi-bin, which is where +Debian packages will place their scripts.
  • + +
  • +Log files are placed in /var/log/apache, and will be rotated +daily. The frequency of rotation can be easily changed by editing +/etc/apache/cron.conf.
  • + +
  • +The default directory index is index.html, meaning that requests +for a directory /foo/bar/ will give the contents of the file /var/www/foo/bar/index.html +if it exists (assuming that /var/www is your DocumentRoot).
  • + +
  • +User directories are enabled, and user documents will be looked for in +the public_html directory of the users' homes. These dirs +should be under /home, and users will not be able to symlink to files +they don't own.
  • + +
+All standard Apache modules are available with this release and can be +chosen with the apacheconfig script. Installing a new module on +your system is just a matter of compiling it (with the apache-dev package) +and adding a line to your httpd.conf configuration file. + +

More documentation on Apache can be found on: +

+ +

You can also consult the list of World +Wide Web Frequently Asked Questions for information. + +

If you find a bug in this Apache package, or in Apache itself, +please file a bug report on it. Instructions on doing this, and the +list of known bugs of this +package, can be found in the Debian Bug Tracking System. + +

Thanks for using this package, and congratulations for your choice of +a Debian system! + +
+

+Debian +Apache

+ +
+ +

+


+Johnie Ingram, +Treasure Island, California    13 October 2001. + + + diff --git a/games/ninvaders/makefile b/games/ninvaders/makefile new file mode 100644 index 0000000..923d7dd --- /dev/null +++ b/games/ninvaders/makefile @@ -0,0 +1,20 @@ +CC=gcc +CFLAGS=-O3 -Wall +LIBS=-l ncurses -l usb-1.0 + +CFILES=arduino.c globals.c view.c aliens.c ufo.c player.c nInvaders.c +HFILES=arduino.h globals.h view.h aliens.h ufo.h player.h nInvaders.h +OFILES=arduino.o globals.o view.o aliens.o ufo.o player.o nInvaders.o +all: nInvaders + rm -f $(OFILES) + +nInvaders: $(OFILES) $(HFILES) + $(CC) $(LDFLAGS) -o$@ $(OFILES) $(LIBS) + +.c.o: + $(CC) -c -I. $(CFLAGS) $(OPTIONS) $< +clean: + rm -f nInvaders $(OFILES) + +exec: all + ./nInvaders diff --git a/games/ninvaders/nInvaders.c b/games/ninvaders/nInvaders.c new file mode 100644 index 0000000..9087c4c --- /dev/null +++ b/games/ninvaders/nInvaders.c @@ -0,0 +1,431 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#include +#include +#include +#include "nInvaders.h" +#include "player.h" +#include "aliens.h" +#include "ufo.h" +#include "arduino.h" +#include +#include +#include +#include + +#define FPS 50 + +int lives; +long score; +int status; // status handled in timer + +#define GAME_LOOP 1 +#define GAME_NEXTLEVEL 2 +#define GAME_PAUSED 3 +#define GAME_OVER 4 +#define GAME_EXIT 5 +#define GAME_HIGHSCORE 6 + +libusb_device_handle *handle; +struct libusb_endpoint_descriptor endpoint_desc_list[ENDPOINTS_NUMBER]; +int waitUSB = 0; + +void sendLives(){ + uint8_t toSend = 0x00; + if(lives == 5) toSend = 0x1F; + else if(lives == 4) toSend = 0x0F; + else if(lives == 3) toSend = 0x07; + else if(lives == 2) toSend = 0x03; + else if(lives == 1) toSend = 0x01; + else if(lives == 0) toSend = 0x00; + if(handle != NULL && endpoint_desc_list != NULL && waitUSB == 0){ + waitUSB = 1; + usleep(100000); // wait for endpoints to be free (100 ms) + sendData(0, toSend, handle, endpoint_desc_list); + waitUSB = 0; + } +} + +/** + * initialize level: reset attributes of most units + */ +static void initLevel() +{ + playerReset(); + aliensReset(); + ufoReset(); + bunkersReset(); + render(); + drawscore(); +} + +/** + * evaluate command line parameters + */ +static void evaluateCommandLine(int argc, char **argv) +{ + + // -l : set skill level + if (argc == 3 && strcmp(argv[1], "-l") == 0) { + if (argv[2][0] >= '0' && argv[2][0] <= '9') { + skill_level = argv[2][0] - 48; + } else { + argc = 2; + } + } + + // -gpl : show GNU GPL + if (argc == 2 && strcmp(argv[1], "-gpl") == 0) { + showGpl(); + } + + // wrong command line: show usage + if (argc == 2 || (argc == 3 && strcmp(argv[1], "-l") != 0)) { + showVersion(); + showUsage(); + exit(1); + } +} + + +static void finish(int sig) +{ + endwin(); + showGplShort(); + + fprintf(stderr,"\n"); + fprintf(stderr,"\n"); + fprintf(stderr,"=========================================================================\n"); + fprintf(stderr,"\n"); + + fprintf(stderr,"Final score: %7.7ld, Final level: %2.2d\nFinal rating... ",score,level); + if (lives>0) + fprintf(stderr,"Quitter\n\n"); + else if(score<5000) + fprintf(stderr,"Alien Fodder\n\n"); + else if(score<7500) + fprintf(stderr,"Easy Target\n\n"); + else if(score<10000) + fprintf(stderr,"Barely Mediocre\n\n"); + else if(score<12500) + fprintf(stderr,"Shows Promise\n\n"); + else if(score<15000) + fprintf(stderr,"Alien Blaster\n\n"); + else if(score<20000) + fprintf(stderr,"Earth Defender\n\n"); + else if(score>19999) + fprintf(stderr,"Supreme Protector\n\n"); + + showVersion(); + exit(0); +} + + +void drawscore() +{ + statusDisplay(level, score, lives); +} + + +/** + * reads input from keyboard and do action + */ +void readInput() +{ + int ch; + static int lastmove; + + timeout(100); + ch = getch(); // get key pressed + + static uint8_t data = 0; + if(ch == -1){ // keyboard first + usleep(1000000); // slow down inputs (100 ms) + if(handle != NULL && endpoint_desc_list != NULL && waitUSB == 0) + receiveData(2, &data, handle, endpoint_desc_list); + if(data != 0){ + if((data & 0x10) == 0x10) ch = KEY_LEFT; + else if((data & 0x04) == 0x04) ch = KEY_RIGHT; + else if((data & 0x08) == 0x08) ch = ' '; + else return; + } + else return; + } + + switch (status) { + + case GAME_PAUSED: + + if (ch == 'p') { + status = GAME_LOOP; + } + break; + + case GAME_HIGHSCORE: + + if (ch == ' ') { + titleScreenClear(); + level = 0; // reset level + score = 0; // reset score + lives = 3; // restore lives + sendLives(); + status = GAME_NEXTLEVEL; + } else if (ch == 'q') { // quit game + status = GAME_EXIT; + } + break; + + case GAME_OVER: + break; // don't do anything + + default: + + if (ch == 'l' || ch == KEY_RIGHT) { // move player right + if (lastmove == 'l') { + playerTurboOn(); // enable Turbo + } else { + playerTurboOff(); // disable Turbo + } + playerMoveRight(); // move player + lastmove = 'l'; // remember last move for turbo mode + } else if (ch == 'h' || ch == KEY_LEFT) { // move player left + if (lastmove == 'h') { + playerTurboOn(); // enable Turbo + } else { + playerTurboOff(); // disable Turbo + } + playerMoveLeft(); // move player + lastmove = 'h'; // remember last move for turbo mode + } else if (ch == 'k' || ch == ' ') { // shoot missile + playerLaunchMissile(); + } else if (ch == 'p') { // pause game until 'p' pressed again + // set status to game paused + status = GAME_PAUSED; + } else if (ch == 'W') { // cheat: goto next level + status = GAME_NEXTLEVEL; + } else if (ch == 'L') { // cheat: one more live + lives++; + sendLives(); + drawscore(); + } else if (ch == 'q') { // quit game + status = GAME_EXIT; + } else { // disable turbo mode if key is not kept pressed + lastmove = ' '; + } + + } // switch + +} + + +/** + * timer + * this method is executed every 1 / FPS seconds + */ +void handleTimer() +{ + static int aliens_move_counter = 0; + static int aliens_shot_counter = 0; + static int player_shot_counter = 0; + static int ufo_move_counter = 0; + static int title_animation_counter = 0; + static int game_over_counter = 0; + + switch (status) { + + case GAME_NEXTLEVEL: // go to next level + + level++; // increase level + + initLevel(); // initialize level + + aliens_move_counter = 0; + aliens_shot_counter = 0; + player_shot_counter = 0; + ufo_move_counter = 0; + + weite = (shipnum+(skill_level*10)-(level*5)+5)/10; + + if (weite < 0) { + weite = 0; + } + + // change status and start game! + status = GAME_LOOP; + + case GAME_LOOP: // do game handling + + // move aliens + if (aliens_move_counter == 0 && aliensMove() == 1) { + // aliens reached player + lives = 0; + sendLives(); + status = GAME_OVER; + } + + // move player missile + if (player_shot_counter == 0 && playerMoveMissile() == 1) { + // no aliens left + status = GAME_NEXTLEVEL; + } + + // move aliens' missiles + if (aliens_shot_counter == 0 && aliensMissileMove() == 1) { + // player was hit + lives--; // player looses one life + sendLives(); + drawscore(); // draw score + playerExplode(); // display some explosion graphics + if (lives == 0) { // if no lives left ... + status = GAME_OVER; // ... exit game + } + } + + // move ufo + if (ufo_move_counter == 0 && ufoShowUfo() == 1) { + ufoMoveLeft(); // move it one position to the left + } + + + if (aliens_shot_counter++ >= 5) {aliens_shot_counter=0;} // speed of alien shot + if (player_shot_counter++ >= 1) {player_shot_counter=0;} // speed of player shot + if (aliens_move_counter++ >= weite) {aliens_move_counter=0;} // speed of aliend + if (ufo_move_counter++ >= 3) {ufo_move_counter=0;} // speed of ufo + + refreshScreen(); + break; + + case GAME_PAUSED: // game is paused + break; + + case GAME_OVER: // game over + if (game_over_counter == 100) { + battleFieldClear(); + status = GAME_HIGHSCORE; + game_over_counter = 0; + } else { + gameOverDisplay(); + game_over_counter++; + } + break; + + case GAME_EXIT: // exit game + finish(0); + break; + + case GAME_HIGHSCORE: // display highscore + if (title_animation_counter == 0) { + titleScreenDisplay(); + } + + if (title_animation_counter++ >= 6) {title_animation_counter = 0;} // speed of animation + break; + + } +} + + +/** + * set up timer + */ +void setUpTimer() +{ + struct itimerval myTimer; + struct sigaction myAction; + myTimer.it_value.tv_sec = 0; + myTimer.it_value.tv_usec = 1000000 / FPS; + myTimer.it_interval.tv_sec = 0; + myTimer.it_interval.tv_usec = 1000000 / FPS; + setitimer(ITIMER_REAL, &myTimer, NULL); + + myAction.sa_handler = &handleTimer; + myAction.sa_flags = SA_RESTART; + sigaction(SIGALRM, &myAction, NULL); +} + + +int go = 1; +/*void signalINT(int sig){ + if(sig == SIGINT){ + go = 0; + } +}*/ +int main(int argc, char **argv) +{ + libusb_context *context; + libusb_device **devices; + struct libusb_config_descriptor *config_desc; + + // start + start(&context, &devices, &handle, &config_desc, endpoint_desc_list); + + // singals + /*struct sigaction action; + action.sa_handler = signalINT; + sigaction(SIGINT, &action, NULL);*/ + + // nInvaders + weite = 0; + score = 0; + lives = 3; + sendLives(); + level = 0; + skill_level = 1; + + evaluateCommandLine(argc, argv); // evaluate command line parameters + graphicEngineInit(); // initialize graphic engine + + // set up timer/ game handling + setUpTimer(); + status = GAME_HIGHSCORE; + + // read keyboard input + do { + // do movements and key-checking + readInput(handle, endpoint_desc_list); + } while (go); + + // stop + stop(config_desc, handle, devices, context); + + return 0; +} + + +void doScoring(int alienType) +{ + int points[4] = {500, 200, 150, 100}; // 0: ufo, 1:red, 2:green, 3:blue + + score += points[alienType]; // every alien type does different scoring points + + // every 6000 pts player gets a new live + if (score % 6000 == 0){ + lives++; + sendLives(); + } + + drawscore(); // display score +} + diff --git a/games/ninvaders/nInvaders.h b/games/ninvaders/nInvaders.h new file mode 100644 index 0000000..1161321 --- /dev/null +++ b/games/ninvaders/nInvaders.h @@ -0,0 +1,60 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#include +#include +#include "view.h" +#include "globals.h" + + +#ifndef NINVADERS +#define NINVADERS + +#define UFO_ALIEN_TYPE 0 +#define RED_ALIEN_TYPE 1 +#define GREEN_ALIEN_TYPE 2 +#define BLUE_ALIEN_TYPE 3 + +int main(int argv, char **argc); // hey! it has to start somewhere! + +extern void render(void); + +void game_over(int a); +void drawscore(); + +void doScoring(int alienType); + +// todo: let's try to not having to declare these "public" +int weite; +int level; +int skill_level; + +// included from globals.h +extern void doSleep(); +extern void showUsage(); +extern void showVersion(); +extern void showGplShort(); +extern void showGpl(); + +#endif diff --git a/games/ninvaders/ninvaders-0.1.1/ChangeLog b/games/ninvaders/ninvaders-0.1.1/ChangeLog deleted file mode 100644 index f6ba535..0000000 --- a/games/ninvaders/ninvaders-0.1.1/ChangeLog +++ /dev/null @@ -1,320 +0,0 @@ - -****** Release 0.1.1 ****** - -2003-04-22 Alexander Hollinger - - * globas.c: changed version from 0.0.11 to 0.1.1 - -2003-05-06 Sebastian Gutsfeld - - * aliens.c (aliensMissileMove): added test if there is an alien - ship left when starting a new missile; this was the bug which is - responsible for freezing the game when shooting at the last alien - -2003-05-05 Sebastian Gutsfeld - - * nInvaders.c (readInput): updated readInput for reading input in - different states (see status var) - - * nInvaders.c (handleTimer): added code for status GAME_HIGHSCORE - so a title screen with animation is shown; updated status - GAME_OVER - - * nInvaders.c (main): updated status initialisation from - GAME_NEXTLEVEL to GAME_HIGHSCORE - - * view.c: added WINDOW wTitleScreen; added titleScreenInit; added - titleScreenDisplay; added titleScreenClear; added battleFieldClear - - * view.c (aliensRefresh): formatted some code - - * view.c (ufoRefresh): fixed array length - - * view.c (gameOverDisplay): simpified function - - * view.c (graphicEngineInit): updated with titleScreenInit - - * view.h: sorted function declarations; updated gameOverDisplay, - titleScreenClear, titleScreenDisplay and battleFieldClear - -2003-04-22 Alexander Hollinger - - * globals.c (doSleep): added again. still needed in - view.c. added "#ifdef win32" instruction again. - -2003-04-22 Alexander Hollinger - - * globals.c (doSleep): deleted method. not used any more. - - * globals.c: incremented version number from 0.0.10 to 0.0.11 - - * globals.c: removed '#ifdef win32' instruction. - - * *.c, *.h: added license notice to each file - - * renamed ToDo to TODO - -2003-04-18 Alexander Hollinger - - * nInvaders.c (finish): "barely mediocre" and "show promise" - both "< 10000". Changed latter to "< 12500" - -2003-04-17 Alexander Hollinger - - * view.c (statusDisplay): modified so that buffer is written - to wBattleField. new variable WINDOW* wStatus. added method - (statusInit) which does initialisation of WINDOW wStatus. - Problem: Alien missiles go right to the bottom of screen, - where status is located and overwritten with missile sprite. - Fix: see next point - Changed behaviour of display of lives. Now the _remaining_ - lives are displayed. i.e. at the beginning you will see - two little spaceshuttles, because you have two lives left. - - * aliens.c (aliensMissileMove): added some checking, if missile - reached bottom where player moves. if so, do not move further - and reload missile. this reduces number of missiles which have - to be hit-tested each round, yet made it necessary to change - the shot-threshold otherwise too many missiles would have been - coming down. Not limiting ALIENS_MAX_MISSILES from 50 to 10 is - possible, because missiles are reloaded when they reach the - bottom. 10 concurrent missiles should be quite hard to manage.. - Removed ALIENS_MAX_MISSILES-definition from view.h. Was defined - twice, now only in aliens.h. - optimized threshold-checking. calculation outside for- - instruction, and only comparison within. - - -2003-04-17 Alexander Hollinger - - * nInvaders.c (readInput): removed (ch==27) for exit - sequence. as dettus pointed out there would be problems - on some terminals. pressing some keys too long will send - an KEY_ESC and quit the game. - -2003-04-17 Alexander Hollinger - - * nInvaders.c (setUpTimer): changed method to call handleTimer. - The call signal(SIG_ALRM, handleTimer) didn't work on irix. - There, the timer was only fired once and then the programm - exited. Now using call to sigaction() with flag SA_RESTART. - -2003-04-16 Alexander Hollinger - - * nInvaders.c: added a real-time timer that does 50 fps. if you - want it slower toggle the constant FPS. the higher the slower. - A timer is created and does all the gaming stuff while key - checking is still done in (main). Gamehandling is done by - simulating a deterministic finite automaton by setting the - 'status'-attribute to e.g. GAME_LOOP, GAME_PAUSED, GAME_EXIT. - the following methods were modified/ added: - (setUpTimer): creates and initializes timer - (handleTimer): this method is called every 1/FPS seconds and - contains most code from old (main) - (readInput): changed so that the 'status'-variable is affected. - pressing of 'p' now changes 'status' - (main): most code moved to (handleTimer), calls setUpTimer and - sets 'status' to GAME_NEXTLEVEL - (gameOver): completely moved to handleTimer - - * view.c (graphicEngineInit): removed 'timeout(0);' no longer - needed as we now hava a timer. another advantage: call to - (readInput) in nInvaders.c no longer called permanently. - in (readInput) the getch()-call waits till a key is pressed. - doSleep(1) no longer needed in nInvaders.c (readInput). - -2003-04-08 Sebastian Gutsfeld - - * ufo.c:replaced 'u' with 'ufo' (see ufo.h) and 'a' with 'aliens' - - * ufo.h: added typedef for Ufo and renamed 'u' into 'ufo', - - * player.c: added typedef for Player and renamed 'p' into 'player', - replaced 'p' with 'player and 'a' with 'aliens' - - * aliens.c: replaced 'a' with 'aliens' (see aliens.h) - - * aliens.h: added typedef for Aliens and renamed 'a' into 'aliens' - - * globals.c (RELEASE): updated release number - -2003-04-07 Sebastian Gutsfeld - - * view.c (ufoRefresh): reverted 'frame' assignement - - * nInvaders.c (main): reverted to old ufo speed from revision 1.3 - -2003-04-06 Alexander Hollinger - - * nInvaders.c (resetPlayer): added a call to playerMisisleClear(); - - * view.c (aliensRefresh): fully encapsulated. access to aliens-Array - by pointer. - - * aliens.c (*HitCheck): moved hit_alien_test and hit_bunker_test to - aliens.c and renamed to aliensHitCheck and bunkersHitCheck. Added - comments and did improvement of bunkersHitCheck-Algorithm - (shoty < BUNKERY + BUNKERHEIGHT instead of <=). - - * nInvaders.c (finish): moved short version of GPL to globals.c - (showGplShort) - - * view.c (gameOverInit): fixed color code - - * player.h: removed lives from structPlayer. This variable belongs - more to the gamehandling in nInvaders.c that to the model of the - player in player.c. This is done because of better encapsulation - of player.c. - - * player.c (playerReset): added a playerDisplay. Removed playerDisplay - from nInvaders.c just before refreshScreen() and added another - playerDisplay in the player.c (playerMissileMove) so that the - playerMissileClear does not clear the middle of the player when - a new shot is fired. - - * aliens.c (aliensHitCheck): added support for return of alienType so - that different scoring according to type of aliens is possible. - had to change values für alien_type constants in nInvaders.h and - the order of scores in the points-array in nInvaders.c (doScoring). - ufo gets 500pt, aliens 100pt, 150pt or 200pt. - - * aliens.c (aliensReset): clears missiles of aliens, if any - - * nInvaders.c (main): changed some variable names (*_counter) and - contracted some if-statements. - - * view.c (playerExplosionDisplay): renamed from playerExplode. Added - player.c (playerExplode) which calls playerExplosionDisplay and - playerDisplay. Thus, I could remove the playerExplode(p.posX, p.posY) - from nInvaders.c and add a playerExplode(). All Elements of the - structure structPlayer now are "private". - - -2003-04-05 Sebastian Gutsfeld - - * Makefile: Updated file for ufo - - * aliens.c (aliensMissileMove): fixed comment - - * aliens.h: fixed indentation - - * globals.h: fixed indentation - - * nInvaders.c: included ufo.h, fixed some comments and linebreaks - - * nInvaders.c (initlevel): added initialisation for ufo - - * nInvaders.c (main): added code for ufo - - * nInvaders.c (doScoring): different score for different alien types - - * nInvaders.h: added constants for alien types needed by - nInvaders.c (doScoring), fixed declaration of doScoring, fixed - Indentation - - * player.c: included ufo.h (needed for playerMoveMissile) - - * player.c (playerMoveMissile): added code needed for ufo, fixed - doScoring for alien type - - * player.h: fixed indentation, fixed declaration of doScoring - - * view.c: added WINDOW *wUfo, void ufoRefresh, static void ufoInit, - void ufoDisplay and void ufoClear - - * view.c (aliensRefresh): fixed indentation and color codes - - * view.c (graphicEngineInit): added ufoInit to last init section - - * view.h: fixed indentation, added constans UFOWIDTH and UFOPOSY, added - declarations of ufoDisplay, ufoRefresh and ufoClear - - * ufo.c: files for ufo handling (initial import into cvs) - - * ufo.h: header file for ufo.c (initial import into cvs) - -2003-04-04 Sebastian Gutsfeld - - * nInvaders.h, player.c: updated every occurance of hit_player_test - to hit_alientest - - * nInvaders.c (hit_alien_test): renamed from 'hit_player_test' - -2003-04-05 Alexander Hollinger - - * [view.c] (bunkersDisplay): now fully encapsulated using pointer - *pBunker to get access to bunker-array. Method is called from - [aliens.c] (bunkersReset) instead of [aliens.c] (render) thus - saving some cpu-time. The bunker has to be displayed only at the - beginning of a new level. Then we use bunkerClearElement or - bunkerClear to remove bunker elements. No need why it was in - [aliens.c] (render). - -2003-04-04 Sebastian Gutsfeld - - * nInvaders.c (readInput): draw new number of lives in live-cheat - - * aliens.c (aliensReset): put declaration of 'level' at - beginning of function - -2003-04-04 Alexander Hollinger - - * [nInvaders.c] added a new cheat: "L" gives player one new life - for better testing - * [aliens.c, player.c] (*Reset) forgot to reset alien-block and - bunkers-block. Now there is a bunkersReset in aliens.c - * [view.c] added method graphicEngineInit() - * [view.c] (refreshScreen) fixed problem with graphic display on some - terminals. bunker and player are now displayed at startup. - * removed init.c and init.h from project - * [globals.c] some minor changes to names of methods. moved code for - displaying version from nInvaders.c to globals.c. Added code to - redefine usleep for WIN32-platforms, this should hopefully fix the - bug that the game was too fast there. - -2003-04-03 Alexander Hollinger - - * removed deprecated multi-line-strings in globals.c and nInvaders.c - -2003-04-02 Alexander Hollinger - - * view.c now contains all methods which do graphical display - (by using ncurses) - - * added file aliens.c and aliens.h. Perhaps these can later melt - with player.c and player.h. - -2003-04-01 Sebastian Gutsfeld - - * *.c (*): formatted with 'indent -kr -i8 -l90' and fixed - some linebreaks - -2003-03-30 Alexander Hollinger - - * added file "ToDo": put feature-requests and alike in here - - * player.c (player*Missile*): processing of missiles moved to these - functions to reduce size of main(). - - -2003-03-29 Sebastian Gutsfeld - - * init.c (initplayer): fixed comment - - * player.c (playerInit): put declaration of 'playerSprite' at beginning - of function - - * init.c (initshots): put declaration of 'a' at beginning of function - -2003-03-29 Alexander Hollinger - - * added more comments and added player.c which is intended to hold all - functions concearning the player - - * added method playerLaunchMissile in player.c - -2003-03-28 Alexander Hollinger - - * added some comments and split up some functions, especially in init.c. - - diff --git a/games/ninvaders/ninvaders-0.1.1/README b/games/ninvaders/ninvaders-0.1.1/README deleted file mode 100644 index 288819e..0000000 --- a/games/ninvaders/ninvaders-0.1.1/README +++ /dev/null @@ -1,52 +0,0 @@ -*** nInvaders -*** (C)opyleft 2k2 by dettus -*** dettus@matrixx-bielefeld.de - -Hello and welcome to nInvaders! Right now you are earth's only hope to save -it from alien invaders from space. Make your job, and make it good, mankind -believes in you... - -1. INSTALLING -------------- -Compiling and installing should be really straightforward, just type in -"make" on your command prompt and you'll get the binary file. If not, please -edit the makefile. Once you have compiled it, copy it (as root) to your -/usr/bin directory, or /usr/local/games, or just run it by typeing -./nInvaders. - -2. REQUIREMENTS ---------------- -nInvaders is known to compile and run on Solaris, Linux and OpenBSD. On all of -them were ncurses 5.2 installed. If you are capable of running it on other -platforms, tell me! - -3. CONTROL KEYS ---------------- -Controlling nInvaders is really simple. Just press the cursor left/right keys -to move it left or right, and press space to fire. The esc-key lets you quit -at any time you want. - -4. COMMAND LINE OPTIONS ------------------------ -nInvaders accepts the following command line options --l x where x is your skill as a number between 0(nightmare) and 9(may i play - daddy) --gpl prints out the license information. - -Any other option gives you a help screen. - -5. LICENSING ------------- -nInvaders is protected under the laws of the GPL and other countries. Any re- -distribution, reselling or copying is strictly allowed. You should have received -a copy of it with this package, if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -Or just start nInvaders with the -gpl option to learn more. - -6. GREETZ ---------- -hello mom, hello dad, hello katja, hello there, hello elitza, hello wizzard, -hello walli, hello melanie, hello judith, hello you folks at freshmeat, hello -skyper, hello gamma, hello sunfreeware, hello abuse, hello linus, hello alan, -hello herr von boedefeld, hello god, hello world. -and thank you Mike Saarna for adding ANIMATION! diff --git a/games/ninvaders/ninvaders-0.1.1/aliens.c b/games/ninvaders/ninvaders-0.1.1/aliens.c deleted file mode 100644 index 9da4337..0000000 --- a/games/ninvaders/ninvaders-0.1.1/aliens.c +++ /dev/null @@ -1,308 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#include "aliens.h" -#include "player.h" -#include "nInvaders.h" - -/** - * initialize aliens attributes - */ -void aliensReset() -{ - int i,j; - - // three different types of aliens [5], [10] - int level[ALIENS_MAX_NUMBER_Y][ALIENS_MAX_NUMBER_X]={ - {1,1,1,1,1,1,1,1,1,1}, - {2,2,2,2,2,2,2,2,2,2}, - {2,2,2,2,2,2,2,2,2,2}, - {3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3} - }; - - aliensClear(aliens.posX, aliens.posY, aliens.right, aliens.bottom); // clear old position of aliens - - // reset alien position - aliens.posX = 0; - aliens.posY = 0; - aliens.right = 0; - aliens.bottom = 0; - aliens.left = 0; - aliens.speed = 1; - - // copy level-array to enemy-array - for (i=0;ialiens.left) {aliens.left=-k;} - if (aliens.right==-1 || k>aliens.right) {aliens.right=k;} - if (aliens.bottom==-1 || c>aliens.bottom) {aliens.bottom=c;} - } - } - } else { - c++; - } - } - aliens.bottom=aliens.bottom*2; // every 2nd row is an empty row - aliens.left=aliens.left*3; // alien sprite is 3 chars wide - aliens.right=aliens.right*3; // alien sprite is 3 chars wide - - // display remaining aliens with animation - aliensRefresh(level, &alienBlock[0][0]); - -} - - -/** - * move aliens' missiles and do player/bunker hit testing - * a zero value in alienshotx indicates that the appropriate missile is loaded, but not fired - */ -int aliensMissileMove() -{ - int i, tmp; - int fPlayerWasHit = 0; - int shootThreshold; - static int alienshot_counter = 0; - - - // calculate threshold when next missile should be fired - // it is done here to save calculation time in for-instruction - shootThreshold = (skill_level * 8) * (shipnum + 2); - alienshot_counter = alienshot_counter + 10 ; - - // loop all possible missiles - for (i = 0; i < ALIENS_MAX_MISSILES; i++) { - - // if the current missile is flying we should do movements - if (alienshotx[i] != 0) { - - aliensMissileClear(alienshotx[i],alienshoty[i]); // clear old position - - // if missile hit the bunkers - if (bunkersHitCheck(alienshotx[i], alienshoty[i]) == 1) { - alienshotx[i] = 0; // value of zero reloads missile - } - - alienshoty[i]++; // move missile downwards - - // check if player was hit by an alien missile - if (playerHitCheck(alienshotx[i], alienshoty[i]) == 1) { - alienshotx[i] = 0; // value of zero reloads missile - fPlayerWasHit = 1; - } - - - } else { // missile not launched yet - - // start new missile if counter says so - if (alienshot_counter > shootThreshold && shipnum > 0) {// only shot if there's an alien left - alienshot_counter = 0; // reset counter - tmp = random() % ALIENS_MAX_NUMBER_X; // randomly select one of the ... - while (lowest_ship[tmp] == -1) { // ...aliens at the bottom of ... - tmp = random() % ALIENS_MAX_NUMBER_X; // ...a column to launch missile - } - alienshoty[i]=aliens.posY+lowest_ship[tmp]; // set y position of missile - alienshotx[i]=aliens.posX+tmp*3; // set x position of missile - } - } // if - - // display missiles if still running or just launched; could have been modified in the above code - if (alienshotx[i] != 0) { - // if missile is out of battlefield - if (alienshoty[i] == SCREENHEIGHT - 1) { - alienshotx[i] = 0; // reload missile - } else { - aliensMissileDisplay(alienshotx[i], alienshoty[i]); // display Missile at new position - } - } - - } // for - - - return fPlayerWasHit; -} - - - -/** - * check if missile hit an alien - */ -int aliensHitCheck(int shotx, int shoty) -{ - int alienType = 0; - int shipx, shipy; - // if missile is within alien-rectangle - if (shotx >= aliens.posX && shotx <= aliens.posX + ALIENS_MAX_NUMBER_X * 3 - 1 - && shoty >= aliens.posY && shoty <= aliens.posY + (ALIENS_MAX_NUMBER_Y - 1) * 2) { - // calculate the ship that was hit - shipx = (shotx - aliens.posX) / 3; - shipy = (shoty - aliens.posY) / 2; - // if there is still a ship at this position - alienType = alienBlock[shipy][shipx]; - if (alienType != 0) { - alienBlock[shipy][shipx] = 0; // delete alien ship - } - } - return alienType; // returns 0 if no alien was hit, else returns type-code of alien -} - -/** - * check if missile hit an element of bunker - */ -int bunkersHitCheck(int shotx, int shoty) -{ - int adjx, adjy; - int fBunkerWasHit = 0; - // if missile is within bunker-rectangle - if (shotx >= BUNKERX && shotx < BUNKERX + BUNKERWIDTH - && shoty >= BUNKERY && shoty < BUNKERY + BUNKERHEIGHT) { - // calculate the element of the bunker that was hit - adjy = shoty - BUNKERY; - adjx = shotx - BUNKERX; - // if there is still an element - if(bunker[adjy][adjx] == 1){ - bunker[adjy][adjx] = 0; // delete element - fBunkerWasHit = 1; // bunker was hit! - } - } - return fBunkerWasHit; -} diff --git a/games/ninvaders/ninvaders-0.1.1/aliens.h b/games/ninvaders/ninvaders-0.1.1/aliens.h deleted file mode 100644 index 040d93f..0000000 --- a/games/ninvaders/ninvaders-0.1.1/aliens.h +++ /dev/null @@ -1,78 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#include "view.h" - -#ifndef ALIENS -#define ALIENS - -typedef struct Aliens Aliens; - -struct Aliens { - int posX; // horizontal position of aliens - int posY; // vertical position of aliens - int right; - int left; - int bottom; - int speed; // 0: no movement; 1: one per turn; etc. -}; - -Aliens aliens; - -int shipnum; - -#define ALIENS_MAX_NUMBER_X 10 -#define ALIENS_MAX_NUMBER_Y 5 -#define ALIENS_MAX_MISSILES 10 - -// todo: move to structure -int lowest_ship[ALIENS_MAX_NUMBER_X]; -int alienshotx[ALIENS_MAX_MISSILES]; -int alienshoty[ALIENS_MAX_MISSILES]; -int alienshotnum; -int alienBlock[ALIENS_MAX_NUMBER_Y][ALIENS_MAX_NUMBER_X]; - -int bunker[BUNKERHEIGHT][BUNKERWIDTH + 1]; - - -void aliensReset(); -void bunkersReset(); -int aliensMove(); -int aliensMissileMove(); -void render(); -int aliensHitCheck(int shotx, int shoty); -int bunkersHitCheck(int shotx, int shoty); - - -// methods that handle graphic display, from view.c -extern void aliensDisplay(int x, int y, int wid, int hgt); -extern void aliensClear(int x, int y, int wid, int hgt); -extern void aliensRefresh(int level, int *pAliens); -extern void aliensMissileDisplay(int x, int y); -extern void aliensMissileClear(int x, int y); -extern void bunkersClearElement(int x, int y); -extern void bunkersClear(); -extern void bunkersRefresh(); - -#endif diff --git a/games/ninvaders/ninvaders-0.1.1/aliens.o b/games/ninvaders/ninvaders-0.1.1/aliens.o deleted file mode 100644 index 5337cfb..0000000 Binary files a/games/ninvaders/ninvaders-0.1.1/aliens.o and /dev/null differ diff --git a/games/ninvaders/ninvaders-0.1.1/arduino.c b/games/ninvaders/ninvaders-0.1.1/arduino.c deleted file mode 100644 index cc82ebd..0000000 --- a/games/ninvaders/ninvaders-0.1.1/arduino.c +++ /dev/null @@ -1,130 +0,0 @@ -#include -#include -#include -#include -#include -#include "arduino.h" - -void init(libusb_context **context, libusb_device ***devices, ssize_t *devices_count){ - int status = libusb_init(context); - if(status != 0){perror("libusb_init"); exit(-1);} - - *devices_count = libusb_get_device_list(*context, devices); - if(*devices_count < 0){perror("libusb_get_device_list"); exit(-1);} -} - -libusb_device* searchArduino(libusb_device **devices, ssize_t devices_count){ - for(int i=0; ibConfigurationValue; - - // detach kernel - for(int j=0; j<(*config_desc)->bNumInterfaces; j++){ - int interface = (*config_desc)->interface[j].altsetting[0].bInterfaceNumber; - if(libusb_kernel_driver_active(*handle, interface)){ - status = libusb_detach_kernel_driver(*handle, interface); - if(status != 0){ perror("libusb_detach_kernel_driver"); exit(-1); } - } - } - - // use config - status = libusb_set_configuration(*handle, configuration); - if(status != 0){ perror("libusb_set_configuration"); exit(-1); } - - // claim interfaces - for(int j=0; j<(*config_desc)->bNumInterfaces; j++){ - struct libusb_interface_descriptor interface_desc = (*config_desc)->interface[j].altsetting[0]; - int interface = interface_desc.bInterfaceNumber; - - status = libusb_claim_interface(*handle, interface); - if(status != 0){ perror("libusb_claim_interface"); exit(-1); } - } -} - -void getEndpoints(struct libusb_config_descriptor *config_desc, struct libusb_endpoint_descriptor *endpoint_desc_list){ - int count = 0; - // in interfaces - for(int j=0; jbNumInterfaces; j++){ - // find endpoints - for(int k=0; kinterface[j].altsetting[0].bNumEndpoints; k++){ - if(count > ENDPOINTS_NUMBER){ printf("getEndpoints: Array out of bound :%d:", count); exit(-1); } - *(endpoint_desc_list + count) = config_desc->interface[j].altsetting[0].endpoint[k]; - count++; - } - } - //if(count != ENDPOINTS_NUMBER){ printf("Wrong number of endpoints.\nIs this the good device ?\n"); exit(-1); } -} - -void start(libusb_context **context, libusb_device ***devices, libusb_device_handle **handle, struct libusb_config_descriptor **config_desc, struct libusb_endpoint_descriptor *endpoint_desc_list){ - // init - ssize_t devices_count; - init(context, devices, &devices_count); - - // get arduino device - libusb_device *arduino = searchArduino(*devices, devices_count); - if(arduino == NULL){ printf("Arduino device not found\n"); exit(-1); } - - // open connection, use config, detach kernel and claim interfaces - openConnection(arduino, handle, config_desc); - - // get enpoints - getEndpoints(*config_desc, endpoint_desc_list); -} - -void stop(struct libusb_config_descriptor *config_desc, libusb_device_handle *handle, libusb_device **devices, libusb_context *context){ - // release interfaces - for(int j=0; jbNumInterfaces; j++){ - struct libusb_interface_descriptor interface_desc = config_desc->interface[j].altsetting[0]; - int interface = interface_desc.bInterfaceNumber; - - int status = libusb_release_interface(handle, interface); - if(status != 0){ perror("libusb_release_interface"); exit(-1); } - } - - // free config - libusb_free_config_descriptor(config_desc); - - // close connection - libusb_close(handle); - - // free device list - libusb_free_device_list(devices, 1); - - // libusb exit - libusb_exit(context); -} - -void sendData(int endpoint_id, uint8_t data, libusb_device_handle *handle, struct libusb_endpoint_descriptor *endpoint_desc_list){ - if(endpoint_id < 0 || endpoint_id > 1){ printf("(sendData) Wrong endpoint !\nMust be 0 or 1\n"); return; } - int status = libusb_interrupt_transfer(handle, endpoint_desc_list[endpoint_id].bEndpointAddress, (unsigned char *) &data, 1, NULL, TIMEOUT); - if(status!=0 && status!=LIBUSB_ERROR_TIMEOUT){ perror("libusb_interrupt_transfer"); exit(-1); } -} - -int receiveData(int endpoint_id, uint8_t *data, libusb_device_handle *handle, struct libusb_endpoint_descriptor *endpoint_desc_list){ - if(endpoint_id < 2 || endpoint_id > 3){ printf("(sendData) Wrong endpoint !\nMust be 2 or 3\n"); return -1; } - int status = libusb_interrupt_transfer(handle, endpoint_desc_list[endpoint_id].bEndpointAddress, (unsigned char *) data, 1, NULL, TIMEOUT); - if(status!=0 && status!=LIBUSB_ERROR_TIMEOUT){ perror("libusb_interrupt_transfer"); exit(-1); } - return status; -} diff --git a/games/ninvaders/ninvaders-0.1.1/arduino.h b/games/ninvaders/ninvaders-0.1.1/arduino.h deleted file mode 100644 index 944d968..0000000 --- a/games/ninvaders/ninvaders-0.1.1/arduino.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef ARDUINO -#define ARDUINO - -#define ID_VENDOR 0x2341 -#define ID_PRODUCT 0x01 -#define ENDPOINTS_NUMBER 4 -#define TIMEOUT 50 -#define MAX_DATA 50 - -void init(libusb_context **context, libusb_device ***devices, ssize_t *devices_count); -libusb_device* searchArduino(libusb_device **devices, ssize_t devices_count); -void openConnection(libusb_device *arduino, libusb_device_handle **handle, struct libusb_config_descriptor **config_desc); -void getEndpoints(struct libusb_config_descriptor *config_desc, struct libusb_endpoint_descriptor *endpoint_desc_list); -void start(libusb_context **context, libusb_device ***devices, libusb_device_handle **handle, struct libusb_config_descriptor **config_desc, struct libusb_endpoint_descriptor *endpoint_desc_list); -void stop(struct libusb_config_descriptor *config_desc, libusb_device_handle *handle, libusb_device **devices, libusb_context *context); -void sendData(int endpoint_id, uint8_t data, libusb_device_handle *handle, struct libusb_endpoint_descriptor *endpoint_desc_list); -int receiveData(int endpoint_id, uint8_t *data, libusb_device_handle *handle, struct libusb_endpoint_descriptor *endpoint_desc_list); - -#endif diff --git a/games/ninvaders/ninvaders-0.1.1/debian/changelog b/games/ninvaders/ninvaders-0.1.1/debian/changelog deleted file mode 100644 index e59a980..0000000 --- a/games/ninvaders/ninvaders-0.1.1/debian/changelog +++ /dev/null @@ -1,75 +0,0 @@ -ninvaders (0.1.1-3) unstable; urgency=low - - * Fix overflow in lowest_ship array. Closes: #597036 - Thanks to Matt Chapman for the bug report and patch. - * Time for a packaging overhaul: - - Bump to dh compat level 7. - - Bump standards-version to 3.9.1; no specific changes required. - - Add the now-necessary misc:Depends. - - Strip DH_COMPAT from debian/rules; move it to debian/compat. - - Move menu entry to Games/Action, and quote all values. - - Use dh_prep instead of dh_clean -k. - - Don't ignore make clean errors in the clean target. - - Enhance the copyright file. - - -- Matthew Palmer Tue, 05 Oct 2010 13:21:26 +1100 - -ninvaders (0.1.1-2) unstable; urgency=low - - * Convert everything in the package to refer to the binary and related - materials (manpage) in the lowercase form (ninvaders). Closes: #300508. - - -- Matthew Palmer Thu, 29 Sep 2005 20:26:34 +1000 - -ninvaders (0.1.1-1) unstable; urgency=low - - * New upstream release. - * Standards version bumped to 3.6.0. - * Build-depends on debhelper 4. - - -- Matthew Palmer Sun, 13 Jul 2003 22:57:37 +1000 - -ninvaders (0.0.8-6) unstable; urgency=low - - * Converted great honking multi-line strings into something which GCC 3.3 - can (hopefully) handle. Whoever thought that new feature was an - improvement should be hanged. Closes: #195161. - * Changed strings.h to string.h, because strings.h is not what was wanted. - - -- Matthew Palmer Sun, 1 Jun 2003 17:48:04 +1000 - -ninvaders (0.0.8-5) unstable; urgency=low - - * Bumped standards-version to 3.5.7. - - -- Matthew Palmer Sun, 22 Sep 2002 16:57:47 +1000 - -ninvaders (0.0.8-4) unstable; urgency=low - - * Developed patch to make the bunkers disappear one line at a time. Due - to the code, it will not be easily possible to make the bunkers - disappear as the aliens reach them, so this will have to do. - (Closes: #154330) - - -- Matthew Palmer Sun, 22 Sep 2002 16:33:45 +1000 - -ninvaders (0.0.8-3) unstable; urgency=low - - * Patched to replace the whole text of the GPL (!) with a function to - print the GPL based on the text in /usr/share/common-licenses/GPL. - Thanks to Pete de Zwart for the patch. - - -- Matthew Palmer Tue, 30 Jul 2002 17:00:19 +1000 - -ninvaders (0.0.8-2) unstable; urgency=low - - * Changed description in line with bug #154330. - - -- Matthew Palmer Fri, 26 Jul 2002 18:53:58 +1000 - -ninvaders (0.0.8-1) unstable; urgency=low - - * Initial Release. (Closes: #153703) - - -- Matthew Palmer Sun, 21 Jul 2002 09:59:21 +1000 - diff --git a/games/ninvaders/ninvaders-0.1.1/debian/compat b/games/ninvaders/ninvaders-0.1.1/debian/compat deleted file mode 100644 index 7f8f011..0000000 --- a/games/ninvaders/ninvaders-0.1.1/debian/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/games/ninvaders/ninvaders-0.1.1/debian/control b/games/ninvaders/ninvaders-0.1.1/debian/control deleted file mode 100644 index 831879f..0000000 --- a/games/ninvaders/ninvaders-0.1.1/debian/control +++ /dev/null @@ -1,13 +0,0 @@ -Source: ninvaders -Section: games -Priority: optional -Maintainer: Matthew Palmer -Build-Depends: debhelper (>= 7), libncurses5-dev -Standards-Version: 3.9.1 - -Package: ninvaders -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: A space invaders-like game using ncurses - A Space Invaders type game with text-only graphics. Ever wanted to play - space invaders when you can't find a GUI? Now you can. diff --git a/games/ninvaders/ninvaders-0.1.1/debian/copyright b/games/ninvaders/ninvaders-0.1.1/debian/copyright deleted file mode 100644 index 93cfc42..0000000 --- a/games/ninvaders/ninvaders-0.1.1/debian/copyright +++ /dev/null @@ -1,30 +0,0 @@ -Upstream: http://ninvaders.sourceforge.net/ - -Upstream Authors: Thomas Dettbarn , with -contributions by others (see nInvaders -help for full details). - -Copyright: - -From nInvaders.c: - - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - -Released under the terms of the GPL. See /usr/share/common-licenses/GPL, or -nInvaders -gpl. diff --git a/games/ninvaders/ninvaders-0.1.1/debian/dirs b/games/ninvaders/ninvaders-0.1.1/debian/dirs deleted file mode 100644 index 33359b8..0000000 --- a/games/ninvaders/ninvaders-0.1.1/debian/dirs +++ /dev/null @@ -1 +0,0 @@ -usr/games diff --git a/games/ninvaders/ninvaders-0.1.1/debian/docs b/games/ninvaders/ninvaders-0.1.1/debian/docs deleted file mode 100644 index e845566..0000000 --- a/games/ninvaders/ninvaders-0.1.1/debian/docs +++ /dev/null @@ -1 +0,0 @@ -README diff --git a/games/ninvaders/ninvaders-0.1.1/debian/links b/games/ninvaders/ninvaders-0.1.1/debian/links deleted file mode 100644 index 0cd6025..0000000 --- a/games/ninvaders/ninvaders-0.1.1/debian/links +++ /dev/null @@ -1 +0,0 @@ -usr/games/ninvaders usr/games/nInvaders diff --git a/games/ninvaders/ninvaders-0.1.1/debian/menu b/games/ninvaders/ninvaders-0.1.1/debian/menu deleted file mode 100644 index 893a29c..0000000 --- a/games/ninvaders/ninvaders-0.1.1/debian/menu +++ /dev/null @@ -1,2 +0,0 @@ -?package(ninvaders):needs="text" section="Games/Action"\ - title="nInvaders" command="/usr/games/nInvaders" diff --git a/games/ninvaders/ninvaders-0.1.1/debian/ninvaders.1 b/games/ninvaders/ninvaders-0.1.1/debian/ninvaders.1 deleted file mode 100644 index b5d1473..0000000 --- a/games/ninvaders/ninvaders-0.1.1/debian/ninvaders.1 +++ /dev/null @@ -1,42 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" First parameter, NAME, should be all caps -.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH NINVADERS 6 "July 21, 2002" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -ninvaders \- ncurses version of space invaders -.SH SYNOPSIS -.B ninvaders -.SH DESCRIPTION -In short, this is a space invaders game written for the ncurses terminal -control library. It uses ASCII art to draw everything, and you can play it -just about anywhere. Space Invaders over dialup! -.PP -To play the game, simply run the program. You will be placed in the game -arena with a large block of aliens. To move your gun pod (at the bottom of -the screen) use the left and right arrow keys. To shoot, press space. You -can move faster if you hold the arrow keys down. -.PP -The object of the game is to shoot all the aliens (the multi-coloured moving -things) before they reach the ground. Since these aliens aren't friendly -(which is why you're trying to stop them) they will shoot back. Dodge the -descending bullets or hang about under the large stationary blocks for -cover. -.SH AUTHOR -This manual page was written by Matthew Palmer , -for the Debian GNU/Linux system (but may be used by others). -.PP -The ninvaders program was written by Thomas Dettbarn - and is released under the GPL. diff --git a/games/ninvaders/ninvaders-0.1.1/debian/rules b/games/ninvaders/ninvaders-0.1.1/debian/rules deleted file mode 100755 index a339169..0000000 --- a/games/ninvaders/ninvaders-0.1.1/debian/rules +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# GNU copyright 1997 to 1999 by Joey Hess. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) - CFLAGS += -g -endif -ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) - INSTALL_PROGRAM += -s -endif - -configure: configure-stamp -configure-stamp: - dh_testdir - # Add here commands to configure the package. - touch configure-stamp - -build: build-stamp - -build-stamp: configure-stamp - dh_testdir - $(MAKE) - touch build-stamp - -clean: - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - - # Add here commands to clean up after the build process. - $(MAKE) clean - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_prep - dh_installdirs - - # Add here commands to install the package into debian/ninvaders. - cp nInvaders $(CURDIR)/debian/ninvaders/usr/games/ninvaders - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do here. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installdirs - dh_installdocs - dh_installmenu - dh_installman debian/ninvaders.1 - dh_link - dh_installchangelogs - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/games/ninvaders/ninvaders-0.1.1/globals.c b/games/ninvaders/ninvaders-0.1.1/globals.c deleted file mode 100644 index 6112a1c..0000000 --- a/games/ninvaders/ninvaders-0.1.1/globals.c +++ /dev/null @@ -1,157 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#include -#include -#include - -#include "globals.h" - - -#define MAJOR 0 -#define MINOR 1 -#define RELEASE 1 - - - -#ifdef WIN32 -#define usleep(x) Sleep(x/1000) -#endif - - -/** - * sleep for specified time - */ -void doSleep(int microseconds) -{ - usleep(microseconds); -} - - -/** - * show version information - */ -void showVersion() -{ - fprintf(stderr, "*** nInvaders %i.%i.%i\n", MAJOR, MINOR, RELEASE); - fprintf(stderr, "*** (C)opyleft 2k2 by Dettus\n"); - fprintf(stderr, "*** dettus@matrixx-bielefeld.de\n"); - fprintf(stderr, "Additional code by Mike Saarna,\n"); - fprintf(stderr, "Sebastian Gutsfeld -> segoh@gmx.net,\n"); - fprintf(stderr, "Alexander Hollinger -> alexander.hollinger@gmx.net and\n"); - fprintf(stderr, "Matthias Thar -> hiast2@compuserve.de\n"); -} - - -/** - * show usage of command line parameters - */ -void showUsage() -{ - - fprintf(stderr, "\n\nUsage: nInvaders [-l skill] [-gpl]\n"); - fprintf(stderr, " where -l 0=NIGHTMARE\n"); - fprintf(stderr, " -l 1=okay\n"); - fprintf(stderr, " -l 9=May I play daddy?!\n"); - fprintf(stderr, "\n -gpl shows you the license file\n"); -} - - -/** - * wait for input of return to continue - */ -void waitForReturn() -{ - char b[2]; - fprintf(stderr, "...Please press to read on..."); - fgets(b, sizeof(b), stdin); -} - -/** - * show short version of Gnu GPL - */ -void showGplShort() -{ - fprintf(stderr,"\n"); - fprintf(stderr,"This program is free software; you can redistribute it and/or modify\n"); - fprintf(stderr,"it under the terms of the GNU General Public License as published by\n"); - fprintf(stderr,"the Free Software Foundation; either version 2 of the License, or\n"); - fprintf(stderr,"(at your option) any later version.\n"); - fprintf(stderr,"\n"); - fprintf(stderr,"This program is distributed in the hope that it will be useful,\n"); - fprintf(stderr,"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); - fprintf(stderr,"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); - fprintf(stderr,"GNU General Public License for more details.\n"); - fprintf(stderr,"\n"); - fprintf(stderr,"You should have received a copy of the GNU General Public License\n"); - fprintf(stderr,"along with this program; if not, write to the Free Software\n"); - fprintf(stderr,"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"); - fprintf(stderr,"\n"); - fprintf(stderr,"Use the -gpl command line switch to see the full license of this program\n"); - fprintf(stderr,"Use the -help command line switch to see who wrote this program \n"); - fprintf(stderr,"\n"); -} - -/** - * show GNU GENERAL PUBLIC LICENSE - */ -void showGpl() -{ - /* Fix fuxored GPL display */ - - FILE *GPL; - - char gpl_file[] = "/usr/share/common-licenses/GPL"; - char *buff = NULL; - char *check = NULL; - - int lines = 23; - int buff_size = 4096; - int count = 0; - - if (!(GPL = fopen(gpl_file, "r"))) { - perror("gpl():\t"); - return; - } - - if (!(buff = calloc(buff_size, sizeof(char)))) { - perror("gpl():\t"); - fclose(GPL); - return; - } - - do { - while (count < lines && (check = fgets(buff, buff_size, GPL))) { - fputs(buff, stderr); - count++; - } - - /* Pause */ - waitForReturn(); - count = 0; - } while (check); - - fclose(GPL); - free(buff); -} diff --git a/games/ninvaders/ninvaders-0.1.1/globals.h b/games/ninvaders/ninvaders-0.1.1/globals.h deleted file mode 100644 index 7eacb9a..0000000 --- a/games/ninvaders/ninvaders-0.1.1/globals.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#ifndef GLOBALS -#define GLOBALS - -extern void doSleep(); - -extern void showUsage(); -extern void showVersion(); -extern void showGplShort(); -extern void showGpl(); - -#endif diff --git a/games/ninvaders/ninvaders-0.1.1/globals.o b/games/ninvaders/ninvaders-0.1.1/globals.o deleted file mode 100644 index 03859c3..0000000 Binary files a/games/ninvaders/ninvaders-0.1.1/globals.o and /dev/null differ diff --git a/games/ninvaders/ninvaders-0.1.1/gpl.txt b/games/ninvaders/ninvaders-0.1.1/gpl.txt deleted file mode 100644 index 5b6e7c6..0000000 --- a/games/ninvaders/ninvaders-0.1.1/gpl.txt +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/games/ninvaders/ninvaders-0.1.1/ind.html b/games/ninvaders/ninvaders-0.1.1/ind.html deleted file mode 100644 index 6a8b438..0000000 --- a/games/ninvaders/ninvaders-0.1.1/ind.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - Welcome to Your New Home Page! - - - -
- -

Welcome to Your New Home in Cyberspace!

- -
-
- - - -

This is a placeholder page installed by the Debian -release of the Apache Web server package, -because no home page was installed on this host. You may want to replace -this as soon as possible with your own web pages, of course.... - -

-This computer has installed the Debian GNU/Linux operating system but has -nothing to do with the Debian GNU/Linux project. If you want to -report something about this host's behavior or domain, please contact the -ISPs involved directly, not the Debian Project. -

See the Network Abuse Clearinghouse -for how to do this. -

- -

Unless you changed its configuration, your new server is configured as follows: -

    -
  • -Configuration files can be found in /etc/apache.
  • - -
  • -The DocumentRoot, which is the directory under which all your -HTML files should exist, is set to /var/www.
  • - -
  • -CGI scripts are looked for in /usr/lib/cgi-bin, which is where -Debian packages will place their scripts.
  • - -
  • -Log files are placed in /var/log/apache, and will be rotated -daily. The frequency of rotation can be easily changed by editing -/etc/apache/cron.conf.
  • - -
  • -The default directory index is index.html, meaning that requests -for a directory /foo/bar/ will give the contents of the file /var/www/foo/bar/index.html -if it exists (assuming that /var/www is your DocumentRoot).
  • - -
  • -User directories are enabled, and user documents will be looked for in -the public_html directory of the users' homes. These dirs -should be under /home, and users will not be able to symlink to files -they don't own.
  • - -
-All standard Apache modules are available with this release and can be -chosen with the apacheconfig script. Installing a new module on -your system is just a matter of compiling it (with the apache-dev package) -and adding a line to your httpd.conf configuration file. - -

More documentation on Apache can be found on: -

- -

You can also consult the list of World -Wide Web Frequently Asked Questions for information. - -

If you find a bug in this Apache package, or in Apache itself, -please file a bug report on it. Instructions on doing this, and the -list of known bugs of this -package, can be found in the Debian Bug Tracking System. - -

Thanks for using this package, and congratulations for your choice of -a Debian system! - -
-

-Debian -Apache

- -
- -

-


-Johnie Ingram, -Treasure Island, California    13 October 2001. - - - diff --git a/games/ninvaders/ninvaders-0.1.1/makefile b/games/ninvaders/ninvaders-0.1.1/makefile deleted file mode 100644 index c2ffbd0..0000000 --- a/games/ninvaders/ninvaders-0.1.1/makefile +++ /dev/null @@ -1,20 +0,0 @@ -CC=gcc -CFLAGS=-O3 -Wall -LIBS=-l ncurses usb-1.0 - -CFILES=globals.c view.c aliens.c ufo.c player.c ardunio.c nInvaders.c -HFILES=globals.h view.h aliens.h ufo.h player.h ardunio.h nInvaders.h -OFILES=globals.o view.o aliens.o ufo.o player.o ardunio.o nInvaders.o -all: nInvaders - rm -f $(OFILES) - -nInvaders: $(OFILES) $(HFILES) - $(CC) $(LDFLAGS) -o$@ $(OFILES) $(LIBS) - -.c.o: - $(CC) -c -I. $(CFLAGS) $(OPTIONS) $< -clean: - rm -f nInvaders $(OFILES) - -exec: all - ./nInvaders diff --git a/games/ninvaders/ninvaders-0.1.1/nInvaders.c b/games/ninvaders/ninvaders-0.1.1/nInvaders.c deleted file mode 100644 index 3e8a6f2..0000000 --- a/games/ninvaders/ninvaders-0.1.1/nInvaders.c +++ /dev/null @@ -1,406 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#include -#include -#include -#include "nInvaders.h" -#include "player.h" -#include "aliens.h" -#include "ufo.h" -#include "arduino.h" -#include -#include -#include -#include - -#define FPS 50 - -int lives; -long score; -int status; // status handled in timer - -#define GAME_LOOP 1 -#define GAME_NEXTLEVEL 2 -#define GAME_PAUSED 3 -#define GAME_OVER 4 -#define GAME_EXIT 5 -#define GAME_HIGHSCORE 6 - - - - -/** - * initialize level: reset attributes of most units - */ -static void initLevel() -{ - playerReset(); - aliensReset(); - ufoReset(); - bunkersReset(); - render(); - drawscore(); -} - - -/** - * evaluate command line parameters - */ -static void evaluateCommandLine(int argc, char **argv) -{ - - // -l : set skill level - if (argc == 3 && strcmp(argv[1], "-l") == 0) { - if (argv[2][0] >= '0' && argv[2][0] <= '9') { - skill_level = argv[2][0] - 48; - } else { - argc = 2; - } - } - - // -gpl : show GNU GPL - if (argc == 2 && strcmp(argv[1], "-gpl") == 0) { - showGpl(); - } - - // wrong command line: show usage - if (argc == 2 || (argc == 3 && strcmp(argv[1], "-l") != 0)) { - showVersion(); - showUsage(); - exit(1); - } -} - - -static void finish(int sig) -{ - endwin(); - showGplShort(); - - fprintf(stderr,"\n"); - fprintf(stderr,"\n"); - fprintf(stderr,"=========================================================================\n"); - fprintf(stderr,"\n"); - - fprintf(stderr,"Final score: %7.7ld, Final level: %2.2d\nFinal rating... ",score,level); - if (lives>0) - fprintf(stderr,"Quitter\n\n"); - else if(score<5000) - fprintf(stderr,"Alien Fodder\n\n"); - else if(score<7500) - fprintf(stderr,"Easy Target\n\n"); - else if(score<10000) - fprintf(stderr,"Barely Mediocre\n\n"); - else if(score<12500) - fprintf(stderr,"Shows Promise\n\n"); - else if(score<15000) - fprintf(stderr,"Alien Blaster\n\n"); - else if(score<20000) - fprintf(stderr,"Earth Defender\n\n"); - else if(score>19999) - fprintf(stderr,"Supreme Protector\n\n"); - - showVersion(); - exit(0); -} - - -void drawscore() -{ - statusDisplay(level, score, lives); -} - - -/** - * reads input from keyboard and do action - */ -void readInput(libusb_device_handle *handle, struct libusb_endpoint_descriptor *endpoint_desc_list) -{ - int ch; - static int lastmove; - - timeout(100); - ch = getch(); // get key pressed - if(ch == -1){ - uint8_t data; - int status = receiveData(2, &data, handle, endpoint_desc_list); - if(status == 0){ - if(data & 0x10 == 0x10) ch = KEY_LEFT; - else if(data & 0x08 == 0x08) ch = ' '; - else if(data & 0x04 == 0x04) ch = KEY_RIGHT; - } - } - - switch (status) { - - case GAME_PAUSED: - - if (ch == 'p') { - status = GAME_LOOP; - } - break; - - case GAME_HIGHSCORE: - - if (ch == ' ') { - titleScreenClear(); - level = 0; // reset level - score = 0; // reset score - lives = 3; // restore lives - status = GAME_NEXTLEVEL; - } else if (ch == 'q') { // quit game - status = GAME_EXIT; - } - break; - - case GAME_OVER: - break; // don't do anything - - default: - - if (ch == 'l' || ch == KEY_RIGHT) { // move player right - if (lastmove == 'l') { - playerTurboOn(); // enable Turbo - } else { - playerTurboOff(); // disable Turbo - } - playerMoveRight(); // move player - lastmove = 'l'; // remember last move for turbo mode - } else if (ch == 'h' || ch == KEY_LEFT) { // move player left - if (lastmove == 'h') { - playerTurboOn(); // enable Turbo - } else { - playerTurboOff(); // disable Turbo - } - playerMoveLeft(); // move player - lastmove = 'h'; // remember last move for turbo mode - } else if (ch == 'k' || ch == ' ') { // shoot missile - playerLaunchMissile(); - } else if (ch == 'p') { // pause game until 'p' pressed again - // set status to game paused - status = GAME_PAUSED; - } else if (ch == 'W') { // cheat: goto next level - status = GAME_NEXTLEVEL; - } else if (ch == 'L') { // cheat: one more live - lives++; - drawscore(); - } else if (ch == 'q') { // quit game - status = GAME_EXIT; - } else { // disable turbo mode if key is not kept pressed - lastmove = ' '; - } - - } // switch - -} - - -/** - * timer - * this method is executed every 1 / FPS seconds - */ -void handleTimer() -{ - static int aliens_move_counter = 0; - static int aliens_shot_counter = 0; - static int player_shot_counter = 0; - static int ufo_move_counter = 0; - static int title_animation_counter = 0; - static int game_over_counter = 0; - - switch (status) { - - case GAME_NEXTLEVEL: // go to next level - - level++; // increase level - - initLevel(); // initialize level - - aliens_move_counter = 0; - aliens_shot_counter = 0; - player_shot_counter = 0; - ufo_move_counter = 0; - - weite = (shipnum+(skill_level*10)-(level*5)+5)/10; - - if (weite < 0) { - weite = 0; - } - - // change status and start game! - status = GAME_LOOP; - - case GAME_LOOP: // do game handling - - // move aliens - if (aliens_move_counter == 0 && aliensMove() == 1) { - // aliens reached player - lives = 0; - status = GAME_OVER; - } - - // move player missile - if (player_shot_counter == 0 && playerMoveMissile() == 1) { - // no aliens left - status = GAME_NEXTLEVEL; - } - - // move aliens' missiles - if (aliens_shot_counter == 0 && aliensMissileMove() == 1) { - // player was hit - lives--; // player looses one life - drawscore(); // draw score - playerExplode(); // display some explosion graphics - if (lives == 0) { // if no lives left ... - status = GAME_OVER; // ... exit game - } - } - - // move ufo - if (ufo_move_counter == 0 && ufoShowUfo() == 1) { - ufoMoveLeft(); // move it one position to the left - } - - - if (aliens_shot_counter++ >= 5) {aliens_shot_counter=0;} // speed of alien shot - if (player_shot_counter++ >= 1) {player_shot_counter=0;} // speed of player shot - if (aliens_move_counter++ >= weite) {aliens_move_counter=0;} // speed of aliend - if (ufo_move_counter++ >= 3) {ufo_move_counter=0;} // speed of ufo - - refreshScreen(); - break; - - case GAME_PAUSED: // game is paused - break; - - case GAME_OVER: // game over - if (game_over_counter == 100) { - battleFieldClear(); - status = GAME_HIGHSCORE; - game_over_counter = 0; - } else { - gameOverDisplay(); - game_over_counter++; - } - break; - - case GAME_EXIT: // exit game - finish(0); - break; - - case GAME_HIGHSCORE: // display highscore - if (title_animation_counter == 0) { - titleScreenDisplay(); - } - - if (title_animation_counter++ >= 6) {title_animation_counter = 0;} // speed of animation - break; - - } -} - - -/** - * set up timer - */ -void setUpTimer() -{ - struct itimerval myTimer; - struct sigaction myAction; - myTimer.it_value.tv_sec = 0; - myTimer.it_value.tv_usec = 1000000 / FPS; - myTimer.it_interval.tv_sec = 0; - myTimer.it_interval.tv_usec = 1000000 / FPS; - setitimer(ITIMER_REAL, &myTimer, NULL); - - myAction.sa_handler = &handleTimer; - myAction.sa_flags = SA_RESTART; - sigaction(SIGALRM, &myAction, NULL); -} - - -int go = 1; -void signalINT(int sig){ - if(sig == SIGINT){ - go = 0; - } -} -int main(int argc, char **argv) -{ - libusb_context *context; - libusb_device **devices; - libusb_device_handle *handle; - struct libusb_config_descriptor *config_desc; - struct libusb_endpoint_descriptor endpoint_desc_list[ENDPOINTS_NUMBER]; - - // start - start(&context, &devices, &handle, &config_desc, endpoint_desc_list); - - // singals - struct sigaction action; - action.sa_handler = signalINT; - sigaction(SIGINT, &action, NULL); - - // nInvaders - weite = 0; - score = 0; - lives = 3; - level = 0; - skill_level = 1; - - evaluateCommandLine(argc, argv); // evaluate command line parameters - graphicEngineInit(); // initialize graphic engine - - // set up timer/ game handling - setUpTimer(); - status = GAME_HIGHSCORE; - - // read keyboard input - do { - // do movements and key-checking - readInput(handler, endpoint_desc_list); - } while (go); - - // stop - stop(config_desc, handle, devices, context); - - return 0; -} - - -void doScoring(int alienType) -{ - int points[4] = {500, 200, 150, 100}; // 0: ufo, 1:red, 2:green, 3:blue - - score += points[alienType]; // every alien type does different scoring points - - // every 6000 pts player gets a new live - if (score % 6000 == 0){ - lives++; - } - - drawscore(); // display score -} - diff --git a/games/ninvaders/ninvaders-0.1.1/nInvaders.h b/games/ninvaders/ninvaders-0.1.1/nInvaders.h deleted file mode 100644 index 1161321..0000000 --- a/games/ninvaders/ninvaders-0.1.1/nInvaders.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#include -#include -#include "view.h" -#include "globals.h" - - -#ifndef NINVADERS -#define NINVADERS - -#define UFO_ALIEN_TYPE 0 -#define RED_ALIEN_TYPE 1 -#define GREEN_ALIEN_TYPE 2 -#define BLUE_ALIEN_TYPE 3 - -int main(int argv, char **argc); // hey! it has to start somewhere! - -extern void render(void); - -void game_over(int a); -void drawscore(); - -void doScoring(int alienType); - -// todo: let's try to not having to declare these "public" -int weite; -int level; -int skill_level; - -// included from globals.h -extern void doSleep(); -extern void showUsage(); -extern void showVersion(); -extern void showGplShort(); -extern void showGpl(); - -#endif diff --git a/games/ninvaders/ninvaders-0.1.1/player.c b/games/ninvaders/ninvaders-0.1.1/player.c deleted file mode 100644 index 698d426..0000000 --- a/games/ninvaders/ninvaders-0.1.1/player.c +++ /dev/null @@ -1,240 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#include "player.h" -#include "aliens.h" -#include "ufo.h" -#include "nInvaders.h" - -typedef struct Player Player; - -struct Player { - int posX; // horizontal position of player - int posY; // vertical position of player - int speed; // 0: no movement; 1: one per turn; etc. - int missileFired; // 0: missile not running; 1: missile running - int missileX; // horizontal position of missile - int missileY; // vertical position of missile -}; - -Player player; - -/** - * initialize player attributes - */ -void playerReset() -{ - // if missile was fired clear that position - if (player.missileFired == 1) { - playerMissileClear(player.missileX, player.missileY); - } - - playerClear(player.posX, player.posY); // clear old position of player - - player.posY = PLAYERPOSY; // set vertical Position - player.posX = 0; // set horizontal Position - player.speed = 1; - player.missileFired = 0; - player.missileX=0; - player.missileY=0; - - playerDisplay(player.posX, player.posY); // display new position of player -} - - -/** - * move player horizontally to position newPosX - */ -static void playerMove(int newPosX) -{ - playerClear(player.posX, player.posY); // clear sprite - player.posX = newPosX; // make movement - playerDisplay(player.posX, player.posY); // display sprite -} - - -/** - * move player left - */ -void playerMoveLeft() -{ - // check if space between player and border of screen is big enough - if (player.posX > 0 + player.speed) { - // desired movement is possible - playerMove(player.posX - player.speed); - } else { - // space too small, move to left-most position - playerMove(0); - } -} - - -/** - * move player right - */ -void playerMoveRight() -{ - // check if space between player and border of screen is big enough - if (player.posX < SCREENWIDTH - PLAYERWIDTH - player.speed) { - // desired movement is possible - playerMove(player.posX + player.speed); - } else { - // space too small, move to right-most position - playerMove(SCREENWIDTH - PLAYERWIDTH); - } -} - - -/** - * toggle turbo mode on (if key is kept pressed) - */ -void playerTurboOn() -{ - player.speed = 2; -} - - -/** - * toggle turbo mode off (if key is kept pressed) - */ -void playerTurboOff() -{ - player.speed = 1; -} - - -/** - * player was hit by an alien shot - */ -int playerHitCheck(int hostileShotX, int hostileShotY) -{ - int fPlayerWasHit = 0; - - // if shot reached vertikal position of player - if (hostileShotY == PLAYERPOSY) { - // if shot hits player - if (hostileShotX >= player.posX && hostileShotX <= player.posX + PLAYERWIDTH -1) { - fPlayerWasHit = 1; // set return value - } - } - - return fPlayerWasHit; // return if player was hit -} - - -/** - * Launch Missile - */ -void playerLaunchMissile() -{ - // only launch missile if no other is on its way - if (player.missileFired == 0) { - player.missileFired = 1; // missile is on its way - player.missileX = player.posX + PLAYERWIDTH / 2; // launched from the middle of player... - player.missileY = PLAYERPOSY; // ...at same horizontal position - } -} - - -/** - * Reload Missile - */ -static void playerReloadMissile() -{ - player.missileFired = 0; // no player missile flying -} - - -/** - * move player missile and do alien/bunker hit testing - * return value - 0: still some aliens left, 1: no aliens left - */ -int playerMoveMissile() -{ - int fNoAliensLeft = 0; // return value - int alienTypeHit = 0; - - // only do movements if there is a missile to move - if (player.missileFired == 1) { - - playerMissileClear(player.missileX, player.missileY); // clear old missile position - playerDisplay(player.posX, player.posY); // todo: check if this can be removed later if missiled is fired, - //the middle of player is cleared - player.missileY--; // move missile - - // if missile out of battlefield - if (player.missileY < 0) { - playerReloadMissile(); // reload missile - } else { - playerMissileDisplay(player.missileX, player.missileY); // display missile at new position - } - - // if missile hits an alien (TODO) - alienTypeHit = aliensHitCheck(player.missileX, player.missileY); - if (alienTypeHit != 0) { - - doScoring(alienTypeHit); // increase score - playerReloadMissile(); // reload missile - - aliensClear(aliens.posX, aliens.posY, aliens.right, aliens.bottom); // clear old posiiton of aliens - - render(); - if (shipnum == 0) { - fNoAliensLeft = 1; - } - - // speed of aliens - weite = (shipnum + (skill_level * 10) - (level * 5) + 5) / 10; - if (weite < 0) { - weite = 0; - } - - playerMissileClear(player.missileX, player.missileY); // clear old missile position - aliensDisplay(aliens.posX, aliens.posY, aliens.right, aliens.bottom); // display aliens - } - - // if missile hits a bunker - if (bunkersHitCheck(player.missileX, player.missileY) == 1) { - bunkersClearElement(player.missileX, player.missileY); // clear element of bunker - playerReloadMissile(); // reload player missile - } - - // if missile hits ufo - if (ufoHitCheck(player.missileX, player.missileY) == 1) { - doScoring(UFO_ALIEN_TYPE); - playerReloadMissile(); - } - } - - return fNoAliensLeft; - -} - -/** - * let player explode - */ -void playerExplode(){ - playerExplosionDisplay(player.posX, player.posY); - playerDisplay(player.posX, player.posY); -} diff --git a/games/ninvaders/ninvaders-0.1.1/player.h b/games/ninvaders/ninvaders-0.1.1/player.h deleted file mode 100644 index b48701c..0000000 --- a/games/ninvaders/ninvaders-0.1.1/player.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#ifndef PLAYER -#define PLAYER - -#include "view.h" - - -void playerReset(); - -void playerMoveLeft(); -void playerMoveRight(); -void playerTurboOn(); -void playerTurboOff(); -int playerHitCheck(int hostileShotX, int hostileShotY); -void playerLaunchMissile(); -int playerMoveMissile(); -void playerExplode(); - -// methods that handle graphic display, from view.c -extern void playerInit(); -extern void playerDisplay(int x, int y); -extern void playerClear(int x, int y); -extern void playerMissileInit(); -extern void playerMissileDisplay(int x, int y); -extern void playerMissileClear(int x, int y); -extern void playerExplosionDisplay(int x, int y); -extern void bunkersClearElement(int x, int y); - -extern void doScoring(int alienType); - -#endif - diff --git a/games/ninvaders/ninvaders-0.1.1/player.o b/games/ninvaders/ninvaders-0.1.1/player.o deleted file mode 100644 index 0807a67..0000000 Binary files a/games/ninvaders/ninvaders-0.1.1/player.o and /dev/null differ diff --git a/games/ninvaders/ninvaders-0.1.1/ufo.c b/games/ninvaders/ninvaders-0.1.1/ufo.c deleted file mode 100644 index 928872b..0000000 --- a/games/ninvaders/ninvaders-0.1.1/ufo.c +++ /dev/null @@ -1,101 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#include "ufo.h" -#include "aliens.h" -#include "nInvaders.h" - -static int fShowUfo = 0; - -/** - * initialize ufo attributes - */ -void ufoReset() -{ - ufoClear(ufo.posX, ufo.posY); // clear old position of player - - fShowUfo = 0; // do not show ufo - ufo.posY = UFOPOSY; // set vertical Position - ufo.posX = SCREENWIDTH - UFOWIDTH;// set horizontal Position -} - -/** - * move ufo horizontally to position posX - */ -static void ufoMove(int posX) -{ - ufoClear(ufo.posX, ufo.posY); // clear sprite - ufo.posX = posX; - ufoRefresh(); - ufoDisplay(ufo.posX, ufo.posY); -} - - -/** - * move ufo and check if it reached the left screen border - */ -void ufoMoveLeft() -{ - // check if space between ufo and screen border is big enough - if (ufo.posX > 1) { - // desired movement is possible - ufoMove(ufo.posX - 1); - } else { - ufoReset(); - } -} - -/** - * check if the first screen line is free for the ufo and - * display it randomly - */ -int ufoShowUfo() -{ - if (aliens.posY > 0 && fShowUfo == 0) { // aliens one line down - if ((random() % 200) == 0) { - fShowUfo = 1; - } - } - - return fShowUfo; -} - -/** - * check if ufo was hit by player and delete it from screen - */ -int ufoHitCheck(int shotX, int shotY) -{ - int fUfoWasHit = 0; - - // if shot reached vertikal position of ufo - if (shotY == UFOPOSY) { - // if shot hits ufo - if (shotX >= ufo.posX && shotX <= ufo.posX + UFOWIDTH -1) { - ufoReset(); - fUfoWasHit = 1; - } - } - - return fUfoWasHit; -} diff --git a/games/ninvaders/ninvaders-0.1.1/ufo.h b/games/ninvaders/ninvaders-0.1.1/ufo.h deleted file mode 100644 index 60dc493..0000000 --- a/games/ninvaders/ninvaders-0.1.1/ufo.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#include "view.h" - -#ifndef UFO -#define UFO - -typedef struct Ufo Ufo; - -struct Ufo { - int posX; // horizontal position of aliens - int posY; // vertical position of aliens -}; - -Ufo ufo; - -void ufoReset(); -int ufoShowUfo(); -void ufoMoveLeft(); -int ufoHitCheck(int shotX, int shotY); - -// methods that handle graphic display, from view.c -extern void ufoDisplay(int x, int y); -extern void ufoRefresh(); -extern void ufoClear(int x, int y); - -#endif diff --git a/games/ninvaders/ninvaders-0.1.1/ufo.o b/games/ninvaders/ninvaders-0.1.1/ufo.o deleted file mode 100644 index 10edbd0..0000000 Binary files a/games/ninvaders/ninvaders-0.1.1/ufo.o and /dev/null differ diff --git a/games/ninvaders/ninvaders-0.1.1/view.c b/games/ninvaders/ninvaders-0.1.1/view.c deleted file mode 100644 index aa75a6d..0000000 --- a/games/ninvaders/ninvaders-0.1.1/view.c +++ /dev/null @@ -1,589 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#include "view.h" -#include "globals.h" -#include -#include -#include - -#define RED 1 -#define GREEN 2 -#define YELLOW 3 -#define BLUE 4 -#define CYAN 5 -#define MAGENTA 6 -#define WHITE 7 - -WINDOW *wBattleField; -WINDOW *wEmpty; -WINDOW *wScores; - -WINDOW *wPlayer; -WINDOW *wPlayerMissile; -WINDOW *wAliens; -WINDOW *wAliensMissile; -WINDOW *wBunkers; -WINDOW *wGameOver; -WINDOW *wUfo; -WINDOW *wStatus; -WINDOW *wTitleScreen; - -/** - * initialize player sprites - */ -static void playerInit() -{ - wPlayer = newpad(1, PLAYERWIDTH); // new pad with appropriate size - wclear(wPlayer); // clear pad - wattrset(wPlayer,COLOR_PAIR(YELLOW)); // set color - waddstr(wPlayer,"/-^-\\"); // set sprite -} - - -/** - * display player sprite - */ -void playerDisplay(int x, int y) -{ - copywin(wPlayer,wBattleField,0,0,y,x,y,x+PLAYERWIDTH-1,0); -} - - -/** - * clear player sprite - */ -void playerClear(int x, int y) -{ - copywin(wEmpty,wBattleField,0,0,y,x,y,x+PLAYERWIDTH-1,0); -} - - -/** - * initialize missile sprites - */ -static void playerMissileInit() -{ - wPlayerMissile = newpad(1, 1); // new pad with appropriate size - wclear(wPlayerMissile); // clear pad - wattrset(wPlayerMissile,COLOR_PAIR(WHITE)); // set color - waddch(wPlayerMissile,'!'); // set sprite - wrefresh(wPlayerMissile); -} - - -/** - * display missile sprite - */ -void playerMissileDisplay(int x, int y) -{ - copywin(wPlayerMissile,wBattleField,0,0,y,x,y,x,0); -} - - -/** - * clear missile sprite - */ -void playerMissileClear(int x, int y) -{ - copywin(wEmpty,wBattleField,0,0,y,x,y,x,0); -} - - -/** - * some explosion animation - */ -void playerExplosionDisplay(int x, int y) -{ - WINDOW* wPlayerExplosion; - char playerExplosionChars[16+1]="@~`.,^#*-_=\\/%{}"; - int t,s; - - wPlayerExplosion=newpad(1,PLAYERWIDTH); // new pad - wattrset(wPlayerExplosion,COLOR_PAIR(YELLOW)); // set color - - for(t=0;t<5;t++){ // 5 frames - wclear(wPlayerExplosion); // clear pad - for(s=0;s", "_x_", "*^*", "\\_/", "o o"}, - {".-.", "-O_", "/o\\", "o-o", "", "-x-", "o^o", "/~\\", "oo "} - }; - int colors[9] = {RED, GREEN, BLUE, RED, YELLOW, WHITE, WHITE, YELLOW, RED}; - - wclear(wAliens); // clear pad - wattrset(wAliens,COLOR_PAIR(RED)); // set color - - frame++; // next frame - - // draw alien if there is one - for (row = 0; row < ALIENS_MAX_NUMBER_Y*2; row++) { - for (k = 0; k < ALIENS_MAX_NUMBER_X; k++) { - if ((row % 2) == 0) { // display aliens every even row - alienType = *(pAliens + c * (ALIENS_MAX_NUMBER_X) + k); // get type of alien //alienBlock[c][k] - - if (alienType != 0) { // if there is an alien to display - wattrset(wAliens,COLOR_PAIR(colors[alienType-1])); // set color - waddch(wAliens,ships[frame%2][alienType-1+(3*((level-1)%3))][0]); // set char1 - waddch(wAliens,ships[frame%2][alienType-1+(3*((level-1)%3))][1]); // set char2 - waddch(wAliens,ships[frame%2][alienType-1+(3*((level-1)%3))][2]); // set char3 - if (alienType > 4) { - *(pAliens + c * ALIENS_MAX_NUMBER_X + k) = (alienType + 1) % 9; - } // todo: what's that? If alien_type > 4 then do a modulo operation??? - } else { - waddstr(wAliens," "); // no alien - } - - } else { - waddstr(wAliens," "); // no aliens at odd rows - } - } - if ((row % 2) == 1) {c++;} // goto next row at alienblock - } -} - - -/** - * initialize bunkers sprites - */ -static void bunkersInit() -{ - wBunkers = newpad(BUNKERHEIGHT, BUNKERWIDTH); // new pad data - wclear(wBunkers); -} - - -/** - * display bunkers sprite - * needs pointer to bunker-array - */ -void bunkersDisplay(int *pBunker) -{ - int l, k; - wclear(wBunkers); - wattrset(wBunkers,COLOR_PAIR(CYAN)); - for (l=0;l", "", "", "< oo>"}; - static int frame = 0; - - wclear(wUfo); - wattrset(wUfo, COLOR_PAIR(MAGENTA)); - waddstr(wUfo, ufo[frame % 4]); - - frame++; -} - - -/** - * initialize ufo sprite - */ -static void ufoInit() -{ - wUfo = newpad(1, UFOWIDTH); // new pad with appropriate size - wclear(wUfo); // clear pad - wattrset(wUfo, COLOR_PAIR(MAGENTA)); // set color -} - - -/** - * display ufo sprite - */ -void ufoDisplay(int x, int y) -{ - copywin(wUfo, wBattleField, 0, 0, y, x, y, x + UFOWIDTH - 1, 0); -} - - -/** - * clear ufo sprite - */ -void ufoClear(int x, int y) -{ - copywin(wEmpty, wBattleField, 0, 0, y, x, y, x + UFOWIDTH - 1, 0); -} - - -/** - * initialize gameover graphic - */ -static void gameOverInit() -{ - // init game-over banner - wGameOver = newpad(13, 31); - wclear(wGameOver); - wattrset(wGameOver, COLOR_PAIR(WHITE)); - waddstr(wGameOver, " "); - waddstr(wGameOver, " ##### #### ## ## ###### "); - waddstr(wGameOver, " ## ## ## ####### ## "); - waddstr(wGameOver, " ## ### ###### ## # ## ##### "); - waddstr(wGameOver, " ## ## ## ## ## ## ## "); - waddstr(wGameOver, " ##### ## ## ## ## ###### "); - waddstr(wGameOver, " "); - waddstr(wGameOver, " #### ## ## ###### ###### "); - waddstr(wGameOver, " ## ## ## ## ## ## ## "); - waddstr(wGameOver, " ## ## ## ## ##### ###### "); - waddstr(wGameOver, " ## ## ## ## ## ## ## "); - waddstr(wGameOver, " #### ### ###### ## ## "); - waddstr(wGameOver, " "); -} - -/** - * display game over graphic - */ -void gameOverDisplay() -{ - int x = (SCREENWIDTH / 2) - (31 / 2); - int y = (SCREENHEIGHT / 2) - (13 / 2); - copywin(wGameOver, wBattleField, 0, 0, y, x, y + 12, x + 30, 0); - wrefresh(wBattleField); -} - - -/** - * initialize title screen - */ -static void titleScreenInit() -{ - wTitleScreen = newpad(SCREENHEIGHT, SCREENWIDTH); - wclear(wTitleScreen); -} - - -/** - * display title screen - */ -void titleScreenDisplay() -{ - static int frame = 0; - int x, y; - int i; - WINDOW *wTitleText; - WINDOW *wAliens; - WINDOW *wStartText; - char ufo[4][6] = {"", "", "", "< oo>"}; - char aliens[2][9][3+1] = { - {",^,", "_O-", "-o-", "o=o", "", "_x_", "*^*", "\\_/", "o o"}, - {".-.", "-O_", "/o\\", "o-o", "", "-x-", "o^o", "/~\\", "oo "} - }; - int score[3] = {200, 150, 100}; - int colors[9] = {RED, GREEN, BLUE, RED, GREEN, BLUE, RED, GREEN, BLUE}; - char buffer[12]; - static int alien_type = 0; - - wTitleText = newpad(4, 41); - wclear(wTitleText); - wattrset(wTitleText, COLOR_PAIR(YELLOW)); - waddstr(wTitleText, " ____ __ "); - waddstr(wTitleText, " ___ / _/__ _ _____ ___/ /__ _______"); - waddstr(wTitleText, " / _ \\_/ // _ \\ |/ / _ `/ _ / -_) __(_-<"); - waddstr(wTitleText, "/_//_/___/_//_/___/\\_,_/\\_,_/\\__/_/ /___/"); - - frame++; - wAliens = newpad(7, 11); - wclear(wAliens); - snprintf(buffer, sizeof(buffer),"%s = 500", ufo[frame % 4]); - wattrset(wAliens, COLOR_PAIR(MAGENTA)); - waddstr(wAliens, buffer); - if ((frame = frame % 60) == 0) { - alien_type = 0; - } else if (frame == 20) { - alien_type = 3; - } else if (frame == 40) { - alien_type = 6; - } - for (i = alien_type; i < alien_type + 3; i++) { - waddstr(wAliens, " "); - snprintf(buffer, sizeof(buffer), "%s = %d", aliens[frame % 2][i], score[i % 3]); - wattrset(wAliens, COLOR_PAIR(colors[i])); - waddstr(wAliens, buffer); - } - - wStartText = newpad(1, 20); - wclear(wStartText); - wattrset(wStartText, COLOR_PAIR(RED)); - waddstr(wStartText, "Press SPACE to start"); - - x = (SCREENWIDTH / 2) - (41 / 2); - y = 0; - copywin(wTitleText, wTitleScreen, 0, 0, y, x, y + 3, x + 40, 0); - - x = (SCREENWIDTH / 2) - (11 / 2); - y = 8; - copywin(wAliens, wTitleScreen, 0, 0, y, x , y + 6, x + 10, 0); - - x = (SCREENWIDTH / 2) - (20 / 2); - y = SCREENHEIGHT - 2; - copywin(wStartText, wTitleScreen, 0, 0, y, x, y, x + 19, 0); - - copywin(wTitleScreen, wBattleField, 0, 0, 0, 0, SCREENHEIGHT-1, SCREENWIDTH-1, 0); - - wrefresh(wBattleField); -} - - -/** - * clear title screen - */ -void titleScreenClear() -{ - battleFieldClear(); -} - - -/** - * initialize scores - */ -void statusInit() -{ - wStatus = newpad(1, 55); - wclear(wStatus); -} - - -/** - * display scores - */ -void statusDisplay(int level, int score, int lives) -{ - int t, xOffset; - char strStatus[55]; - // "Level: 01 Score: 0001450 Lives: /-\ /-\ /-\ /-\ /-\ " - // "1234567890123456789012345678901234567890123456789012" - - - xOffset = (SCREENWIDTH / 2) - 24; - - - - sprintf (strStatus, "Level: %2.2d Score: %2.7d Lives: ", level, score); - - wclear(wStatus); - wattrset(wStatus, COLOR_PAIR(RED)); - waddstr(wStatus, strStatus); - - // show maximal five lives - for (t = 1; ((t <= 5) && (t < lives)); t++){ - waddstr(wStatus, "/-\\ "); - } - - copywin(wStatus, wBattleField, 0, 0, SCREENHEIGHT-1, xOffset, SCREENHEIGHT-1, xOffset + 54, 0); - - -} - - -/** - * initialize battlefield - */ -static void battleFieldInit() -{ - wEmpty = newpad(SCREENHEIGHT, SCREENWIDTH); - wclear(wEmpty); - - wBattleField = newwin(SCREENHEIGHT, SCREENWIDTH, 0, 0); // new window - wclear(wBattleField); // clear window - mvwin(wBattleField, 0, 0); // move window -} - - -/** - * clear battlefield - */ -void battleFieldClear() -{ - copywin(wEmpty,wBattleField,0,0,0,0,SCREENHEIGHT-1,SCREENWIDTH-1,0); -} - - -/** - * refresh screen so that modified graphic buffers get visible - */ -void refreshScreen() -{ - redrawwin(wBattleField); // needed to display graphics properly at startup on some terminals - wrefresh(wBattleField); - -} - - -/** - * do proper cleanup - */ -static void finish(int sig) -{ - endwin(); // reset terminal into proper non-visual mode - exit(0); -} - - -/** - * initialize n_courses - */ -void graphicEngineInit() -{ - (void) signal(SIGINT, finish); // on signal "SIGINT" call method "finish" - (void) initscr(); // do initialization work - keypad(stdscr, TRUE); // enable keypad for input - (void) nonl(); // disable translation return/ newline for detection of return key - (void) cbreak(); // do not buffer typed characters, use at once - (void) noecho(); // do not echo typed characters - start_color(); // use colors - init_pair(RED, COLOR_RED, COLOR_BLACK); // define color-pair - init_pair(GREEN, COLOR_GREEN, COLOR_BLACK); // define color-pair - init_pair(YELLOW, COLOR_YELLOW, COLOR_BLACK); // define color-pair - init_pair(BLUE, COLOR_BLUE, COLOR_BLACK); // define color-pair - init_pair(CYAN, COLOR_CYAN, COLOR_BLACK); // define color-pair - init_pair(MAGENTA, COLOR_MAGENTA, COLOR_BLACK); // define color-pair - init_pair(WHITE, COLOR_WHITE, COLOR_BLACK); // define color-pair - - //timeout(0); // do not wait for input - - // initialize sprites - battleFieldInit(); - playerInit(); - playerMissileInit(); - aliensInit(); - aliensMissileInit(); - bunkersInit(); - ufoInit(); - gameOverInit(); - statusInit(); - titleScreenInit(); -} - diff --git a/games/ninvaders/ninvaders-0.1.1/view.h b/games/ninvaders/ninvaders-0.1.1/view.h deleted file mode 100644 index 873585a..0000000 --- a/games/ninvaders/ninvaders-0.1.1/view.h +++ /dev/null @@ -1,78 +0,0 @@ -/** - * nInvaders - a space invaders clone for ncurses - * Copyright (C) 2002-2003 Dettus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * homepage: http://ninvaders.sourceforge.net - * mailto: ninvaders-devel@lists.sourceforge.net - * - */ - - -#include -#include -#include - -#ifndef VIEW -#define VIEW - -#include "globals.h" - -#define SCREENHEIGHT 24 -#define SCREENWIDTH 80 - -#define PLAYERWIDTH 5 -#define PLAYERPOSY (SCREENHEIGHT-2) - -#define BUNKERWIDTH 80 -#define BUNKERHEIGHT 4 -#define BUNKERX 0 -#define BUNKERY (SCREENHEIGHT-8) - -#define ALIENS_MAX_NUMBER_X 10 -#define ALIENS_MAX_NUMBER_Y 5 - -#define UFOWIDTH 5 -#define UFOPOSY 0 - - -void graphicEngineInit(); - -void aliensClear(int x, int y, int wid, int hgt); -void aliensDisplay(int x, int y, int wid, int hgt); -void aliensMissileClear(int x, int y); -void aliensMissileDisplay(int x, int y); -void aliensRefresh(int level, int *pAliens); -void battleFieldClear(); -void bunkersClear(); -void bunkersClearElement(int x, int y); -void bunkersDisplay(int *pBunker); -void gameOverDisplay(); -void playerClear(int x, int y); -void playerDisplay(int x, int y); -void playerExplosionDisplay(int x, int y); -void playerMissileClear(int x, int y); -void playerMissileDisplay(int x, int y); -void titleScreenClear(); -void titleScreenDisplay(); -void ufoClear(int x, int y); -void ufoDisplay(int x, int y); -void ufoRefresh(); - -void statusDisplay(int level, int score, int lives); -void refreshScreen(); - -#endif diff --git a/games/ninvaders/ninvaders-0.1.1/view.o b/games/ninvaders/ninvaders-0.1.1/view.o deleted file mode 100644 index 366f3ce..0000000 Binary files a/games/ninvaders/ninvaders-0.1.1/view.o and /dev/null differ diff --git a/games/ninvaders/player.c b/games/ninvaders/player.c new file mode 100644 index 0000000..698d426 --- /dev/null +++ b/games/ninvaders/player.c @@ -0,0 +1,240 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#include "player.h" +#include "aliens.h" +#include "ufo.h" +#include "nInvaders.h" + +typedef struct Player Player; + +struct Player { + int posX; // horizontal position of player + int posY; // vertical position of player + int speed; // 0: no movement; 1: one per turn; etc. + int missileFired; // 0: missile not running; 1: missile running + int missileX; // horizontal position of missile + int missileY; // vertical position of missile +}; + +Player player; + +/** + * initialize player attributes + */ +void playerReset() +{ + // if missile was fired clear that position + if (player.missileFired == 1) { + playerMissileClear(player.missileX, player.missileY); + } + + playerClear(player.posX, player.posY); // clear old position of player + + player.posY = PLAYERPOSY; // set vertical Position + player.posX = 0; // set horizontal Position + player.speed = 1; + player.missileFired = 0; + player.missileX=0; + player.missileY=0; + + playerDisplay(player.posX, player.posY); // display new position of player +} + + +/** + * move player horizontally to position newPosX + */ +static void playerMove(int newPosX) +{ + playerClear(player.posX, player.posY); // clear sprite + player.posX = newPosX; // make movement + playerDisplay(player.posX, player.posY); // display sprite +} + + +/** + * move player left + */ +void playerMoveLeft() +{ + // check if space between player and border of screen is big enough + if (player.posX > 0 + player.speed) { + // desired movement is possible + playerMove(player.posX - player.speed); + } else { + // space too small, move to left-most position + playerMove(0); + } +} + + +/** + * move player right + */ +void playerMoveRight() +{ + // check if space between player and border of screen is big enough + if (player.posX < SCREENWIDTH - PLAYERWIDTH - player.speed) { + // desired movement is possible + playerMove(player.posX + player.speed); + } else { + // space too small, move to right-most position + playerMove(SCREENWIDTH - PLAYERWIDTH); + } +} + + +/** + * toggle turbo mode on (if key is kept pressed) + */ +void playerTurboOn() +{ + player.speed = 2; +} + + +/** + * toggle turbo mode off (if key is kept pressed) + */ +void playerTurboOff() +{ + player.speed = 1; +} + + +/** + * player was hit by an alien shot + */ +int playerHitCheck(int hostileShotX, int hostileShotY) +{ + int fPlayerWasHit = 0; + + // if shot reached vertikal position of player + if (hostileShotY == PLAYERPOSY) { + // if shot hits player + if (hostileShotX >= player.posX && hostileShotX <= player.posX + PLAYERWIDTH -1) { + fPlayerWasHit = 1; // set return value + } + } + + return fPlayerWasHit; // return if player was hit +} + + +/** + * Launch Missile + */ +void playerLaunchMissile() +{ + // only launch missile if no other is on its way + if (player.missileFired == 0) { + player.missileFired = 1; // missile is on its way + player.missileX = player.posX + PLAYERWIDTH / 2; // launched from the middle of player... + player.missileY = PLAYERPOSY; // ...at same horizontal position + } +} + + +/** + * Reload Missile + */ +static void playerReloadMissile() +{ + player.missileFired = 0; // no player missile flying +} + + +/** + * move player missile and do alien/bunker hit testing + * return value - 0: still some aliens left, 1: no aliens left + */ +int playerMoveMissile() +{ + int fNoAliensLeft = 0; // return value + int alienTypeHit = 0; + + // only do movements if there is a missile to move + if (player.missileFired == 1) { + + playerMissileClear(player.missileX, player.missileY); // clear old missile position + playerDisplay(player.posX, player.posY); // todo: check if this can be removed later if missiled is fired, + //the middle of player is cleared + player.missileY--; // move missile + + // if missile out of battlefield + if (player.missileY < 0) { + playerReloadMissile(); // reload missile + } else { + playerMissileDisplay(player.missileX, player.missileY); // display missile at new position + } + + // if missile hits an alien (TODO) + alienTypeHit = aliensHitCheck(player.missileX, player.missileY); + if (alienTypeHit != 0) { + + doScoring(alienTypeHit); // increase score + playerReloadMissile(); // reload missile + + aliensClear(aliens.posX, aliens.posY, aliens.right, aliens.bottom); // clear old posiiton of aliens + + render(); + if (shipnum == 0) { + fNoAliensLeft = 1; + } + + // speed of aliens + weite = (shipnum + (skill_level * 10) - (level * 5) + 5) / 10; + if (weite < 0) { + weite = 0; + } + + playerMissileClear(player.missileX, player.missileY); // clear old missile position + aliensDisplay(aliens.posX, aliens.posY, aliens.right, aliens.bottom); // display aliens + } + + // if missile hits a bunker + if (bunkersHitCheck(player.missileX, player.missileY) == 1) { + bunkersClearElement(player.missileX, player.missileY); // clear element of bunker + playerReloadMissile(); // reload player missile + } + + // if missile hits ufo + if (ufoHitCheck(player.missileX, player.missileY) == 1) { + doScoring(UFO_ALIEN_TYPE); + playerReloadMissile(); + } + } + + return fNoAliensLeft; + +} + +/** + * let player explode + */ +void playerExplode(){ + playerExplosionDisplay(player.posX, player.posY); + playerDisplay(player.posX, player.posY); +} diff --git a/games/ninvaders/player.h b/games/ninvaders/player.h new file mode 100644 index 0000000..b48701c --- /dev/null +++ b/games/ninvaders/player.h @@ -0,0 +1,55 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#ifndef PLAYER +#define PLAYER + +#include "view.h" + + +void playerReset(); + +void playerMoveLeft(); +void playerMoveRight(); +void playerTurboOn(); +void playerTurboOff(); +int playerHitCheck(int hostileShotX, int hostileShotY); +void playerLaunchMissile(); +int playerMoveMissile(); +void playerExplode(); + +// methods that handle graphic display, from view.c +extern void playerInit(); +extern void playerDisplay(int x, int y); +extern void playerClear(int x, int y); +extern void playerMissileInit(); +extern void playerMissileDisplay(int x, int y); +extern void playerMissileClear(int x, int y); +extern void playerExplosionDisplay(int x, int y); +extern void bunkersClearElement(int x, int y); + +extern void doScoring(int alienType); + +#endif + diff --git a/games/ninvaders/ufo.c b/games/ninvaders/ufo.c new file mode 100644 index 0000000..928872b --- /dev/null +++ b/games/ninvaders/ufo.c @@ -0,0 +1,101 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#include "ufo.h" +#include "aliens.h" +#include "nInvaders.h" + +static int fShowUfo = 0; + +/** + * initialize ufo attributes + */ +void ufoReset() +{ + ufoClear(ufo.posX, ufo.posY); // clear old position of player + + fShowUfo = 0; // do not show ufo + ufo.posY = UFOPOSY; // set vertical Position + ufo.posX = SCREENWIDTH - UFOWIDTH;// set horizontal Position +} + +/** + * move ufo horizontally to position posX + */ +static void ufoMove(int posX) +{ + ufoClear(ufo.posX, ufo.posY); // clear sprite + ufo.posX = posX; + ufoRefresh(); + ufoDisplay(ufo.posX, ufo.posY); +} + + +/** + * move ufo and check if it reached the left screen border + */ +void ufoMoveLeft() +{ + // check if space between ufo and screen border is big enough + if (ufo.posX > 1) { + // desired movement is possible + ufoMove(ufo.posX - 1); + } else { + ufoReset(); + } +} + +/** + * check if the first screen line is free for the ufo and + * display it randomly + */ +int ufoShowUfo() +{ + if (aliens.posY > 0 && fShowUfo == 0) { // aliens one line down + if ((random() % 200) == 0) { + fShowUfo = 1; + } + } + + return fShowUfo; +} + +/** + * check if ufo was hit by player and delete it from screen + */ +int ufoHitCheck(int shotX, int shotY) +{ + int fUfoWasHit = 0; + + // if shot reached vertikal position of ufo + if (shotY == UFOPOSY) { + // if shot hits ufo + if (shotX >= ufo.posX && shotX <= ufo.posX + UFOWIDTH -1) { + ufoReset(); + fUfoWasHit = 1; + } + } + + return fUfoWasHit; +} diff --git a/games/ninvaders/ufo.h b/games/ninvaders/ufo.h new file mode 100644 index 0000000..60dc493 --- /dev/null +++ b/games/ninvaders/ufo.h @@ -0,0 +1,49 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#include "view.h" + +#ifndef UFO +#define UFO + +typedef struct Ufo Ufo; + +struct Ufo { + int posX; // horizontal position of aliens + int posY; // vertical position of aliens +}; + +Ufo ufo; + +void ufoReset(); +int ufoShowUfo(); +void ufoMoveLeft(); +int ufoHitCheck(int shotX, int shotY); + +// methods that handle graphic display, from view.c +extern void ufoDisplay(int x, int y); +extern void ufoRefresh(); +extern void ufoClear(int x, int y); + +#endif diff --git a/games/ninvaders/view.c b/games/ninvaders/view.c new file mode 100644 index 0000000..aa75a6d --- /dev/null +++ b/games/ninvaders/view.c @@ -0,0 +1,589 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#include "view.h" +#include "globals.h" +#include +#include +#include + +#define RED 1 +#define GREEN 2 +#define YELLOW 3 +#define BLUE 4 +#define CYAN 5 +#define MAGENTA 6 +#define WHITE 7 + +WINDOW *wBattleField; +WINDOW *wEmpty; +WINDOW *wScores; + +WINDOW *wPlayer; +WINDOW *wPlayerMissile; +WINDOW *wAliens; +WINDOW *wAliensMissile; +WINDOW *wBunkers; +WINDOW *wGameOver; +WINDOW *wUfo; +WINDOW *wStatus; +WINDOW *wTitleScreen; + +/** + * initialize player sprites + */ +static void playerInit() +{ + wPlayer = newpad(1, PLAYERWIDTH); // new pad with appropriate size + wclear(wPlayer); // clear pad + wattrset(wPlayer,COLOR_PAIR(YELLOW)); // set color + waddstr(wPlayer,"/-^-\\"); // set sprite +} + + +/** + * display player sprite + */ +void playerDisplay(int x, int y) +{ + copywin(wPlayer,wBattleField,0,0,y,x,y,x+PLAYERWIDTH-1,0); +} + + +/** + * clear player sprite + */ +void playerClear(int x, int y) +{ + copywin(wEmpty,wBattleField,0,0,y,x,y,x+PLAYERWIDTH-1,0); +} + + +/** + * initialize missile sprites + */ +static void playerMissileInit() +{ + wPlayerMissile = newpad(1, 1); // new pad with appropriate size + wclear(wPlayerMissile); // clear pad + wattrset(wPlayerMissile,COLOR_PAIR(WHITE)); // set color + waddch(wPlayerMissile,'!'); // set sprite + wrefresh(wPlayerMissile); +} + + +/** + * display missile sprite + */ +void playerMissileDisplay(int x, int y) +{ + copywin(wPlayerMissile,wBattleField,0,0,y,x,y,x,0); +} + + +/** + * clear missile sprite + */ +void playerMissileClear(int x, int y) +{ + copywin(wEmpty,wBattleField,0,0,y,x,y,x,0); +} + + +/** + * some explosion animation + */ +void playerExplosionDisplay(int x, int y) +{ + WINDOW* wPlayerExplosion; + char playerExplosionChars[16+1]="@~`.,^#*-_=\\/%{}"; + int t,s; + + wPlayerExplosion=newpad(1,PLAYERWIDTH); // new pad + wattrset(wPlayerExplosion,COLOR_PAIR(YELLOW)); // set color + + for(t=0;t<5;t++){ // 5 frames + wclear(wPlayerExplosion); // clear pad + for(s=0;s", "_x_", "*^*", "\\_/", "o o"}, + {".-.", "-O_", "/o\\", "o-o", "", "-x-", "o^o", "/~\\", "oo "} + }; + int colors[9] = {RED, GREEN, BLUE, RED, YELLOW, WHITE, WHITE, YELLOW, RED}; + + wclear(wAliens); // clear pad + wattrset(wAliens,COLOR_PAIR(RED)); // set color + + frame++; // next frame + + // draw alien if there is one + for (row = 0; row < ALIENS_MAX_NUMBER_Y*2; row++) { + for (k = 0; k < ALIENS_MAX_NUMBER_X; k++) { + if ((row % 2) == 0) { // display aliens every even row + alienType = *(pAliens + c * (ALIENS_MAX_NUMBER_X) + k); // get type of alien //alienBlock[c][k] + + if (alienType != 0) { // if there is an alien to display + wattrset(wAliens,COLOR_PAIR(colors[alienType-1])); // set color + waddch(wAliens,ships[frame%2][alienType-1+(3*((level-1)%3))][0]); // set char1 + waddch(wAliens,ships[frame%2][alienType-1+(3*((level-1)%3))][1]); // set char2 + waddch(wAliens,ships[frame%2][alienType-1+(3*((level-1)%3))][2]); // set char3 + if (alienType > 4) { + *(pAliens + c * ALIENS_MAX_NUMBER_X + k) = (alienType + 1) % 9; + } // todo: what's that? If alien_type > 4 then do a modulo operation??? + } else { + waddstr(wAliens," "); // no alien + } + + } else { + waddstr(wAliens," "); // no aliens at odd rows + } + } + if ((row % 2) == 1) {c++;} // goto next row at alienblock + } +} + + +/** + * initialize bunkers sprites + */ +static void bunkersInit() +{ + wBunkers = newpad(BUNKERHEIGHT, BUNKERWIDTH); // new pad data + wclear(wBunkers); +} + + +/** + * display bunkers sprite + * needs pointer to bunker-array + */ +void bunkersDisplay(int *pBunker) +{ + int l, k; + wclear(wBunkers); + wattrset(wBunkers,COLOR_PAIR(CYAN)); + for (l=0;l", "", "", "< oo>"}; + static int frame = 0; + + wclear(wUfo); + wattrset(wUfo, COLOR_PAIR(MAGENTA)); + waddstr(wUfo, ufo[frame % 4]); + + frame++; +} + + +/** + * initialize ufo sprite + */ +static void ufoInit() +{ + wUfo = newpad(1, UFOWIDTH); // new pad with appropriate size + wclear(wUfo); // clear pad + wattrset(wUfo, COLOR_PAIR(MAGENTA)); // set color +} + + +/** + * display ufo sprite + */ +void ufoDisplay(int x, int y) +{ + copywin(wUfo, wBattleField, 0, 0, y, x, y, x + UFOWIDTH - 1, 0); +} + + +/** + * clear ufo sprite + */ +void ufoClear(int x, int y) +{ + copywin(wEmpty, wBattleField, 0, 0, y, x, y, x + UFOWIDTH - 1, 0); +} + + +/** + * initialize gameover graphic + */ +static void gameOverInit() +{ + // init game-over banner + wGameOver = newpad(13, 31); + wclear(wGameOver); + wattrset(wGameOver, COLOR_PAIR(WHITE)); + waddstr(wGameOver, " "); + waddstr(wGameOver, " ##### #### ## ## ###### "); + waddstr(wGameOver, " ## ## ## ####### ## "); + waddstr(wGameOver, " ## ### ###### ## # ## ##### "); + waddstr(wGameOver, " ## ## ## ## ## ## ## "); + waddstr(wGameOver, " ##### ## ## ## ## ###### "); + waddstr(wGameOver, " "); + waddstr(wGameOver, " #### ## ## ###### ###### "); + waddstr(wGameOver, " ## ## ## ## ## ## ## "); + waddstr(wGameOver, " ## ## ## ## ##### ###### "); + waddstr(wGameOver, " ## ## ## ## ## ## ## "); + waddstr(wGameOver, " #### ### ###### ## ## "); + waddstr(wGameOver, " "); +} + +/** + * display game over graphic + */ +void gameOverDisplay() +{ + int x = (SCREENWIDTH / 2) - (31 / 2); + int y = (SCREENHEIGHT / 2) - (13 / 2); + copywin(wGameOver, wBattleField, 0, 0, y, x, y + 12, x + 30, 0); + wrefresh(wBattleField); +} + + +/** + * initialize title screen + */ +static void titleScreenInit() +{ + wTitleScreen = newpad(SCREENHEIGHT, SCREENWIDTH); + wclear(wTitleScreen); +} + + +/** + * display title screen + */ +void titleScreenDisplay() +{ + static int frame = 0; + int x, y; + int i; + WINDOW *wTitleText; + WINDOW *wAliens; + WINDOW *wStartText; + char ufo[4][6] = {"", "", "", "< oo>"}; + char aliens[2][9][3+1] = { + {",^,", "_O-", "-o-", "o=o", "", "_x_", "*^*", "\\_/", "o o"}, + {".-.", "-O_", "/o\\", "o-o", "", "-x-", "o^o", "/~\\", "oo "} + }; + int score[3] = {200, 150, 100}; + int colors[9] = {RED, GREEN, BLUE, RED, GREEN, BLUE, RED, GREEN, BLUE}; + char buffer[12]; + static int alien_type = 0; + + wTitleText = newpad(4, 41); + wclear(wTitleText); + wattrset(wTitleText, COLOR_PAIR(YELLOW)); + waddstr(wTitleText, " ____ __ "); + waddstr(wTitleText, " ___ / _/__ _ _____ ___/ /__ _______"); + waddstr(wTitleText, " / _ \\_/ // _ \\ |/ / _ `/ _ / -_) __(_-<"); + waddstr(wTitleText, "/_//_/___/_//_/___/\\_,_/\\_,_/\\__/_/ /___/"); + + frame++; + wAliens = newpad(7, 11); + wclear(wAliens); + snprintf(buffer, sizeof(buffer),"%s = 500", ufo[frame % 4]); + wattrset(wAliens, COLOR_PAIR(MAGENTA)); + waddstr(wAliens, buffer); + if ((frame = frame % 60) == 0) { + alien_type = 0; + } else if (frame == 20) { + alien_type = 3; + } else if (frame == 40) { + alien_type = 6; + } + for (i = alien_type; i < alien_type + 3; i++) { + waddstr(wAliens, " "); + snprintf(buffer, sizeof(buffer), "%s = %d", aliens[frame % 2][i], score[i % 3]); + wattrset(wAliens, COLOR_PAIR(colors[i])); + waddstr(wAliens, buffer); + } + + wStartText = newpad(1, 20); + wclear(wStartText); + wattrset(wStartText, COLOR_PAIR(RED)); + waddstr(wStartText, "Press SPACE to start"); + + x = (SCREENWIDTH / 2) - (41 / 2); + y = 0; + copywin(wTitleText, wTitleScreen, 0, 0, y, x, y + 3, x + 40, 0); + + x = (SCREENWIDTH / 2) - (11 / 2); + y = 8; + copywin(wAliens, wTitleScreen, 0, 0, y, x , y + 6, x + 10, 0); + + x = (SCREENWIDTH / 2) - (20 / 2); + y = SCREENHEIGHT - 2; + copywin(wStartText, wTitleScreen, 0, 0, y, x, y, x + 19, 0); + + copywin(wTitleScreen, wBattleField, 0, 0, 0, 0, SCREENHEIGHT-1, SCREENWIDTH-1, 0); + + wrefresh(wBattleField); +} + + +/** + * clear title screen + */ +void titleScreenClear() +{ + battleFieldClear(); +} + + +/** + * initialize scores + */ +void statusInit() +{ + wStatus = newpad(1, 55); + wclear(wStatus); +} + + +/** + * display scores + */ +void statusDisplay(int level, int score, int lives) +{ + int t, xOffset; + char strStatus[55]; + // "Level: 01 Score: 0001450 Lives: /-\ /-\ /-\ /-\ /-\ " + // "1234567890123456789012345678901234567890123456789012" + + + xOffset = (SCREENWIDTH / 2) - 24; + + + + sprintf (strStatus, "Level: %2.2d Score: %2.7d Lives: ", level, score); + + wclear(wStatus); + wattrset(wStatus, COLOR_PAIR(RED)); + waddstr(wStatus, strStatus); + + // show maximal five lives + for (t = 1; ((t <= 5) && (t < lives)); t++){ + waddstr(wStatus, "/-\\ "); + } + + copywin(wStatus, wBattleField, 0, 0, SCREENHEIGHT-1, xOffset, SCREENHEIGHT-1, xOffset + 54, 0); + + +} + + +/** + * initialize battlefield + */ +static void battleFieldInit() +{ + wEmpty = newpad(SCREENHEIGHT, SCREENWIDTH); + wclear(wEmpty); + + wBattleField = newwin(SCREENHEIGHT, SCREENWIDTH, 0, 0); // new window + wclear(wBattleField); // clear window + mvwin(wBattleField, 0, 0); // move window +} + + +/** + * clear battlefield + */ +void battleFieldClear() +{ + copywin(wEmpty,wBattleField,0,0,0,0,SCREENHEIGHT-1,SCREENWIDTH-1,0); +} + + +/** + * refresh screen so that modified graphic buffers get visible + */ +void refreshScreen() +{ + redrawwin(wBattleField); // needed to display graphics properly at startup on some terminals + wrefresh(wBattleField); + +} + + +/** + * do proper cleanup + */ +static void finish(int sig) +{ + endwin(); // reset terminal into proper non-visual mode + exit(0); +} + + +/** + * initialize n_courses + */ +void graphicEngineInit() +{ + (void) signal(SIGINT, finish); // on signal "SIGINT" call method "finish" + (void) initscr(); // do initialization work + keypad(stdscr, TRUE); // enable keypad for input + (void) nonl(); // disable translation return/ newline for detection of return key + (void) cbreak(); // do not buffer typed characters, use at once + (void) noecho(); // do not echo typed characters + start_color(); // use colors + init_pair(RED, COLOR_RED, COLOR_BLACK); // define color-pair + init_pair(GREEN, COLOR_GREEN, COLOR_BLACK); // define color-pair + init_pair(YELLOW, COLOR_YELLOW, COLOR_BLACK); // define color-pair + init_pair(BLUE, COLOR_BLUE, COLOR_BLACK); // define color-pair + init_pair(CYAN, COLOR_CYAN, COLOR_BLACK); // define color-pair + init_pair(MAGENTA, COLOR_MAGENTA, COLOR_BLACK); // define color-pair + init_pair(WHITE, COLOR_WHITE, COLOR_BLACK); // define color-pair + + //timeout(0); // do not wait for input + + // initialize sprites + battleFieldInit(); + playerInit(); + playerMissileInit(); + aliensInit(); + aliensMissileInit(); + bunkersInit(); + ufoInit(); + gameOverInit(); + statusInit(); + titleScreenInit(); +} + diff --git a/games/ninvaders/view.h b/games/ninvaders/view.h new file mode 100644 index 0000000..873585a --- /dev/null +++ b/games/ninvaders/view.h @@ -0,0 +1,78 @@ +/** + * nInvaders - a space invaders clone for ncurses + * Copyright (C) 2002-2003 Dettus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * homepage: http://ninvaders.sourceforge.net + * mailto: ninvaders-devel@lists.sourceforge.net + * + */ + + +#include +#include +#include + +#ifndef VIEW +#define VIEW + +#include "globals.h" + +#define SCREENHEIGHT 24 +#define SCREENWIDTH 80 + +#define PLAYERWIDTH 5 +#define PLAYERPOSY (SCREENHEIGHT-2) + +#define BUNKERWIDTH 80 +#define BUNKERHEIGHT 4 +#define BUNKERX 0 +#define BUNKERY (SCREENHEIGHT-8) + +#define ALIENS_MAX_NUMBER_X 10 +#define ALIENS_MAX_NUMBER_Y 5 + +#define UFOWIDTH 5 +#define UFOPOSY 0 + + +void graphicEngineInit(); + +void aliensClear(int x, int y, int wid, int hgt); +void aliensDisplay(int x, int y, int wid, int hgt); +void aliensMissileClear(int x, int y); +void aliensMissileDisplay(int x, int y); +void aliensRefresh(int level, int *pAliens); +void battleFieldClear(); +void bunkersClear(); +void bunkersClearElement(int x, int y); +void bunkersDisplay(int *pBunker); +void gameOverDisplay(); +void playerClear(int x, int y); +void playerDisplay(int x, int y); +void playerExplosionDisplay(int x, int y); +void playerMissileClear(int x, int y); +void playerMissileDisplay(int x, int y); +void titleScreenClear(); +void titleScreenDisplay(); +void ufoClear(int x, int y); +void ufoDisplay(int x, int y); +void ufoRefresh(); + +void statusDisplay(int level, int score, int lives); +void refreshScreen(); + +#endif -- libgit2 0.21.2