gav-0.9.0/0000755000000000000000000000000010435311430010765 5ustar rootrootgav-0.9.0/ResizeSurface.h0000644000000000000000000000170610355242120013714 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __RESIZESURFACE_H__ #define __RESIZESURFACE_H__ #include SDL_Surface * resizeSurface (SDL_Surface * buf, int width, int height); #endif gav-0.9.0/README0000644000000000000000000000541710361725173011667 0ustar rootrootWelcome to GAV, a GPL rendition of the popular Arcade Volleyball. Some menu items might not be implemtented yet. See CHANGELOG for recent modifications. Keys: default keys are: Left player: z, c and left shift Right player: left, right and up cursor keys. use the arrow keys to navigate the menus, spacebar or enter to activate items, F10 to switch to fullscreen mode while playing. Network Game: One of the programs must function as server. The server determines the parameters of the game (except for the theme, which might be different from client to client). Whatever player the server configures as "Keyboard/Joy" is local to the server, "Computer/Net" players are controlled either by the computer or by a remote client. Starting the server, you specify how many clients will attach: each of them will replace a computer player. This way, you can play in several different ways: a local player against a remote one, a local and AI player against 2 remote ones, an AI player against a local and a remote one... Bear in mind that players 1 and 3 play on the left side, and 2 and 4 on the right side. The client need not select anything about the players: just the side it will play on (left or right). Currently, only one player per client is allowed (while more than one can play on the server). The client's player is always controlled by Player 1's controls. Installing themes: themes default to the /usr/share/games/gav/themes directory, but if a directory ./themes exists, they are looked for in such a directory. This might cause problem if you start GAV from a directory that contains a 'themes' subdirectory, but no classic theme, which is the default. Sounds: Sounds are looked for in the current theme's directory. If no sound is found there, they are looked for in the "default sound" directory, which is the directory "sounds" at the same level as the "themes" directory. Provided with the game by default (as long as theme creators do not come with appropriate sounds for their themes) are the default sounds (two 'whistles' at different pitch indicating the service change and the scoring of a point). Theme creators interesting in setting up sounds, can find the sound filenames, associated with the various events, in the array "sound_fnames", found in SoundMgr.cpp. Thanks: - Marius Andreiana, who provided the gnome menu entry. - Mark Whittington, who provided patches to compile under Win32, and working on an installer. - Fernando "Yisus" Notari, who provided the Yisus, Yisus2 and unnamed themes. - El Fabio, who provided the fabeach theme. - Serge S. Fukanchik for his feedback and his precious aid to increase GAV efficiency. - Aleksander Kam for provinding a useful patch Authors: To contact the authors, please refer to the Sourceforge project page http://www.sourceforge.net/projects/gav gav-0.9.0/ResizeSurface.cpp0000644000000000000000000001123310355242120014243 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * These functions are derived from SDL_buffer. */ #include #include "ResizeSurface.h" typedef struct tColorRGBA { Uint8 r; Uint8 g; Uint8 b; Uint8 a; } tColorRGBA; /* * 32bit Zoomer with optional anti-aliasing by bilinear interpolation. * Zoomes 32bit RGBA/ABGR 'src' surface to 'dst' surface. * Forked from SDL_rotozoom.c, LGPL (c) A. Schiffler */ static int zoomSurfaceRGBA (SDL_Surface * src, SDL_Surface * dst) { int x, y, //current dst->x and dst->y xscale, yscale, //src/dst proportions * 65536 *sx_offset, *sy_offset, //row/columnt increment tables *csx_offset, *csy_offset, //pointers to current row/columnt increment element csx, csy, sgap, dgap; tColorRGBA *sp, *csp, *dp; // Variables setup xscale = (int) (65536.0 * (double) src->w / (double) dst->w); yscale = (int) (65536.0 * (double) src->h / (double) dst->h); // Allocate memory for row increments sx_offset = (int*)malloc((dst->w + 1) * sizeof(Uint32)); sy_offset = (int*)malloc((dst->h + 1) * sizeof(Uint32)); if (sx_offset == NULL || sy_offset == NULL) { free(sx_offset); free(sy_offset); return -1; } // Precalculate row increments csx = 0; csx_offset = sx_offset; for (x = 0; x <= dst->w; x++) { *csx_offset = csx; csx_offset++; csx &= 0xffff; csx += xscale; } csy = 0; csy_offset = sy_offset; for (y = 0; y <= dst->h; y++) { *csy_offset = csy; csy_offset++; csy &= 0xffff; csy += yscale; } // Pointer setup sp = csp = (tColorRGBA *) src->pixels; dp = (tColorRGBA *) dst->pixels; sgap = src->pitch - src->w * 4; dgap = dst->pitch - dst->w * 4; // Switch between interpolating and non-interpolating code // Non-Interpolating Zoom csy_offset = sy_offset; for (y = 0; y < dst->h; y++) { sp = csp; csx_offset = sx_offset; for (x = 0; x < dst->w; x++) { // Draw *dp = *sp; // Advance source pointers csx_offset++; sp += (*csx_offset >> 16); // Advance destination pointer dp++; } // Advance source pointer csy_offset++; csp = (tColorRGBA *) ((Uint8 *) csp + (*csy_offset >> 16) * src->pitch); // Advance destination pointers dp = (tColorRGBA *) ((Uint8 *) dp + dgap); } // Remove temp arrays free(sx_offset); free(sy_offset); return 0; } SDL_Surface * resizeSurface (SDL_Surface * buf, int width, int height) { SDL_PixelFormat * format = buf->format; int dst_w, dst_h; Uint32 Rmask,Gmask,Bmask,Amask; SDL_Surface * dest; SDL_Surface * tmp; bool toFree = false; if (format->BitsPerPixel == 32) { Rmask = format->Rmask; Gmask = format->Gmask; Bmask = format->Bmask; Amask = format->Amask; } else { Rmask = 0x000000ff; Gmask = 0x0000ff00; Bmask = 0x00ff0000; Amask = 0xff000000; } if (format->BitsPerPixel != 32 || format->Rmask != Rmask || format->Gmask != Gmask || format->Bmask != Bmask) { // New source surface is 32bit with defined RGBA ordering. // Note that Amask has been ignored in test tmp = SDL_CreateRGBSurface (SDL_SWSURFACE, buf->w, buf->h, 32, Rmask, Gmask, Bmask, Amask); SDL_BlitSurface (buf, NULL, tmp, NULL); toFree = true; } else tmp = buf; dst_w = width; dst_h = height; // Alloc space to completely contain the zoomed surface // Target surface is 32bit with source RGBA/ABGR ordering // (note that buf->zoom is already NULL) dest = SDL_CreateRGBSurface (SDL_SWSURFACE, width, height, 32, Rmask, Gmask, Bmask, Amask); SDL_LockSurface(tmp); SDL_LockSurface(dest); zoomSurfaceRGBA(tmp, dest); // Turn on source-alpha support SDL_SetAlpha(dest, SDL_SRCALPHA, 255); SDL_UnlockSurface(tmp); SDL_UnlockSurface(dest); if (toFree) SDL_FreeSurface(tmp); // Return destination surface return dest; } gav-0.9.0/Configuration.h0000644000000000000000000001501510361734354013763 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Configuration options */ #include #include #include "aarg.h" #ifndef __CONFIGURATION_H__ #define __CONFIGURATION_H__ #define MAX_PLAYERS (4) #define DEFAULT_FPS (50) #define DEFAULT_WINNING_SCORE (15) #define DEFAULT_BALL_AMPLIFY 5 #define DEFAULT_FRAME_SKIP 0 #define DEFAULT_THEME "classic" #define DEFAULT_FULLSCREEN false #define DEFAULT_SOUND true #define DEFAULT_NPLAYERFRAMES 4 #define DEFAULT_PLAYERSTILLB 1 #define DEFAULT_PLAYERSTILLE 1 #define DEFAULT_PLAYERSTILLP 0 #define DEFAULT_PLAYERRUNB 2 #define DEFAULT_PLAYERRUNE 3 #define DEFAULT_PLAYERRUNP 250 #define DEFAULT_PLAYERJMPB 4 #define DEFAULT_PLAYERJMPE 4 #define DEFAULT_PLAYERJMPP 0 #define DEFAULT_NBALLFRAMES 4 #define DEFAULT_BALLPERIOD 1000 #define BALL_SPEED_INC 3 #define DEFAULT_CONF_FILENAME ".gav" #define ALTERNATIVE_CONF_FILENAME "gav.ini" #define ENVIRONMENT_WIDTH (640) #define ENVIRONMENT_HEIGHT (400) #define BIG_ENVIRONMENT_WIDTH (1000) #define BIG_ENVIRONMENT_HEIGHT (400) enum { PLAYER_NONE, PLAYER_HUMAN, PLAYER_COMPUTER}; enum { MONITOR_NORMAL, MONITOR_OLD, MONITOR_VERYOLD, MONITOR_VERYVERYOLD}; typedef struct PlayerFrameConf_s { unsigned short nPlayerFrames; unsigned short playerStillB; unsigned short playerStillE; unsigned short playerStillP; unsigned short playerRunB; unsigned short playerRunE; unsigned short playerRunP; unsigned short playerJmpB; unsigned short playerJmpE; unsigned short playerJmpP; } PlayerFrameConf_t; typedef struct BallFrameConf_s { unsigned short nBallFrames; unsigned short ballPeriod; } BallFrameConf_t; typedef struct Resolution_s { unsigned short x; unsigned short y; float ratioX; float ratioY; } Resolution_t; typedef struct Environment_s { unsigned short w; unsigned short h; } Environment_t; class Configuration { public: int left_nplayers; int right_nplayers; int left_players[MAX_PLAYERS/2]; int right_players[MAX_PLAYERS/2]; PlayerFrameConf_t playerFrameConf; BallFrameConf_t ballFrameConf; Resolution_t resolution; Resolution_t desiredResolution; Environment_t env; std::string currentTheme; /* Constants that depend on the screen size */ int SCREEN_WIDTH; int SCREEN_HEIGHT; float SPEEDY; int FLOOR_ORD; int SPEED_MULTIPLIER; int NET_X; int NET_Y; int CEILING; int LEFT_WALL; int RIGHT_WALL; int DEFAULT_SPEED; /* To add: something meaningful to record the controls... */ bool sound; int winning_score; int monitor_type; unsigned int frame_skip; // one every frame_skip + 1 are actually drawn unsigned int fps; // fps of the update (not graphical) unsigned int mill_per_frame; // caches the # of msecs per frame (1000/fps) bool bgBig; // if the background is big bool fullscreen; unsigned int ballAmplify; Configuration() : left_nplayers(1), right_nplayers(1), sound(DEFAULT_SOUND), winning_score(DEFAULT_WINNING_SCORE) { monitor_type = MONITOR_NORMAL; frame_skip = DEFAULT_FRAME_SKIP; fps = DEFAULT_FPS; mill_per_frame = 1000 / fps; left_players[0] = PLAYER_HUMAN; right_players[0] = PLAYER_COMPUTER; for ( int i = 1; i < MAX_PLAYERS/2; i++ ) { left_players[i] = PLAYER_NONE; right_players[i] = PLAYER_NONE; } bgBig = false; fullscreen = DEFAULT_FULLSCREEN; ballAmplify = DEFAULT_BALL_AMPLIFY; setDefaultFrameConf(); currentTheme = "classic"; scaleFactors(ENVIRONMENT_WIDTH, ENVIRONMENT_HEIGHT); env.w = ENVIRONMENT_WIDTH; env.h = ENVIRONMENT_HEIGHT; setDesiredResolution(ENVIRONMENT_WIDTH, ENVIRONMENT_HEIGHT); setResolution(ENVIRONMENT_WIDTH, ENVIRONMENT_HEIGHT); } void scaleFactors(int width, int height) { SCREEN_WIDTH = width; SCREEN_HEIGHT = height; SPEEDY = ((float) SCREEN_HEIGHT / 2.5); FLOOR_ORD = SCREEN_HEIGHT -(SCREEN_HEIGHT / 200); NET_X = width / 2 - width / 80; NET_Y = height / 2 + ( 3*height / 200 ); CEILING = (int) (height / 17); LEFT_WALL = (int) (width / 80); RIGHT_WALL = (int) (width - width / 40); DEFAULT_SPEED = (int) (bgBig)?(width/4):(25*width/64); } inline void setResolution(int w, int h) { resolution.x = w; resolution.y = h; resolution.ratioX = (float) resolution.x / (float) env.w; resolution.ratioY = (float) resolution.y / (float) env.h; } inline void setResolutionToDesired() { setResolution(desiredResolution.x, desiredResolution.y); } inline void setDesiredResolution(int w, int h) { desiredResolution.x = w; desiredResolution.y = h; desiredResolution.ratioX = (float) desiredResolution.x / (float) env.w; desiredResolution.ratioY = (float) desiredResolution.y / (float) env.h; } inline void setDefaultFrameConf() { playerFrameConf.nPlayerFrames = DEFAULT_NPLAYERFRAMES; playerFrameConf.playerStillB = DEFAULT_PLAYERSTILLB; playerFrameConf.playerStillE = DEFAULT_PLAYERSTILLE; playerFrameConf.playerStillP = DEFAULT_PLAYERSTILLP; playerFrameConf.playerRunB = DEFAULT_PLAYERRUNB; playerFrameConf.playerRunE = DEFAULT_PLAYERRUNE; playerFrameConf.playerRunP = DEFAULT_PLAYERRUNP; playerFrameConf.playerJmpB = DEFAULT_PLAYERJMPB; playerFrameConf.playerJmpE = DEFAULT_PLAYERJMPE; playerFrameConf.playerJmpP = DEFAULT_PLAYERJMPP; ballFrameConf.nBallFrames = DEFAULT_NBALLFRAMES; ballFrameConf.ballPeriod = DEFAULT_BALLPERIOD; } inline void setFps(int val) { fps = val; mill_per_frame = 1000 / val; } std::string toString(int v) { std::ostringstream os; os << v; return os.str(); } int loadConfiguration(); int saveConfiguration(std::string fname); int createConfigurationFile(); std::string confFileName(); //void scaleFactors(int width, int height); }; #endif gav-0.9.0/build_osx.sh0000755000000000000000000000024410116240626013320 0ustar rootrootrm -rf gav.app mkdir -p gav.app/Contents/MacOS cp gav gav.app/Contents/MacOS echo "APPL????" >gav.app/Contents/PkgInfo cp osx-info.plist gav.app/Contents/Info.plistgav-0.9.0/Ball.h0000644000000000000000000000717210435057207012030 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _BALL_H_ #define _BALL_H_ #include #include #include #include "FrameSeq.h" #include "Team.h" #include "globals.h" #include "Theme.h" #define ELASTIC_SMOOTH (0.8) #define MIN_NET_SPEED (10) //#define NET_X (312) //#define NET_X (configuration.SCREEN_WIDTH / 2 - 8) //#define NET_Y (configuration.SCREEN_HEIGHT /2 + ((3*configuration.SCREEN_HEIGHT)/200)) //#define CEILING_Y 24 //#define LEFT_WALL 7 //#define RIGHT_WALL(bw) (configuration.SCREEN_WIDTH - bw - 16) typedef enum { BALL_ORIG } ball_t; class Ball { private: FrameSeq * _frames; int _speed; float _angle; int _spdx, _spdy; int _x, _y; int _oldx, _oldy; int _frameIdx; int _radius; int _beginning; int _accelY; int _side; int _scorerSide; int _scoredTime; std::map _collisionCount; Player * _inCollisionWith; void loadFrameSeq(ball_t t) { switch (t) { case BALL_ORIG: _frames = new LogicalFrameSeq(CurrentTheme->ball(), configuration.ballFrameConf.nBallFrames); break; } } void assignPoint(int side, Team *t); bool approaching(int spdx, float spdy); // evaluates a collision ("sprite"-wise) bool spriteCollide(Player *p); // evaluate a collision bool collide(Player *p); void update_internal(Player * pl); // void assignPoint(int side, Team *t); bool netPartialCollision(int, int); bool netFullCollision(int, int); inline void update_direction(int ticks) { _spdy -= (_accelY * ticks / 1000); } void resetCollisionCount(); public: Ball(ball_t t, int x = -1, int y = -1) : _x(x), _y(y), _frameIdx(0) { _spdy = 0; _spdx = 0; loadFrameSeq(t); _radius = _frames->width() / 2; //cerr << "radius: " << _radius << endl; _beginning = 0; _accelY = 0; // as soon as the speed becomes <> 0, it becomes 500 _inCollisionWith = NULL; _side = -1; if ( _x < 0 ) _x = (configuration.SCREEN_WIDTH / 2) + ((configuration.SCREEN_WIDTH * _side) / 4) ; if ( _y < 0 ) _y = (configuration.SCREEN_HEIGHT * 2) / 3; _scorerSide = _scoredTime = 0; } void resetPos(int x, int y); inline int speed() { return _speed; } inline void speed(int v) { _speed = v; } inline int x() { return _x; } inline int y() { return _y; } inline int radius() { return _radius; } inline float angle() { return _angle; } inline void angle(float v) { _angle = v; } inline int spdx() { return _spdx; } inline int spdy() { return _spdy; } inline int frame() { return _frameIdx; } inline void setX(int x) { _x = x; } inline void setY(int y) { _y = y; } inline int gravity() { return _accelY; } void updateFrame(int passed); void update(int passed, Team *tleft, Team *tright); float distance(int, int); void draw(SDL_Surface *scr = screen); ~Ball() { delete(_frames); } }; #endif // _BALL_H_ gav-0.9.0/ScreenFont.cpp0000644000000000000000000000403610355262416013554 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include "globals.h" #include "GameRenderer.h" #include "ScreenFont.h" /* Converts to SCREEN coordinates! Should me moved into GameRenderer or something! */ void ScreenFont::printXY(SDL_Surface *dest, SDL_Rect *rect, const char * str, bool wrapAround, FrameSeq *bg) { SDL_Rect r; int _charWid = _frames->screenWidth(); r = gameRenderer->convertCoordinates(rect); r.h = _frames->getActualFrameSeq()->height(); r.w = _frames->getActualFrameSeq()->width(); const char *run = str; while ( *run ) { if ( wrapAround ) //r.x = (r.x + dest->w) % dest->w; r.x = (r.x + configuration.resolution.x) % configuration.resolution.x; if ( ((*run) >= _fst) && ((*run) < (_fst + _nchars)) ) { if ( bg ) bg->getActualFrameSeq()->blitRect(0, dest, &r); _frames->getActualFrameSeq()->blit((int) ((*run) - _fst), dest, &r); } run++; r.x += _charWid; } } void ScreenFont::printRow(SDL_Surface *dest, int row, const char *str, FrameSeq *bg) { SDL_Rect rect; /* draw menu items labels */ rect.y = configuration.CEILING + configuration.env.h/100 + row * charHeight(); rect.x = (configuration.env.w / 2) - strlen(str)*(charWidth())/2; printXY(dest, &rect, str, false, bg); } gav-0.9.0/CHANGELOG0000644000000000000000000000347510435076270012222 0ustar rootrootCurrent CVS: - successfully compiled on Mac OS X, files for build added - preferences are stored to $HOME/.gav if $HOME exists, to ./gav.ini otherwise. - size of the window can be set by the -w and -h commandline parameters - joystick support - a couple of leaks removed from the code - now network game with different themes works correctly - network connection phase no longer blocking - the network protocol has changed! no longer compatible with old versions Version 0.8.0 changes: - (we hope) *FINAL* patch for stuck on the net problem - patch for ball passing over the net bug - collision mechanisms improved - sound support added (sounds can be found in theme packages) - Players classes hierarchy re-designed - AI Player improved - added default service change and scoring sounds. Version 0.7.3 added: - patch for stuck on the net problem - advanced themes configuration support (check the naive theme for an example) Version 0.7.2 added: - char specified as signed (for other architectures than x86) - ball speed selectable Version 0.7.1 added: - lots of bugs fixed (collisions, etc.) - AI improved in multiplayer mode Version 0.7.0 added: - Networking game, in client/server mode - modified collisions - several themes provided by friendly users - selectable "larger" background - adjustable frame rate and frame skip values - configurable end score - vintage monitor effect (works ok only with the default theme) Version 0.6.0 added: - Theme support via the 'Extra' menu entry Only a silly modification of the classic theme is available so far, if you are interested in developing more, please do, and let us know! - Keys redefinition works - You can now activate menu items using the enter key (wow!) - You can play more than one-a-side. Cooperative games are supported. - Fullscreen can now be triggered via a menu entry gav-0.9.0/automa/0000755000000000000000000000000010435311427012261 5ustar rootrootgav-0.9.0/automa/StatePlaying.h0000644000000000000000000000251010435074633015041 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _STATEPLAYING_H_ #define _STATEPLAYING_H_ #include "State.h" #include "InputState.h" #include "Team.h" #include "Ball.h" #include "StateWithInput.h" class StatePlaying : public State, public StateWithInput { private: Team *tl, *tr; // team left and team right Ball *b; unsigned int prevDrawn; public: StatePlaying() : prevDrawn(0) {} virtual int execute(InputState *is, unsigned int ticks, unsigned int prevTicks, int firstTime); private: int setupConnection(InputState *is); }; #endif // _STATEPLAYING_H_ gav-0.9.0/automa/Makefile.cross.w320000644000000000000000000000226707616576232015510 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. RELPATH = automa include ../CommonHeader NAME = automa CXXFLAGS += -I$(GAV_ROOT) -I$(GAV_ROOT)/menu -I$(GAV_ROOT)/net -I$(GAV_ROOT)/automa DEPEND = Makefile.depend .PHONY: all all: $(OFILES) ($OFILES): $(SRCS) $(CXX) -c $(CXXFLAGS) $< clean: rm -f *.o *.bin *~ $(DEPEND) depend: $(RM) $(DEPEND) $(CXX) $(CXXFLAGS) -M $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/automa/StateClient.h0000644000000000000000000000252607757431461014674 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _STATECLIENT_H_ #define _STATECLIENT_H_ #include "State.h" #include "StateWithInput.h" #include "InputState.h" #include "Team.h" #include "Ball.h" class StateClient : public State, public StateWithInput { private: Team *tl, *tr; // team left and team right Ball *b; unsigned int prevDrawn; int _lp, _rp; public: StateClient() : prevDrawn(0) {} virtual int execute(InputState *is, unsigned int ticks, unsigned int prevTicks, int firstTime); private: int setupConnection(InputState *is); }; #endif // _STATEPLAYING_H_ gav-0.9.0/automa/StateWithInput.h0000644000000000000000000000363410435074633015401 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __STATENET_H__ #define __STATENET_H__ #include #include "AutomaMainLoop.h" #include class StateWithInput { public: StateWithInput() {} std::string deleteOneChar(std::string s) { if ( s.length() < 1 ) return(s); char s2[s.length()]; strncpy(s2, s.c_str(), s.length() - 1); s2[s.length() - 1] = 0; return(std::string(s2)); } short getKeyPressed(InputState *is, bool blocking = true) { SDL_keysym keysym; SDL_Event event; while ( 1 ) { if (!blocking && (!SDL_PollEvent(NULL))) return -1; if ( (event = is->getEventWaiting()).type != SDL_KEYDOWN ) { continue; } keysym = event.key.keysym; while ( is->getEventWaiting().type != SDL_KEYUP ); char *kn = SDL_GetKeyName(keysym.sym); // printf("\"%s\"\n", kn); if ( strlen(kn) == 1 ) return((signed char)(*kn)); else if ( !strcmp(kn, "return") ) return(SDLK_RETURN); else if ( !strcmp(kn, "backspace") ) return(SDLK_BACKSPACE); else if ( !strcmp(kn, "escape") ) return(SDLK_ESCAPE); else continue; } return -1; } }; #endif gav-0.9.0/automa/AutomaMainLoop.h0000644000000000000000000000235007616576232015335 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include "Automa.h" #include "InputState.h" #include "globals.h" #ifndef _AUTOMAMAINLOOP_H_ #define _AUTOMAMAINLOOP_H_ enum { STATE_MENU = 1, // navigate menu tree STATE_PLAYING, // play the game STATE_CLIENT // start the game as a client }; class AutomaMainLoop : public Automa { private: InputState *_is; int transition(int retval); public: AutomaMainLoop(); virtual int start(); }; #endif gav-0.9.0/automa/Makefile.Linux0000644000000000000000000000243407616576232015040 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. RELPATH = automa include ../CommonHeader NAME = automa MODULE_NAME = $(NAME)_module.o CXXFLAGS += -I$(GAV_ROOT) -I$(GAV_ROOT)/menu -I$(GAV_ROOT)/net -I$(GAV_ROOT)/automa DEPEND = Makefile.depend .PHONY: all all: $(MODULE_NAME) $(MODULE_NAME): $(OFILES) $(LD) -r $(OFILES) -o $(MODULE_NAME) ($OFILES): $(SRCS) $(CXX) -c $(CXXFLAGS) $< clean: rm -f *.o *.bin *~ $(DEPEND) depend: $(RM) $(DEPEND) $(CXX) $(CXXFLAGS) -M $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/automa/Makefile0000644000000000000000000000243407616576232013742 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. RELPATH = automa include ../CommonHeader NAME = automa MODULE_NAME = $(NAME)_module.o CXXFLAGS += -I$(GAV_ROOT) -I$(GAV_ROOT)/menu -I$(GAV_ROOT)/net -I$(GAV_ROOT)/automa DEPEND = Makefile.depend .PHONY: all all: $(MODULE_NAME) $(MODULE_NAME): $(OFILES) $(LD) -r $(OFILES) -o $(MODULE_NAME) ($OFILES): $(SRCS) $(CXX) -c $(CXXFLAGS) $< clean: rm -f *.o *.bin *~ $(DEPEND) depend: $(RM) $(DEPEND) $(CXX) $(CXXFLAGS) -M $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/automa/AutomaMainLoop.cpp0000644000000000000000000000507610117352721015661 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include "AutomaMainLoop.h" #include "InputState.h" #include "globals.h" #include "StateMenu.h" #include "StatePlaying.h" #include "MenuItemFullScreen.h" #ifndef NONET #include "StateClient.h" #endif AutomaMainLoop::AutomaMainLoop() { _is = new InputState(); StateMenu *sm = new StateMenu(); addState(STATE_MENU, sm); _curr = STATE_MENU; StatePlaying *sp = new StatePlaying(); addState(STATE_PLAYING, sp); #ifndef NONET StateClient *sc = new StateClient(); addState(STATE_CLIENT, sc); #endif _prev = -1; } int AutomaMainLoop::transition(int retval) { if ( retval == NO_TRANSITION ) return(_curr); #if 0 switch ( _curr ) { case STATE_MENU: return STATE_PLAYING; break; case STATE_PLAYING: return STATE_MENU; break; #ifndef NONET case STATE_CLIENT: return STATE_MENU; break; #endif } #endif return retval; // _curr; } int AutomaMainLoop::start() { unsigned int prevTicks = 0; // unsigned int prevDrawn = 0; unsigned int frames = 0; unsigned int milliseconds; while ( 1 ) { int ticks = SDL_GetTicks(); if ( prevTicks == 0 ) { prevTicks = ticks; continue; } frames++; milliseconds += ticks - prevTicks; if ( milliseconds >= 1000 ) frames = milliseconds = 0; _is->getInput(); if ( _is->getF()[9] ) { std::stack s; MenuItemFullScreen().execute(s); } // execute the _curr state's code, and transact int retval = _states[_curr]->execute(_is, ticks, prevTicks, (_prev != _curr)); _prev = _curr; _curr = transition(retval); if ( (ticks - prevTicks) < configuration.mill_per_frame ) SDL_Delay(configuration.mill_per_frame - (ticks - prevTicks)); prevTicks = ticks; } return(0); } gav-0.9.0/automa/StateMenu.h0000644000000000000000000000364710355242121014344 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __STATEMENU_H__ #define __STATEMENU_H__ #include #include "globals.h" #include "State.h" #include "Automa.h" #include "MenuRoot.h" #include "Menu.h" #include "MenuItem.h" #include "MenuItemSubMenu.h" #include "MenuItemPlay.h" #include "MenuItemExit.h" #include "MenuItemNotImplemented.h" #include "SoundMgr.h" class StateMenu : public State { private: MenuRoot *_mr; public: StateMenu() { _mr = mroot; }; int execute(InputState *is, unsigned int ticks, unsigned int prevTicks, int firstTime) { static int lastExec = ticks; #ifdef AUDIO if ( firstTime ) soundMgr->playSound(SND_BACKGROUND_MENU, true); #endif // AUDIO if ( (ticks - lastExec) > 50 ) { SDL_Rect r; r.x = r.y = 0; r.h = background->height(); r.w = background->width(); background->blit(0, screen, &r); //SDL_BlitSurface(background, &r, screen, &r); int ret = _mr->execute(is); SDL_Flip(screen); lastExec = ticks; return(ret); } if ( is->getF()[0] ) { return(NO_TRANSITION + 1); } return(NO_TRANSITION); } }; #endif // __STATEMENU_H__ gav-0.9.0/automa/State.h0000644000000000000000000000251007551664610013522 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _STATE_H_ #define _STATE_H_ #include #include #include "InputState.h" class State { public: std::string _name; // for debug State() {}; inline void setName(char *name) { _name = std::string(name); } inline std::string getName() { return(_name); } virtual int execute(InputState *is, unsigned int ticks, unsigned int prevticks, int firstTime) { std::cout << "unextended state: " << _name << std::endl; return(0); // NO_TRANSITION }; virtual ~State() {}; }; #endif // _STATE_H_ gav-0.9.0/automa/StatePlaying.cpp0000644000000000000000000001477110435074633015410 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include "StatePlaying.h" #include "Automa.h" #include "AutomaMainLoop.h" #ifndef NONET #include "NetServer.h" #endif #include "StateWithInput.h" using namespace std; int StatePlaying::setupConnection(InputState *is) { #ifndef NONET std::string clinumb = ""; int nclients = 0; signed char ch; //nets = new NetServer(); /* first, delete the screen... */ SDL_Rect r; r.x = r.y = 0; r.h = background->height(); r.w = background->width(); //SDL_BlitSurface(background, &r, screen, &r); background->blit(0, screen, &r); SDL_Flip(screen); /* now, ask for the port to listen on */ char msg[100]; string ports = ""; int port; sprintf(msg, "What port to listen on? [%d]", SERVER_PORT); cga->printRow(screen, 0, msg); SDL_Flip(screen); while ( (ch = getKeyPressed(is)) != SDLK_RETURN ) { if ( ch == SDLK_BACKSPACE ) { ports = deleteOneChar(ports); // should be backspace... cga->printRow(screen, 1, " ", background); } else { char w[2]; w[0] = (char)ch; w[1] = 0; ports = ports + w; } cga->printRow(screen, 1, ports.c_str(), background); SDL_Flip(screen); } port = atoi(ports.c_str()); if ( !port ) port = SERVER_PORT; cga->printRow(screen, 2, "How many clients to wait? [1]"); SDL_Flip(screen); while ( (ch = getKeyPressed(is)) != SDLK_RETURN ) { if ( ch == SDLK_BACKSPACE ) { clinumb = deleteOneChar(clinumb); // should be backspace... cga->printRow(screen, 3, " ", background); } else { char w[2]; w[0] = (char)ch; w[1] = 0; clinumb = clinumb + w; } cga->printRow(screen, 3, clinumb.c_str(), background); SDL_Flip(screen); } nclients = atoi(clinumb.c_str()); if ( !nclients ) nclients = 1; nets->StartServer(port); cga->printRow(screen, 4, "Server OK. Waiting for clients...", background); SDL_Flip(screen); int remaining = nclients; do { remaining = nets->WaitClients(is, remaining); char msg[100]; sprintf(msg, " %d connection(s) to go ", remaining); cga->printRow(screen, 5, msg, background); SDL_Flip(screen); } while ( remaining > 0 ); return remaining; #else //!NONET return 0; #endif } // executes one step of the game's main loop // Returns NO_TRANSITION if the game continues, the next state otherwise int StatePlaying::execute(InputState *is, unsigned int ticks, unsigned int prevTicks, int firstTime) { if ( firstTime ) { #ifndef NONET if ( nets ) { if (setupConnection(is) < 0) { delete(nets); nets = NULL; return(STATE_MENU); } } #endif #ifdef AUDIO soundMgr->stopSound(SND_BACKGROUND_MENU); soundMgr->playSound(SND_BACKGROUND_PLAYING, true); #endif /* First time we change to execute state: we should probably create players here instead of in the constructor, and think of a clever way to destroy them once we're done. */ prevDrawn = ticks; tl = new Team(-1); tr = new Team(1); b = new Ball(BALL_ORIG); for ( int i = 0, j = 0; i < configuration.left_nplayers; j++ ) { if ( configuration.left_players[j] == PLAYER_NONE ) { continue; } string name = "Pippo-" + j; if ( configuration.left_players[j] == PLAYER_HUMAN ) { tl->addPlayerHuman(name.c_str(), PL_TYPE_MALE_LEFT); } else { #ifndef NONET if (!nets || !(nets->isRemote(j*2))) #endif tl->addPlayerAI(name.c_str(), PL_TYPE_MALE_LEFT, b); #ifndef NONET else tl->addPlayerRemote(name.c_str(), PL_TYPE_MALE_LEFT); #endif } i++; } for ( int i = 0, j = 0; i < configuration.right_nplayers; j++ ) { if ( configuration.right_players[j] == PLAYER_NONE ) { continue; } string name = "Pluto-" + j; if ( configuration.right_players[j] == PLAYER_HUMAN ) { tr->addPlayerHuman(name.c_str(), PL_TYPE_MALE_RIGHT); } else { #ifndef NONET if (!nets || !(nets->isRemote(j*2+1))) #endif tr->addPlayerAI(name.c_str(), PL_TYPE_MALE_RIGHT, b); #ifndef NONET else tr->addPlayerRemote(name.c_str(), PL_TYPE_MALE_RIGHT); #endif } i++; } tl->setScore(0); tr->setScore(0); b->resetPos((int) (configuration.SCREEN_WIDTH * 0.25), (int) (configuration.SCREEN_HEIGHT * 0.66)); } controlsArray->setControlsState(is, tl, tr); if ( is->getKeyState()[SDLK_ESCAPE] ) { delete(tl); delete(tr); delete(b); #ifndef NONET if ( nets ) { delete(nets); nets = NULL; } #endif #ifdef AUDIO soundMgr->stopSound(SND_BACKGROUND_PLAYING); #endif return(STATE_MENU); } tl->update(ticks - prevTicks, controlsArray); tr->update(ticks - prevTicks, controlsArray); b->update(ticks - prevTicks, tl, tr); if ( (ticks - prevDrawn) > (unsigned int) (FPS - (FPS / (configuration.frame_skip + 1)) ) ) { SDL_Rect r; r.x = r.y = 0; r.h = background->height(); r.w = background->width(); //SDL_BlitSurface(background, &r, screen, &r); background->blit(0, screen, &r); tl->draw(); tr->draw(); b->draw(); #ifndef NONET if (nets) nets->SendSnapshot(tl, tr, b); #endif SDL_Flip(screen); prevDrawn = ticks; } if ( ((tl->getScore() >= configuration.winning_score) && (tl->getScore() > (tr->getScore()+1))) || ((tr->getScore() >= configuration.winning_score) && (tr->getScore() > (tl->getScore()+1))) ) { #ifdef AUDIO soundMgr->playSound(SND_VICTORY); #endif // AUDIO /* Deallocate teams, ball and players */ delete(tl); delete(tr); delete(b); #ifndef NONET if ( nets ) { delete(nets); nets = NULL; } #endif #ifdef AUDIO soundMgr->stopSound(SND_BACKGROUND_PLAYING); #endif return(STATE_MENU); // end of game } return(NO_TRANSITION); } gav-0.9.0/automa/Automa.h0000644000000000000000000000260007616576230013672 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _AUTOMA_H_ #define _AUTOMA_H_ #include #include "State.h" #define NO_TRANSITION (0) class Automa { protected: State *_states[100]; // max 100 states int _curr; // current state index int _prev; int _size; public: Automa() { _size = 0; for ( int i = 0; i < 100; _states[i++] = NULL ); }; virtual int addState(int idx, State *state) { _states[idx] = state; return(_size++); } virtual int start() { return(0); } virtual ~Automa() { for ( int i = 0; i < 100; i++ ) if ( _states[i] ) delete(_states[i]); } }; #endif // _AUTOMA_H_ gav-0.9.0/automa/StateClient.cpp0000644000000000000000000001452510435075340015214 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include "StateClient.h" #include "AutomaMainLoop.h" #ifndef NONET #include "NetClient.h" #endif //NONET using namespace std; int StateClient::setupConnection(InputState *is) { #ifndef NONET bool configured = false; string saddress = ""; signed char ch; string ports = ""; int port; char ti; while ( !configured ) { /* first, delete the screen... */ SDL_Rect r; r.x = r.y = 0; r.h = background->height(); r.w = background->width(); background->blit(0, screen, &r); //SDL_BlitSurface(background, &r, screen, &r); SDL_Flip(screen); /* now, ask for server address, port and team side */ cga->printRow(screen, 0, "Please type server address"); SDL_Flip(screen); while ( (ch = getKeyPressed(is)) != SDLK_RETURN ) { if ( ch == SDLK_BACKSPACE ) { saddress = deleteOneChar(saddress); // should be backspace... cga->printRow(screen, 1, " ", background); } else { char w[2]; w[0] = (char)ch; w[1] = 0; saddress = saddress + w; } cga->printRow(screen, 1, saddress.c_str(), background); SDL_Flip(screen); } char msg[100]; sprintf(msg, "Please type port number [%d]", SERVER_PORT); cga->printRow(screen, 2, msg); SDL_Flip(screen); while ( (ch = getKeyPressed(is)) != SDLK_RETURN ) { if ( ch == SDLK_BACKSPACE ) { ports = deleteOneChar(ports); // should be backspace... cga->printRow(screen, 3, " ", background); } else { char w[2]; w[0] = (char)ch; w[1] = 0; ports = ports + w; } cga->printRow(screen, 3, ports.c_str(), background); SDL_Flip(screen); } port = atoi(ports.c_str()); if ( !port ) port = SERVER_PORT; string team = ""; cga->printRow(screen, 4, "Left or right team? (l/r)"); SDL_Flip(screen); while ( (ch = getKeyPressed(is)) != SDLK_RETURN ) { if ( ch == SDLK_BACKSPACE ) { team = deleteOneChar(team); // should be backspace... cga->printRow(screen, 5, " ", background); } else { char w[2]; w[0] = (char)ch; w[1] = 0; team = team + w; } cga->printRow(screen, 5, team.c_str(), background); SDL_Flip(screen); } ti = (*(team.c_str())=='l')?NET_TEAM_LEFT:NET_TEAM_RIGHT; configured = true; } netc = new NetClient(); cga->printRow(screen, 6, "connecting..."); SDL_Flip(screen); if ( netc->ConnectToServer(is, &_lp, &_rp, ti, saddress.c_str(), port) == -1 ) { delete(netc); cga->printRow(screen, 7, "host unreachable"); SDL_Flip(screen); SDL_Delay(1000); netc = NULL; return(STATE_MENU); } cga->printRow(screen, 7, "connected. Waiting for other clients..."); SDL_Flip(screen); /* ok, I'm connected and I'm waiting for the game start */ netc->WaitGameStart(); #endif //!NONET return(0); } // executes one step of the game's main loop for a network client. // before the game loop actually begins, connection must be set up // Returns NO_TRANSITION if the game continues, the next state otherwise int StateClient::execute(InputState *is, unsigned int ticks, unsigned int prevTicks, int firstTime) { #ifndef NONET if ( firstTime ) { int ret = 0; if ( (ret = setupConnection(is)) ) return(ret); #ifdef AUDIO soundMgr->stopSound(SND_BACKGROUND_MENU); soundMgr->playSound(SND_BACKGROUND_PLAYING, true); #endif // AUDIO /* First time we change to execute state: we should probably create players here instead of in the constructor, and think of a clever way to destroy them once we're done. */ prevDrawn = ticks; tl = new Team(-1); tr = new Team(1); b = new Ball(BALL_ORIG); for ( int j = 0; j < _lp; j++ ) { string name = "Pippo-" + j; Player * pl = tl->addPlayerHuman(name.c_str(), PL_TYPE_MALE_LEFT); pl->setState(PL_STATE_STILL, true); } for ( int j = 0; j < _rp; j++ ) { string name = "Pluto-" + j; Player * pl = tr->addPlayerHuman(name.c_str(), PL_TYPE_MALE_RIGHT); pl->setState(PL_STATE_STILL, true); } tl->setScore(0); tr->setScore(0); b->resetPos((int) (configuration.SCREEN_WIDTH * 0.25), (int) (configuration.SCREEN_HEIGHT * 0.66)); } if ( is->getKeyState()[SDLK_ESCAPE] ) { delete(tl); delete(tr); delete(b); delete(netc); netc = NULL; #ifdef AUDIO soundMgr->stopSound(SND_BACKGROUND_PLAYING); #endif return(STATE_MENU); } controlsArray->setControlsState(is, tl, tr); triple_t input = controlsArray->getCommands(0); netc->SendCommand((input.left?CNTRL_LEFT:0)| (input.right?CNTRL_RIGHT:0)| (input.jump?CNTRL_JUMP:0)); while ( netc->ReceiveSnapshot(tl, tr, b, ticks - prevTicks) != -1 ); if ( (ticks - prevDrawn) > (unsigned int) (FPS - (FPS / (configuration.frame_skip + 1)) ) ) { SDL_Rect r; r.x = r.y = 0; r.h = background->height(); r.w = background->width(); //SDL_BlitSurface(background, &r, screen, &r); background->blit(0, screen, &r); tl->draw(); tr->draw(); b->draw(); SDL_Flip(screen); prevDrawn = ticks; } if ( ((tl->getScore() >= configuration.winning_score) && (tl->getScore() > (tr->getScore()+1))) || ((tr->getScore() >= configuration.winning_score) && (tr->getScore() > (tl->getScore()+1))) ) { /* Deallocate teams, ball and players */ delete(tl); delete(tr); delete(b); delete(netc); netc = NULL; #ifdef AUDIO soundMgr->stopSound(SND_BACKGROUND_PLAYING); #endif return(STATE_MENU); // end of the game } #endif // !NONET return(NO_TRANSITION); } gav-0.9.0/GameRenderer.cpp0000644000000000000000000000256610355262416014054 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include "GameRenderer.h" using namespace std; GameRenderer * gameRenderer = NULL; SDL_Rect GameRenderer::convertCoordinates(SDL_Rect *rect) { // Compute the actual coordinates in the display realm SDL_Rect r; r.x = (int) round(rect->x * _ratioX); r.y = (int) round(rect->y * _ratioY); r.w = (int) round(rect->w * _ratioX); r.h = (int) round(rect->h * _ratioY); return r; } void GameRenderer::display(SDL_Surface *dest, SDL_Rect *rect, FrameSeq *what, int frame) { SDL_Rect r = convertCoordinates(rect); what->blit(frame, dest, &r); } gav-0.9.0/Makefile.cross.w320000644000000000000000000000312307620743552014206 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. include CommonHeader ROOT= SUBDIRS = menu automa net CXXFLAGS += $(foreach DIR, $(SUBDIRS), -I$(DIR)) -I. -Dmain=SDL_main SUBDIRS_SRCS = $(foreach DIR, $(SUBDIRS), $(wildcard $(DIR)/*.cpp)) ALL_OBJ = $(SUBDIRS_SRCS:%.cpp=%.o) DEPEND = Makefile.depend .PHONY: depend clean all $(SUBDIRS) all: $(SUBDIRS) gav.exe $(SUBDIRS): $(MAKE) -C $@ gav.exe: $(ALL_OBJ) $(OFILES) $(CXX) -o gav.exe $(OFILES) $(ALL_OBJ) $(LDFLAGS) strip gav.exe clean: for i in $(SUBDIRS) ; do \ $(MAKE) -C $$i clean;\ done rm -f *~ *.o gav gav.exe $(DEPEND) bindist: all for i in $(SUBDIRS) ; do \ $(MAKE) -C $$i clean;\ done rm -f *~ *.o depend: for i in $(SUBDIRS) ; do \ $(MAKE) -C $$i depend;\ done $(RM) $(DEPEND) $(CXX) -M $(CXXFLAGS) $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/Sound.cpp0000644000000000000000000000434407722666621012612 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "Sound.h" #include #ifdef AUDIO int Sound::loadAndConvertSound(const char *filename, SDL_AudioSpec *spec,sound_p sound) { SDL_AudioCVT cvt; SDL_AudioSpec loaded; Uint8 *new_buf; // printf("loading sound: %s\n", filename); if(SDL_LoadWAV(filename, &loaded,&sound->samples, &sound->length)==NULL) { printf("Cannot load the wav file %s\n", filename); return 1; } if (SDL_BuildAudioCVT(&cvt, loaded.format, loaded.channels,loaded.freq,spec->format, spec->channels,spec->freq)<0) { printf("Cannot convert the sound file %s\n", filename); } cvt.len =sound->length; new_buf = (Uint8 *) malloc(cvt.len*cvt.len_mult); memcpy(new_buf,sound->samples,sound->length); cvt.buf = new_buf; if(SDL_ConvertAudio(&cvt)<0) { printf("Audio conversion failed for file %s\n", filename); free(new_buf); SDL_FreeWAV(sound->samples); return 1; } SDL_FreeWAV(sound->samples); sound->samples = new_buf; sound->length = sound->length * cvt.len_mult; return 0; } int Sound::playSound(bool loop) { int i; for(i=0;i #include #include extern SDL_Surface *screen; class FrameSeq { protected: SDL_Surface * _surface; int _nframes; int _width; int _height; void setSurfaceAndFrames(SDL_Surface *sfc, int nframes, bool useAlpha) { _surface = SDL_DisplayFormat(sfc); if ( useAlpha ) SDL_SetColorKey(_surface, SDL_SRCCOLORKEY, (Uint32) SDL_MapRGB(screen->format, 0, 0, 0)); SDL_FreeSurface(sfc); _nframes = nframes; _width = _surface->w / _nframes; _height = _surface->h; } public: FrameSeq (const char * filename, int nframes, bool useAlpha) { SDL_Surface * temp; if ((temp = IMG_Load(filename)) == NULL) { fprintf(stderr, "FrameSeq: cannot load %s\n", filename); exit(-1); } setSurfaceAndFrames(temp, nframes, useAlpha); } FrameSeq(SDL_Surface *sfc, int nframes, bool useAlpha) { setSurfaceAndFrames(sfc, nframes, useAlpha); } virtual ~FrameSeq() { SDL_FreeSurface(_surface); } virtual SDL_Surface *surface() { return _surface; } inline int width() { return _width; } inline int height() { return _height; } /* Blits an entire frame to screen */ virtual void blit(int idx, SDL_Surface * dest, SDL_Rect * rect); /* Blits part of a frame to screen */ void blitRect(int idx, SDL_Surface * dest, SDL_Rect * rect); bool collidesWith(FrameSeq *fs, int idx1, int idx2, SDL_Rect * rect1, SDL_Rect * rect2); virtual FrameSeq *getActualFrameSeq() { return this; } // bit ugly virtual int screenWidth() { return _width; } // bit ugly }; #endif gav-0.9.0/PlayerAI.cpp0000644000000000000000000001641710354241762013162 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "PlayerAI.h" #include "Ball.h" #define JUMP_LIMIT ( (int) (configuration.SCREEN_HEIGHT / 1.82) ) #define JUMPING_TIME ( 150 ) #define NEWPL_SIDE (-1) triple_t PlayerAI::planAction() { int jmp = 0; //int i; int side = (team())->side(); int nplrs = (team())->nplayers(); int px, bx, fs, mp, bsx, net, wall, xt, xs; /* Normalized values */ int mypos, minslot, maxslot; float slotsize; int move, pw; triple_t ret; int ttime; net = fs = abs(maxX() - minX()); wall = 0; mp = fs/2; /* Normalize player x position, ball x position and ball x speed: Reasoning as it plays on the left, net=fs, wall=0 */ px = (side>0)?(maxX()-x()-width()/2): (x()+width()/2-minX()); pw = width(); bx = (side>0)?(maxX()-(_b->radius()+_b->x())): (_b->radius()+_b->x()-minX()); bsx = -side*_b->spdx(); xs = bx; /* if ( (_y > _highestpoint) ){ printf("_y: %d, hp: %d\n",_y, _highestpoint); _highestpoint = _y; }*/ if ( !_b->gravity() ) { xt = (side>0)?(maxX()-(_b->radius()/2+_b->x())): (_b->radius()/2+_b->x()-minX()); } else { //xt = bx; /* The old one int exp_y = _b->y(); int exp_x = _b->x(); int sx = _b->spdx(); int sy = _b->spdy(); // printf("I(%d,%d) -> (%d,%d)\n",exp_x,exp_y,sx,sy); ttime=0; while (exp_y < 240) { int passed=20; int px = exp_x; int py = exp_y; ttime += passed; exp_x += (int)(sx * ((float) passed/1000.0)); exp_y -= (int)(sy * ((float) passed/1000.0)); sy = (int)(sy-((float) passed*_b->gravity()/1000.0)); if ( exp_y < configuration.CEILING ) { exp_y = configuration.CEILING; sy = - (int ) (sy*ELASTIC_SMOOTH); } if ( exp_x < configuration.LEFT_WALL ) { exp_x = configuration.LEFT_WALL; sx = - (int ) (sx*ELASTIC_SMOOTH); } if ( exp_x > configuration.RIGHT_WALL - (_b->radius()*2) ) { exp_x = configuration.RIGHT_WALL - (_b->radius()*2); sx = - (int ) (sx*ELASTIC_SMOOTH); } int minx = (exp_x < px)?exp_x:px; if ( (minx > (configuration.NET_X-_b->radius()*2)) && ( minx < configuration.NET_X ) ) { /* The ball crossed the net region */ if ( ( exp_y > configuration.NET_Y ) || ( py > configuration.NET_Y ) ) { /* Probably the ball will hit the net, consider a full collision */ exp_x = (minx == exp_x)?configuration.NET_X-_b->radius()*2:configuration.NET_X; sx = - (int ) (sx*ELASTIC_SMOOTH); if (!sx) sx = side*20;/*SMALL_SPD_X*/ } } // printf("+(%d,%d) -> (%d,%d)\n", exp_x, exp_y, sx, sy); } xt = exp_x+_b->radius(); xt = (side>0)?(maxX()-xt):(xt-minX()); // printf("Expected X: %d (bsx: %d, bsy: %d, bx: %d, by: %d (radius: %d, rw:%d, hp: %d)\n",xt, _b->spdx(), _b->spdy(), _b->x(), _b->y(), _b->radius(), RIGHT_WALL(2*_b->radius()),_highestpoint); // printf("HP: %d\n"u, _highestpoint); } //Expected X: 80061 (bsx: -624, bsy: 679, bx: 455, by: 241 (radius: 25) slotsize = net/nplrs; if (nplrs > 1) { std::vector plv = (team())->players(); /* Look for my id */ std::vector::iterator it; int myidx = orderInField(), i; /* If nobody set the Order In Field I will do for all the team */ if (orderInField() < 0) { for ( it = plv.begin(), i=0; it != plv.end(); it++,i++ ) (*it)->setOIF(i); myidx = orderInField(); } mypos = (int)(slotsize*(myidx+0.5)); Player *closerp; int minxsearching = net, minopx, opx, closer; for ( it = plv.begin(); it != plv.end(); it++ ) { opx = (side>0)?((*it)->maxX()-(*it)->x()-(*it)->width()/2): ((*it)->x()+(*it)->width()/2-(*it)->minX()); if ( ( (*it)->id() != id() ) && ( abs(opx-mypos) < minxsearching ) ){ closer=(*it)->id(); closerp=(*it); minxsearching=abs(opx-mypos); minopx=opx; } } /* Someone is inside my slot over the 15% the slot size */ if (minxsearching < (slotsize*0.35)) { myidx = closerp->orderInField(); closerp->setOIF(orderInField()); setOIF(myidx); } mypos = (int )(slotsize*(myidx+0.5)); minslot = (int )(slotsize*myidx); maxslot = (int )(slotsize*(myidx+1)); } else { minslot = wall; mypos = mp-50; // behind the middle point maxslot = net; } /* My rest position has been chosen, and the slot determined */ // int hd = 3*_b->radius()/4; int hd = (_b->radius()+width())/2; int minhd = 0; if ( !_b->gravity() ) { if (hd/2 >= 12) minhd = rand()%(hd/2-10)+10; hd = rand()%(hd-minhd)+minhd+1; } /* When I consider closer, is the closer to the falling point */ /* I care whether I'm the closer only when it's "service time" */ int closest = 1; if ( !_b->gravity() ) { int opx; std::vector plv = (team())->players(); /* Look for my id */ std::vector::iterator it; for ( it = plv.begin(); it != plv.end(); it++ ) { opx = (side>0)?((*it)->maxX()-(*it)->x()-(*it)->width()/2): ((*it)->x()+(*it)->width()/2-(*it)->minX()); if ( abs(px-xt) > abs(opx-xt) ) closest = 0; } } // printf("%d\n", _b->spdy()); // if (abs(bsx) < 160) hd += 7; if ( _b->gravity() ) { if ( ( (abs(px - bx)) <= hd ) && // is the ball close? //(abs(_b->spdy()) > 10) && // is the ball going down too slow? //( abs(px-bx) > 5 ) && // am I to close to the ball center? // Can I reach the ball jumping, or am I missing the ball? (_b->y() > ((_b->spdy() > 20)?JUMP_LIMIT:(JUMP_LIMIT+20))) ) { jmp = 1; } } else { // I serve only forward jmp = ( (minhd < (bx - px) && ((bx - px) <= hd) ) ); } // printf("hd: %d - %d (%d - %d)\n",hd, abs(bx-px), _b->spdy(), _b->y()); // if I'm the closest player I serve (when it's "service time"). // if the ball is (too) outside my slot I do not go for it. double concern = (nplrs>1)?(slotsize*1.05):slotsize; if ( (abs(xt-mypos) < concern) && closest) { if ( _b->gravity() ) { move = xt-hd-px; } else { // I serve only forward move = bx-hd-px; } if ( ( ttime < JUMPING_TIME ) ){ jmp = 1; move = (bx-px); } } else { move = mypos-px; } move=-side*(move); ret.left = ret.right = ret.jump = 0; if ( abs(move) > 2) { if ( move < 0 ) ret.left = 1; if ( move > 0 ) ret.right = 1; } if ( jmp ) ret.jump = 1; return ret; } gav-0.9.0/GameRenderer.h0000644000000000000000000000262610355262416013516 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _GAMERENDERER_H_ #define _GAMERENDERER_H_ #include #include "FrameSeq.h" #include "globals.h" class GameRenderer { float _ratioX; float _ratioY; public: GameRenderer() { _ratioX = 1.0; _ratioY = 1.0; } GameRenderer(int aw, int ah, int lw, int lh) { _ratioX = (float) aw / (float) lw; _ratioY = (float) ah / (float) lh; } // if the frame param is omitted, the whole surface is blitted to dest void display(SDL_Surface *dest, SDL_Rect *rect, FrameSeq *what, int frame = 0); SDL_Rect convertCoordinates(SDL_Rect *rect); }; #endif // _GAMERENDERER_H_ gav-0.9.0/PlayerAI.h0000644000000000000000000000242507765434116012632 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __PLAYERAI_H__ #define __PLAYERAI_H__ #include "Player.h" #include "ControlsArray.h" class Ball; class PlayerAI : public Player { Ball * _b; protected: int _highestpoint; public: PlayerAI(Team *team, std::string name, pl_type_t type, int idx, int speed, Ball *b) { init(team, name, type, idx, speed); _b = b; _highestpoint = 0; } virtual pl_ctrl_t getCtrl() { return PL_CTRL_AI; } virtual triple_t planAction(); }; #endif gav-0.9.0/LICENSE0000644000000000000000000004313107620151430012000 0ustar rootroot 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. gav-0.9.0/Theme.h0000644000000000000000000001470110361734354012217 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _THEMES_H_ #define _THEMES_H_ #include #include #include #ifndef WIN32 #include #else #include #endif /* WIN32 */ #include #include #include "SoundMgr.h" #include "globals.h" #include "GameRenderer.h" #include "Menu.h" #include "MenuItem.h" #include "MenuItemMonitor.h" #define TH_DIR "themes" #define TH_NET "net.png" #define TH_LEFTMALE "plml.png" #define TH_RIGHTMALE "plmr.png" #define TH_LEFTFEMALE "plfl.png" #define TH_RIGHTFEMALE "plfr.png" #define TH_BACKGROUND_JPG "background.jpg" #define TH_BACKGROUND_PNG "background.png" #define TH_BACKGROUND_BIG_JPG "background_big.jpg" #define TH_BACKGROUND_BIG_PNG "background_big.png" #define TH_BALL "ball.png" #define TH_FONT "Font.png" #define TH_FONTINV "FontInv.png" #define TH_CONFNAME "theme.conf" extern std::string ThemeDir; class Theme { private: std::string _name; bool _hasnet; // To possibly add the image of the net (not used yet) std::string _background; std::string _net; std::string _font; std::string _fontinv; std::string _leftmale; std::string _rightmale; std::string _leftfemale; std::string _rightfemale; std::string _ball; std::string _confFile; std::string TD; bool _hasConfFile; bool _bigBackground; bool _checkTheme(); // Theme Validation public: Theme(std::string name) { #ifndef WIN32 DIR *dir; if ((dir = opendir(ThemeDir.c_str())) == NULL) { ThemeDir = "/usr/share/games/gav/" + ThemeDir; if ((dir = opendir(ThemeDir.c_str())) == NULL) { std::cerr << "Cannot find themes directory\n"; exit(0); } else closedir(dir); } else closedir(dir); configuration.currentTheme = name; TD = ThemeDir + "/" + name + "/"; #else HANDLE hFindFile ; WIN32_FIND_DATA ffdData ; hFindFile = FindFirstFile (ThemeDir.c_str(), &ffdData) ; if (hFindFile == INVALID_HANDLE_VALUE) { std::cerr << "Cannot find themes directory\n" ; exit(0) ; } FindClose (hFindFile) ; TD = ThemeDir + "\\" + name + "\\" ; #endif /* WIN32 */ _name = name; _bigBackground = configuration.bgBig; if ( _bigBackground ) { printf("Big Background hack: FIX IT!\n"); configuration.env.w = BIG_ENVIRONMENT_WIDTH; configuration.env.h = BIG_ENVIRONMENT_HEIGHT; double rat = ((double) configuration.desiredResolution.y) / (double) BIG_ENVIRONMENT_HEIGHT; int w = (int) (rat * BIG_ENVIRONMENT_WIDTH); int h = configuration.desiredResolution.y; configuration.setResolution(w, h); configuration.scaleFactors(BIG_ENVIRONMENT_WIDTH, BIG_ENVIRONMENT_HEIGHT); } else { configuration.env.w = ENVIRONMENT_WIDTH; configuration.env.h = ENVIRONMENT_HEIGHT; configuration.setResolutionToDesired(); configuration.scaleFactors(ENVIRONMENT_WIDTH, ENVIRONMENT_HEIGHT); } _net = TD + TH_NET; if (!_bigBackground) _background = TD + TH_BACKGROUND_PNG; else _background = TD + TH_BACKGROUND_BIG_PNG; _font = TD + TH_FONT; _fontinv = TD + TH_FONTINV; _leftmale = TD + TH_LEFTMALE; _rightmale = TD + TH_RIGHTMALE; _leftfemale = TD + TH_LEFTFEMALE; _rightfemale = TD + TH_RIGHTFEMALE; _confFile = TD + TH_CONFNAME; _ball = TD + TH_BALL; _hasnet = Theme::_checkTheme(); // ::background = IMG_Load(background()); // TODO: fetch the environment size (and therefore the ratios) // from the background image //if ( CurrentTheme->hasnet() ) IMG_Load(CurrentTheme->net()); //screenFlags = SDL_DOUBLEBUF|SDL_HWSURFACE; screenFlags |= SDL_DOUBLEBUF; screen = SDL_SetVideoMode(configuration.resolution.x, configuration.resolution.y, videoinfo->vfmt->BitsPerPixel, screenFlags); ::background = new LogicalFrameSeq(background(), 1, false); gameRenderer = new GameRenderer(configuration.resolution.x, configuration.resolution.y, configuration.env.w, configuration.env.h); cga = new ScreenFont(font(), FONT_FIRST_CHAR, FONT_NUMBER); cgaInv = new ScreenFont(fontinv(), FONT_FIRST_CHAR, FONT_NUMBER); MenuItemMonitor().apply(); #ifdef AUDIO if ( soundMgr ) delete(soundMgr); soundMgr = new SoundMgr((TD+"sounds").c_str(), (ThemeDir+"/../sounds").c_str()); #endif // AUDIO } ~Theme() { delete(::background); delete(cga); delete(cgaInv); delete(gameRenderer); } #define _CCS(str) ((str).c_str()) inline const char * name() { return( _CCS(_name) );} inline bool hasnet() { return( _hasnet );} inline bool bigBackground() { return( _bigBackground );} inline const char * background() { return( _CCS(_background) );} inline const char * net() { return( _CCS(_net) );} inline const char * font() { return( _CCS(_font) );} inline const char * fontinv() { return( _CCS(_fontinv) );} inline const char * leftmale() { return( _CCS(_leftmale) );} inline const char * rightmale() { return( _CCS(_rightmale) );} inline const char * leftfemale() { return( _CCS(_leftfemale) );} inline const char * rightfemale(){ return( _CCS(_rightfemale) );} inline const char * ball() { return( _CCS(_ball) );} void loadConf(); class ThemeErrorException { public: std::string message; ThemeErrorException(std::string msg) { message = msg; } }; }; extern Theme *CurrentTheme; inline void setThemeDir(std::string h) { ThemeDir = h; } #endif gav-0.9.0/Makefile.Linux0000644000000000000000000000327407620743552013551 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. include CommonHeader ROOT= SUBDIRS = menu automa net CXXFLAGS += $(foreach DIR, $(SUBDIRS), -I$(DIR)) -I. ALL_OBJ = $(foreach DIR, $(SUBDIRS), $(DIR)/$(DIR:%=%_module.o)) DEPEND = Makefile.depend .PHONY: depend clean all $(SUBDIRS) all: $(SUBDIRS) gav $(SUBDIRS): $(MAKE) -C $@ $(ALL_OBJ): $(MAKE) -C $(@D:%_module.o=%) gav: $(ALL_OBJ) $(OFILES) $(CXX) -o gav $(OFILES) $(ALL_OBJ) $(LDFLAGS) strip gav clean: for i in $(SUBDIRS) ; do \ $(MAKE) -C $$i clean;\ done rm -f *~ *.o gav $(DEPEND) bindist: all for i in $(SUBDIRS) ; do \ $(MAKE) -C $$i clean;\ done rm -f *~ *.o install: all install gav $(ROOT)/usr/bin install -d $(ROOT)/usr/share/games/gav/themes cp -r themes/* $(ROOT)/usr/share/games/gav/themes depend: for i in $(SUBDIRS) ; do \ $(MAKE) -C $$i depend;\ done $(RM) $(DEPEND) $(CXX) -M $(CXXFLAGS) $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/InputState.h0000644000000000000000000000237210346321571013252 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __INPUTSTATE_H__ #define __INPUTSTATE_H__ #include #include #include "globals.h" class InputState { private: Uint8 _f[12]; Uint8 *keystate; SDL_Event event; public: InputState() {} virtual void getInput(); virtual Uint8 *getF() { return _f; } virtual Uint8 *getKeyState() { return keystate; } virtual SDL_Event getEvent() { return event; } virtual SDL_Event getEventWaiting(); virtual ~InputState(); }; #endif gav-0.9.0/SoundMgr.cpp0000644000000000000000000000453310034775551013251 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include "SoundMgr.h" #ifdef AUDIO /* this should be synchronized with enum SND_* in global.h */ char *sound_fnames[] = { "bounce.wav", "select.wav", "activate.wav", "score.wav", "victory.wav", "partialnet.wav", "fullnet.wav", "servicechange.wav", "playerhit.wav", "background_playing.wav", "background_menu.wav", NULL }; SoundMgr::SoundMgr(const char *dir, const char *defdir) { memset(sounds, 0, sizeof(Sound *) * MAX_SOUNDS); const char *actualdir = dir?dir:defdir; struct stat sbuf; if ( dir && stat(dir, &sbuf) ) actualdir = defdir; char fname[100]; int sndidx = 0; for ( sndidx = SND_BOUNCE; sound_fnames[sndidx] && (sndidx <= SND_BACKGROUND_MENU); sndidx++ ) { sprintf(fname, "%s/%s", actualdir, sound_fnames[sndidx]); FILE *fp = fopen(fname, "r"); if ( !fp ) continue; printf("sound: %s\n", fname); fclose(fp); sounds[sndidx] = new Sound(); if ( sounds[sndidx]->loadSound(fname) ) { delete(sounds[sndidx]); sounds[sndidx] = NULL; } } nsounds = sndidx; } SoundMgr::~SoundMgr() { int sndidx = 0; for ( sndidx = SND_BOUNCE; (sndidx <= SND_PLAYERHIT); sndidx++ ) if ( sounds[sndidx] ) delete(sounds[sndidx]); } int SoundMgr::playSound(int which, bool loop) { if ( sounds[which] && configuration.sound ) return sounds[which]->playSound(loop); else return 0; } void SoundMgr::stopSound(int which) { if ( sounds[which] && configuration.sound ) sounds[which]->stopSound(); } #endif gav-0.9.0/Makefile0000644000000000000000000000327407622161334012445 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. include CommonHeader ROOT= SUBDIRS = menu automa net CXXFLAGS += $(foreach DIR, $(SUBDIRS), -I$(DIR)) -I. ALL_OBJ = $(foreach DIR, $(SUBDIRS), $(DIR)/$(DIR:%=%_module.o)) DEPEND = Makefile.depend .PHONY: depend clean all $(SUBDIRS) all: $(SUBDIRS) gav $(SUBDIRS): $(MAKE) -C $@ $(ALL_OBJ): $(MAKE) -C $(@D:%_module.o=%) gav: $(ALL_OBJ) $(OFILES) $(CXX) -o gav $(OFILES) $(ALL_OBJ) $(LDFLAGS) strip gav clean: for i in $(SUBDIRS) ; do \ $(MAKE) -C $$i clean;\ done rm -f *~ *.o gav $(DEPEND) bindist: all for i in $(SUBDIRS) ; do \ $(MAKE) -C $$i clean;\ done rm -f *~ *.o install: all install gav $(ROOT)/usr/bin install -d $(ROOT)/usr/share/games/gav/themes cp -r themes/* $(ROOT)/usr/share/games/gav/themes depend: for i in $(SUBDIRS) ; do \ $(MAKE) -C $$i depend;\ done $(RM) $(DEPEND) $(CXX) -M $(CXXFLAGS) $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/LogicalFrameSeq.h0000644000000000000000000000523510355262416014153 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __LOGICALFRAMESEQ_H__ #define __LOGICALFRAMESEQ_H__ #include #include #include #include //#include #include "ResizeSurface.h" #include "globals.h" #include "FrameSeq.h" double exactScaleFactor(int startw, double zoom, int step); class LogicalFrameSeq : public FrameSeq { protected: FrameSeq *_actualFrameSeq; public: LogicalFrameSeq(const char * filename, int nframes, bool useAlpha = true) : FrameSeq(filename, nframes, useAlpha) { // if ( ratioX == 0.0 ) float ratioX = ::configuration.resolution.ratioX; // if ( ratioY == 0.0 ) float ratioY = ::configuration.resolution.ratioY; ratioX = exactScaleFactor(_surface->w, ratioX, nframes); // SDL_Surface *as = zoomSurface(_surface, ratioX, ratioY, SMOOTHING_OFF); SDL_Surface *as = resizeSurface(_surface, (int) round(ratioX*_surface->w), (int) round(ratioY*_surface->h)); //printf("NS->w: %d\n", as->w); _actualFrameSeq = new FrameSeq(as, nframes, useAlpha); /* Modify _width according to the new computed ratioX */ _width = (int) (((double) _actualFrameSeq->width()) / ratioX); } virtual ~LogicalFrameSeq() { delete(_actualFrameSeq); } virtual SDL_Surface *surface() { return _actualFrameSeq->surface(); } virtual void blit(int idx, SDL_Surface * dest, SDL_Rect * rect); /* These two functions are needed when it is required to reason in terms of actual pixels (as in ScreenFonts to make sure the font is nicely laid out. In order to be able to exchange between FrameSeq and LogicalFrameSeq, however, it has been necessary to add these to FrameSeq as well. Should have worked that out better... */ virtual FrameSeq *getActualFrameSeq() { return _actualFrameSeq; } virtual int screenWidth() { return _actualFrameSeq->width(); } }; #endif // __LOGICALFRAMESEQ_H__ gav-0.9.0/Player.cpp0000644000000000000000000001136010435060131012725 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "Player.h" #include "ControlsArray.h" #include #include "Team.h" #define SPEED_FACT_CONST (5) int Player::maxX() { return _team->xmax(); } int Player::minX() { return _team->xmin(); } int Player::minY() { return _team->ymin(); } int Player::speedX() { if ( (_speedX > 0) && (_x < (_team->xmax() - _frames->width())) ) return(_speedX); if ( (_speedX < 0) && (_x > _team->xmin()) ) return(_speedX); return(0); } bool Player::setState(pl_state_t st, bool force) { if ((_state == st) && !force) return false; _state = st; switch (st) { case PL_STATE_JUMP: _currFrameB = configuration.playerFrameConf.playerJmpB - 1; _currFrameE = configuration.playerFrameConf.playerJmpE - 1; if ( (_currFrameB == _currFrameE) || (configuration.playerFrameConf.playerJmpP == 0) ) _currStateFrameDelay = 0; else _currStateFrameDelay = configuration.playerFrameConf.playerJmpP/ ( _currFrameE - _currFrameB); break; case PL_STATE_STILL: _currFrameB = configuration.playerFrameConf.playerStillB - 1; _currFrameE = configuration.playerFrameConf.playerStillE - 1; if ( (_currFrameB == _currFrameE) || (configuration.playerFrameConf.playerStillP == 0) ) _currStateFrameDelay = 0; else _currStateFrameDelay = configuration.playerFrameConf.playerStillP/ ( _currFrameE - _currFrameB); break; case PL_STATE_WALK: _currFrameB = configuration.playerFrameConf.playerRunB - 1; _currFrameE = configuration.playerFrameConf.playerRunE - 1; if ( (_currFrameB == _currFrameE) || (configuration.playerFrameConf.playerRunP == 0) ) _currStateFrameDelay = 0; else _currStateFrameDelay = configuration.playerFrameConf.playerRunP/ ( _currFrameE - _currFrameB); break; } return true; } void Player::updateFrame(int ticks, bool changed) { _overallPassed += ticks; if ( changed ) { _overallPassed = 0; _frameIdx = _currFrameB; } else if ( _currStateFrameDelay && (_overallPassed > _currStateFrameDelay) ) { // update _frameIdx if ( ++_frameIdx > _currFrameE ) _frameIdx = _currFrameB; _overallPassed = 0; } } /* Invoked by the network client in order to draw the proper animation frame */ void Player::updateClient(int ticks, pl_state_t st) { updateFrame(ticks, setState(st)); } void Player::update(int ticks, ControlsArray *ca) { triple_t input = ca->getCommands(_plId); int dx = 0; bool firstTime = (_overallPassed == 0); if ( input.left ) dx--; if ( input.right ) dx++; _speedX = dx?(dx * _speed):0; _displx += (float) dx * (_speed * ticks / 1000.0); if ( fabs(_displx) >= 1.0 ) { _x += (int) _displx; _displx -= (int) _displx; } if ( _x > (_team->xmax() - _frames->width()) ) _x = (_team->xmax() - _frames->width()); else if ( _x < _team->xmin() ) _x = _team->xmin(); if ( _y == GROUND_LEVEL() && input.jump ) { _speedY = -(configuration.SPEEDY); } if ( _y > GROUND_LEVEL() ) { _y = GROUND_LEVEL(); _speedY = 0; } _disply = (float) (_speedY * SPEED_FACT_CONST * ((float) ticks / 1000.0)); if ( fabs(_disply) >= 1.0 ) { _y += (int) _disply; _disply -= (int) _disply; } if ( _y < GROUND_LEVEL() ) _speedY += (float) (configuration.SPEEDY * SPEED_FACT_CONST * ticks) / 1000.0; int _oldState = _state; /* detect state changes */ if ( _y < GROUND_LEVEL() ) { setState(PL_STATE_JUMP); // jumping } else if (firstTime || (!dx)) { // player still setState(PL_STATE_STILL, firstTime); } else if ( dx ) { // player running setState(PL_STATE_WALK); } updateFrame(ticks, (_oldState != _state)); } void Player::draw(SDL_Surface * screen) { SDL_Rect rect; rect.x = _x; rect.y = _y; _frames->blit(_frameIdx, screen, &rect); } bool Player::collidesWith(FrameSeq *fs, int idx, SDL_Rect *rect) { SDL_Rect myRect; myRect.x = _x; myRect.y = _y; return(_frames->collidesWith(fs, _state, idx, &myRect, rect)); } gav-0.9.0/CommonHeader0000644000000000000000000000227110355243410013256 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. CWD = $(shell pwd) GAV_ROOT = $(CWD:%/$(RELPATH)=%) #comment the following line if you do not want network support NET = true LD = ld CXX = g++ CXXFLAGS= `sdl-config --cflags` -g -Wall -DAUDIO ifndef NET CXXFLAGS+= -DNONET endif ifdef NET LDFLAGS= `sdl-config --libs` -lSDL_image -lSDL_net -lm else LDFLAGS= `sdl-config --libs` -lSDL_image -lm endif SRCS = $(wildcard *.cpp) OFILES = $(SRCS:%.cpp=%.o) gav-0.9.0/PlayerHuman.h0000644000000000000000000000214607757431457013417 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __PLAYERHUMAN_H__ #define __PLAYERHUMAN_H__ #include "Player.h" class PlayerHuman : public Player { public: PlayerHuman(Team *team, std::string name, pl_type_t type, int idx, int speed) { init(team, name, type, idx, speed); } pl_ctrl_t getCtrl() { return PL_CTRL_HUMAN; } }; #endif gav-0.9.0/Theme.cpp0000644000000000000000000001162410116075504012544 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef WIN32 #include #else #include #include #endif /* WIN32 */ #include #include #include "Theme.h" using namespace std; Theme *CurrentTheme; string ThemeDir; void errorOn(string file) { throw Theme:: ThemeErrorException("Error accessing file " + file); } bool Theme::_checkTheme() { bool r; _hasConfFile = true; #ifndef WIN32 cerr << "Verifying Theme `" << _name << "' [" << ThemeDir << "/" << _name << "/]:\n"; if ( access(_CCS(_background), R_OK) ) { if (!_bigBackground) _background = TD + TH_BACKGROUND_JPG; else _background = TD + TH_BACKGROUND_BIG_JPG; if ( access(_CCS(_background), R_OK) ) errorOn("background.{jpg,png}"); } if ( access(_CCS(_font), R_OK) ) errorOn(TH_FONT); if ( access(_CCS(_fontinv), R_OK) ) errorOn(TH_FONTINV); if ( access(_CCS(_leftmale), R_OK) ) errorOn(TH_LEFTMALE); if ( access(_CCS(_rightmale), R_OK) ) errorOn(TH_RIGHTMALE); if ( access(_CCS(_leftfemale), R_OK) ) errorOn(TH_LEFTFEMALE); if ( access(_CCS(_rightfemale), R_OK) ) errorOn(TH_RIGHTFEMALE); if ( access(_CCS(_ball), R_OK) ) errorOn(TH_BALL); if ( access(_CCS(_confFile), R_OK) ) _hasConfFile = false; r = (access(_CCS(_net), R_OK) == 0); #else struct _stat sStat ; cerr << "Verifying Theme `" << _name << "' [" << ThemeDir << "\\" << _name << "\\]:\n"; if (_stat (_background.c_str(), &sStat)) { if (!_bigBackground) _background = TD + TH_BACKGROUND_JPG; else _background = TD + TH_BACKGROUND_BIG_JPG; if (_stat (_background.c_str(), &sStat)) errorOn("background.{jpg,png}"); } if (_stat (_font.c_str(), &sStat)) errorOn (TH_FONT) ; if (_stat (_fontinv.c_str(), &sStat)) errorOn (TH_FONTINV) ; if (_stat (_leftmale.c_str(), &sStat)) errorOn (TH_LEFTMALE) ; if (_stat (_rightmale.c_str(), &sStat)) errorOn (TH_RIGHTMALE) ; if (_stat (_leftfemale.c_str(), &sStat)) errorOn (TH_LEFTFEMALE) ; if (_stat (_rightfemale.c_str(), &sStat)) errorOn (TH_RIGHTFEMALE) ; if (_stat (_ball.c_str(), &sStat)) errorOn (TH_BALL) ; if ( _stat(_confFile.c_str(), &sStat) ) _hasConfFile = false; r = (_stat (_net.c_str(), &sStat) == 0) ; #endif /* WIN32 */ if ( !r ) cerr << "Warning: No net for this theme!\n"; cerr << "OK!\n"; configuration.setDefaultFrameConf(); if ( _hasConfFile ) { cerr << "Using configuration file theme.conf\n"; loadConf(); } else { cerr << "No theme.conf\n"; } return(r); } void Theme::loadConf() { Aargh myAargh; /* I want a new one, 'cause the global one is used by configuration */ myAargh.loadConf(_confFile.c_str()); /* now set things up in configuration */ string value; if ( myAargh.getArg("NPlayerFrames", value) ) configuration.playerFrameConf.nPlayerFrames = atoi(value.c_str()); if ( myAargh.getArg("PlayerStillB", value) ) configuration.playerFrameConf.playerStillB = atoi(value.c_str()); if ( myAargh.getArg("PlayerStillE", value) ) configuration.playerFrameConf.playerStillE = atoi(value.c_str()); if ( myAargh.getArg("PlayerStillP", value) ) configuration.playerFrameConf.playerStillP = atoi(value.c_str()); if ( myAargh.getArg("PlayerRunB", value) ) configuration.playerFrameConf.playerRunB = atoi(value.c_str()); if ( myAargh.getArg("PlayerRunE", value) ) configuration.playerFrameConf.playerRunE = atoi(value.c_str()); if ( myAargh.getArg("PlayerRunP", value) ) configuration.playerFrameConf.playerRunP = atoi(value.c_str()); if ( myAargh.getArg("PlayerJumpB", value) ) configuration.playerFrameConf.playerJmpB = atoi(value.c_str()); if ( myAargh.getArg("PlayerJumpE", value) ) configuration.playerFrameConf.playerJmpE = atoi(value.c_str()); if ( myAargh.getArg("PlayerJumpP", value) ) configuration.playerFrameConf.playerJmpP = atoi(value.c_str()); if ( myAargh.getArg("NBallFrames", value) ) configuration.ballFrameConf.nBallFrames = atoi(value.c_str()); if ( myAargh.getArg("BallPeriod", value) ) configuration.ballFrameConf.ballPeriod = atoi(value.c_str()); } gav-0.9.0/Player.h0000644000000000000000000001106110435057606012405 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __PLAYER_H__ #define __PLAYER_H__ #include #include "FrameSeq.h" #include #include "Theme.h" #include "globals.h" #define RESET_WALK_SEQUENCE (100000) class Team; class ControlsArray; #define NUM_TYPES (5) typedef enum { PL_TYPE_MALE_LEFT = 1, PL_TYPE_FEMALE_LEFT, PL_TYPE_MALE_RIGHT, PL_TYPE_FEMALE_RIGHT } pl_type_t; #define NUM_STATES (3) typedef enum { PL_STATE_STILL = 0, PL_STATE_WALK, PL_STATE_JUMP } pl_state_t; typedef enum { PL_CTRL_HUMAN, PL_CTRL_AI, PL_CTRL_REMOTE } pl_ctrl_t; class Player { protected: FrameSeq * _frames; std::string _name; pl_type_t _type; pl_state_t _state; int _frameIdx; int _speed; int _x, _y; int _speedX; // actual x speed float _speedY; int _plId; int _oif; int _currStateFrameDelay, _currFrameB, _currFrameE; Team *_team; int _overallPassed; float _displx, _disply; char *_fileNames[NUM_TYPES]; public: Player() {}; Player(Team *team, std::string name, pl_type_t type, int idx, int speed) { init(team, name, type, idx, speed); } void init(Team *team, std::string name, pl_type_t type, int idx, int speed) { _fileNames[PL_TYPE_MALE_LEFT] = (char *)malloc(sizeof(char)*(MAXPATHLENGTH+1)); strncpy(_fileNames[PL_TYPE_MALE_LEFT], CurrentTheme->leftmale(), MAXPATHLENGTH); _fileNames[PL_TYPE_MALE_RIGHT] = (char *)malloc(sizeof(char)*(MAXPATHLENGTH+1)); strncpy(_fileNames[PL_TYPE_MALE_RIGHT], CurrentTheme->rightmale(), MAXPATHLENGTH); _fileNames[PL_TYPE_FEMALE_LEFT] = (char *)malloc(sizeof(char)*(MAXPATHLENGTH+1)); strncpy(_fileNames[PL_TYPE_FEMALE_LEFT], CurrentTheme->leftfemale(), MAXPATHLENGTH); _fileNames[PL_TYPE_FEMALE_RIGHT] = (char *)malloc(sizeof(char)*(MAXPATHLENGTH+1)); strncpy(_fileNames[PL_TYPE_FEMALE_RIGHT], CurrentTheme->rightfemale(), MAXPATHLENGTH); _team = team; _name = name; _plId = idx; _oif = -1; _type = type; _state = PL_STATE_STILL; _frameIdx = configuration.playerFrameConf.playerStillB - 1; _speed = speed; _speedX = 0; _speedY = 0.0; _overallPassed = 0; _displx = _disply = 0.0; Player::loadFrames(); _y = GROUND_LEVEL(); } virtual ~Player() { free(_fileNames[PL_TYPE_MALE_LEFT]); free(_fileNames[PL_TYPE_MALE_RIGHT]); free(_fileNames[PL_TYPE_FEMALE_LEFT]); free(_fileNames[PL_TYPE_FEMALE_RIGHT]); delete(_frames); } inline int GROUND_LEVEL() { return(configuration.FLOOR_ORD -_frames->height());} // (346) inline std::string name() {return _name;} inline int id() { return _plId; } inline int orderInField() { return _oif; } inline void setOIF(int oif) { _oif = oif; } inline pl_type_t type() {return _type;} inline pl_state_t state() {return _state;} bool setState(pl_state_t s, bool force = false); inline int speed() {return _speed;} inline void setSpeed(int s) {_speed = s;} inline float speedY() {return _speedY;} inline void setSpeedY(float s) {_speedY = s;} int speedX(); inline int x() {return _x;} inline void setX(int x) {_x = x;} inline int y() {return _y;} inline void setY(int y) {_y = y;} inline Team *team() {return(_team);} void loadFrames() { _frames = new LogicalFrameSeq(_fileNames[_type], configuration.playerFrameConf.nPlayerFrames); } void updateFrame(int ticks, bool changed); void updateClient(int ticks, pl_state_t state); void update(int ticks, ControlsArray *ca); void draw(SDL_Surface * screen); inline int width() { return _frames->width(); } inline int height() { return _frames->height(); } int minX(); int maxX(); int minY(); bool collidesWith(FrameSeq *fs, int idx, SDL_Rect *rect); virtual pl_ctrl_t getCtrl() { return PL_CTRL_HUMAN; }; }; #endif gav-0.9.0/InputState.cpp0000644000000000000000000000246210346321571013605 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include "InputState.h" SDL_Event InputState::getEventWaiting() { SDL_Event e; SDL_WaitEvent(&e); return(e); } void InputState::getInput() { SDL_PumpEvents(); /* Grab a snapshot of the keyboard. */ keystate = SDL_GetKeyState(NULL); // SHOULD THIS BE DELETED AT SOME POINT?? if ( SDL_PollEvent(&event) ) { if (event.type == SDL_QUIT) exit(0); } for ( int i = 0; i < 12; i++ ) _f[i] = keystate[SDLK_F1 + i]; } InputState::~InputState() { } gav-0.9.0/osx-info.plist0000644000000000000000000000114010116240626013604 0ustar rootroot CFBundleDevelopmentRegion English CFBundleExecutable gav CFBundleIdentifier com.gavproject.gav CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType APPL CFBundleSignature ???? CFBundleVersion 1.0.0d1 gav-0.9.0/PlayerRemote.h0000644000000000000000000000215307757431457013600 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __PLAYERREMOTE_H__ #define __PLAYERREMOTE_H__ #include "Player.h" class PlayerRemote : public Player { public: PlayerRemote(Team *team, std::string name, pl_type_t type, int idx, int speed) { init(team, name, type, idx, speed); } pl_ctrl_t getCtrl() { return PL_CTRL_REMOTE; } }; #endif gav-0.9.0/aarg.h0000644000000000000000000000712410117772772012075 0ustar rootroot/* -*- C++ -*- */ #ifndef _AARG_H_ #define _AARG_H_ #include #include #include #include #include #include class Aargh { public: Aargh () { } // questo costruttore serve per avere i parametri caricati // prima dell'avvio di main, cosi' da poter chiamare i // costruttori degli oggetti globali che dipendono da // dei parametri Aargh (char *filename) { loadConf (filename); } // questi altri due costruttori sono meno necessari ma // sono comunque utili Aargh (int argc, char **argv) { parseArgs (argc, argv); } // vedi sopra Aargh (int argc, char **argv, char *filename) { parseArgs (argc, argv); loadConf (filename); } // parametri accettati // -qualcosa // -qualcosa valore bool parseArgs (int argc, char **argv) { bool allright = true; std::string base = ""; for (int i = 1; i < argc; ++i) { if (argv[i][0] == '-') { base = std::string (argv[i]); argmap[base] = "_Aargh"; } else { if (base != "") { argmap[base] = std::string (argv[i]); base = ""; } else allright = false; } } return allright; } bool loadConf (const char *filename) { bool allright = true; FILE *fp; char ln[128]; if ((fp = fopen (filename, "r")) == NULL) return (false); while (fgets (ln, 128, fp)) if (*ln != '#' && *ln != '\n') { char *key = ln; char *value = ln; while ((*value != ' ') && (*value != '\t') && (*value != '\n')) value++; // finds the first space or tab if (*value == '\n') { *value = '\0'; argmap[key] = "_Aargh"; continue; } // removes spaces and tabs while ((*value == ' ') || (*value == '\t')) { *value = '\0'; value++; } char *end = value; while ((*end != '\n') && (*end)) end++; *end = '\0'; // null terminates value (fgets puts a '\n' at the end) // now, key is a null terminated string holding the key, and value is everything which // is found after the first series of spaces or tabs. if (strcmp (key, "") && strcmp (value, "")) argmap[key] = value; } return allright; } bool getArg (std::string name) { return (argmap.find (name) != argmap.end ()); } bool getArg (std::string name, std::string & value) { if (argmap.find (name) != argmap.end ()) { value = argmap[name]; return true; } else return false; } bool getArg (std::string name, std::string & value, const char* def) { if ( getArg(name, value) ) return true; else value = std::string(def); return false; } bool setArg (std::string name, std::string value) { bool ret = (argmap.find (name) != argmap.end ()); // std::cerr << "Setting " << name << " to: " << value << std::endl; argmap[name] = value; return(ret); } bool setArg (std::string name, int intvalue) { std::ostringstream value; value << intvalue; bool ret = (argmap.find (value.str()) != argmap.end ()); // std::cerr << "Setting " << name << " to: " << value.str() << std::endl; argmap[name] = value.str(); return(ret); } void dump (std::string & out) { std::map < std::string, std::string >::const_iterator b = argmap.begin (); std::map < std::string, std::string >::const_iterator e = argmap.end (); out = ""; while (b != e) { out += b->first + ' ' + b->second + '\n'; ++b; } } void reset() { argmap.clear(); } private: std::map < std::string, std::string > argmap; }; extern Aargh aargh; #endif // _AARG_H_ gav-0.9.0/package/0000755000000000000000000000000010435311427012366 5ustar rootrootgav-0.9.0/package/gav.spec0000644000000000000000000000455110034774731014032 0ustar rootrootSummary: GPL rendition of old Arcade Volleyball game Name: gav Version: 0.8.0 Release: 1 URL: gav.sourceforge.net Source0: %{name}-%{version}.tar.gz License: GPL Group: X11/Games/Video BuildRoot: %{_tmppath}/%{name}-root %description An SDL-based rendition of an old favorite CGA game featuring two characters playing a volleyball-like game. This "revamped" version is supposed to support theming, multiplayer games, different input devices and networking. %prep %setup -q %build make depend make %install install -d $RPM_BUILD_ROOT/usr/bin install gav $RPM_BUILD_ROOT/usr/bin/ install -d $RPM_BUILD_ROOT/usr/share/games/gav/themes install -d $RPM_BUILD_ROOT/usr/share/games/gav/sounds install -d $RPM_BUILD_ROOT/usr/share/doc/gav-%{version} install -d $RPM_BUILD_ROOT/usr/share/applications install -d $RPM_BUILD_ROOT/usr/share/pixmaps install -d $RPM_BUILD_ROOT/etc/X11/applnk/Games install package/gav.desktop $RPM_BUILD_ROOT/usr/share/applications install package/gav.desktop $RPM_BUILD_ROOT/etc/X11/applnk/Games install package/gav.png $RPM_BUILD_ROOT/usr/share/pixmaps cp -r themes/classic $RPM_BUILD_ROOT/usr/share/games/gav/themes cp -r sounds $RPM_BUILD_ROOT/usr/share/games/gav/ install README $RPM_BUILD_ROOT/usr/share/doc/gav-%{version}/ install CHANGELOG $RPM_BUILD_ROOT/usr/share/doc/gav-%{version}/ install LICENSE $RPM_BUILD_ROOT/usr/share/doc/gav-%{version}/ #rm -rf $RPM_BUILD_ROOT %clean make clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) /usr/bin/gav /usr/share/games/gav/ /usr/share/doc/gav-%{version}/README /usr/share/doc/gav-%{version}/CHANGELOG /usr/share/doc/gav-%{version}/LICENSE /usr/share/applications/gav.desktop /etc/X11/applnk/Games/gav.desktop /usr/share/pixmaps/gav.png /usr/share/games/gav/sounds /usr/share/games/gav/sounds/score.wav /usr/share/games/gav/sounds/servicechange.wav /usr/share/games/gav/themes /usr/share/games/gav/themes/classic /usr/share/games/gav/themes/classic/Font.png /usr/share/games/gav/themes/classic/FontInv.png /usr/share/games/gav/themes/classic/background.png /usr/share/games/gav/themes/classic/background_big.png /usr/share/games/gav/themes/classic/ball.png /usr/share/games/gav/themes/classic/plfl.png /usr/share/games/gav/themes/classic/plfr.png /usr/share/games/gav/themes/classic/plml.png /usr/share/games/gav/themes/classic/plmr.png %changelog * Fri Apr 2 2004 Alessandro Tommasi - Major Changes gav-0.9.0/package/themes.spec0000644000000000000000000000750607720167141014544 0ustar rootroot# use rpmbuild with --target noarch option Summary: GPL rendition of old Arcade Volleyball game Name: gav-themes Version: 0.7.3 Release: 1 URL: gav.sourceforge.net Source0: %{name}-%{version}.tar.gz License: GPL Group: X11/Games/Video BuildRoot: %{_tmppath}/%{name}-root %description An SDL-based rendition of an old favorite CGA game featuring two characters playing a volleyball-like game. This "revamped" version is supposed to support theming, multiplayer games, different input devices and networking. This package contains additional themes. %prep %setup -q %build %install install -d $RPM_BUILD_ROOT/usr/share/games/gav/themes cp -r themes/inverted $RPM_BUILD_ROOT/usr/share/games/gav/themes cp -r themes/fabeach $RPM_BUILD_ROOT/usr/share/games/gav/themes cp -r themes/unnamed $RPM_BUILD_ROOT/usr/share/games/gav/themes cp -r themes/yisus $RPM_BUILD_ROOT/usr/share/games/gav/themes cp -r themes/yisus2 $RPM_BUILD_ROOT/usr/share/games/gav/themes cp -r themes/naive $RPM_BUILD_ROOT/usr/share/games/gav/themes %clean %files %defattr(-,root,root) /usr/share/games/gav/themes/inverted /usr/share/games/gav/themes/inverted/Font.png /usr/share/games/gav/themes/inverted/FontInv.png /usr/share/games/gav/themes/inverted/background.png /usr/share/games/gav/themes/inverted/background_big.png /usr/share/games/gav/themes/inverted/ball.png /usr/share/games/gav/themes/inverted/plfl.png /usr/share/games/gav/themes/inverted/plfr.png /usr/share/games/gav/themes/inverted/plml.png /usr/share/games/gav/themes/inverted/plmr.png /usr/share/games/gav/themes/fabeach /usr/share/games/gav/themes/fabeach/Font.png /usr/share/games/gav/themes/fabeach/FontInv.png /usr/share/games/gav/themes/fabeach/background.png /usr/share/games/gav/themes/fabeach/background_big.png /usr/share/games/gav/themes/fabeach/ball.png /usr/share/games/gav/themes/fabeach/plfl.png /usr/share/games/gav/themes/fabeach/plfr.png /usr/share/games/gav/themes/fabeach/plml.png /usr/share/games/gav/themes/fabeach/plmr.png /usr/share/games/gav/themes/unnamed /usr/share/games/gav/themes/unnamed/Font.png /usr/share/games/gav/themes/unnamed/FontInv.png /usr/share/games/gav/themes/unnamed/background.jpg /usr/share/games/gav/themes/unnamed/background_big.jpg /usr/share/games/gav/themes/unnamed/ball.png /usr/share/games/gav/themes/unnamed/plfl.png /usr/share/games/gav/themes/unnamed/plfr.png /usr/share/games/gav/themes/unnamed/plml.png /usr/share/games/gav/themes/unnamed/plmr.png /usr/share/games/gav/themes/yisus /usr/share/games/gav/themes/yisus/Font.png /usr/share/games/gav/themes/yisus/FontInv.png /usr/share/games/gav/themes/yisus/background.jpg /usr/share/games/gav/themes/yisus/background_big.jpg /usr/share/games/gav/themes/yisus/ball.png /usr/share/games/gav/themes/yisus/plfl.png /usr/share/games/gav/themes/yisus/plfr.png /usr/share/games/gav/themes/yisus/plml.png /usr/share/games/gav/themes/yisus/plmr.png /usr/share/games/gav/themes/yisus2 /usr/share/games/gav/themes/yisus2/Font.png /usr/share/games/gav/themes/yisus2/FontInv.png /usr/share/games/gav/themes/yisus2/background.jpg /usr/share/games/gav/themes/yisus2/background_big.jpg /usr/share/games/gav/themes/yisus2/ball.png /usr/share/games/gav/themes/yisus2/plfl.png /usr/share/games/gav/themes/yisus2/plfr.png /usr/share/games/gav/themes/yisus2/plml.png /usr/share/games/gav/themes/yisus2/plmr.png /usr/share/games/gav/themes/naive /usr/share/games/gav/themes/naive/Font.png /usr/share/games/gav/themes/naive/FontInv.png /usr/share/games/gav/themes/naive/background.png /usr/share/games/gav/themes/naive/background_big.png /usr/share/games/gav/themes/naive/ball.png /usr/share/games/gav/themes/naive/plfl.png /usr/share/games/gav/themes/naive/plfr.png /usr/share/games/gav/themes/naive/plml.png /usr/share/games/gav/themes/naive/plmr.png /usr/share/games/gav/themes/naive/theme.conf %changelog * Tue Feb 24 2002 Alessandro Tommasi - New themes gav-0.9.0/package/gav.desktop0000644000000000000000000000033507574362751014557 0ustar rootroot[Desktop Entry] Encoding=UTF-8 Categories=Application;Game;X-Red-Hat-Extra X-Desktop-File-Install-Version=0.2 Name=Arcade Volleyball Comment=GPL remake of the DOS classic Icon=gav.png Exec=gav Terminal=0 Type=Application gav-0.9.0/package/gav.png0000644000000000000000000000404307574361446013672 0ustar rootrootPNG  IHDR00WbKGD pHYs  d_tIME  sIDATxՙ_hT?Lldj1KTud YHukB|)q}PQM=}1輬ʆ`@M)qv#Cm~{g8[˽w~=s7P)j `>gMR*V񷊠,-@047gjtDR։!`tDpYԞՆp/!a<-_iItx*#t@[hJ !|7.{].z)L "(;8l h k";oC4UG8)Oɠ#J$R))D"tuS@BiE{E)XZam8<&k}O -@ 8MOO311@OOH}. -\~t!0O볯>&NBKc#g7d mˌL&I9p52>#>'un"y47߆跗vpܧ5XoWR73}JG#솞 PȸfLNNdtt:͞={nhx0y 5X]l ;mpnb2+σe8MlX/52Gh~d.5A2 ${UWxn s{eRr,b#ψS!qfg`4 gp Zj@ _h l @Q0s̾rA[ @ urҌl5d;daZ8GZoD7:k, (5~װi~(5%ЩP5WdeD˱r=nն}W7DKJvE`ַUr2HBFvt0OߖOP횂WRaM (ߴT5*3%|$NbmXo=[D[<1%`>KBv"uݭK-:|?o]``@2չz78d[?~'Xng;?. (EEoK:nqB#n6B)])-B4XQd^=_4ӇuݩJ'Q*{ 2*!; dt2AYZj&@[*KT\Ȼړ%cdy1bknvz/}?'oS(9KXM̵ÓMn7/ @ 'ԉ`fON 4/kؼ JTtvZ_94vY<̗/Ids|nukx>WD4|]{Z%R/ՊM%|࣏*!j8tB΅e'iS]xO3]ulh\1u0pI>l)y"džeyT9f )t8Ըwm{"B9;/z0aN JP.Oj9Hx7$E?8\ R|S@ֹuG^/֕xџ *j6PZ"UAU /O#FGqܸ TpjR*uFU ģ@UIcG oAJ)Du39.~oXTeև` DgR]﷫5A?Ƀ>eٌĖIENDB`gav-0.9.0/menu/0000755000000000000000000000000010435311427011737 5ustar rootrootgav-0.9.0/menu/MenuItemFullScreen.h0000644000000000000000000000320010355242121015604 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMFULLSCREEN_H__ #define __MENUITEMFULLSCREEN_H__ #include #include "MenuItem.h" #include "globals.h" class MenuItemFullScreen: public MenuItem { public: MenuItemFullScreen() { } std::string getLabel() { return configuration.fullscreen?"Fullscreen: Yes":"Fullscreen: No"; } void apply() { if ( configuration.fullscreen ) screenFlags |= SDL_FULLSCREEN; else screenFlags = (screenFlags & ~SDL_FULLSCREEN); } int execute(std::stack &s) { SDL_FreeSurface(screen); configuration.fullscreen = !configuration.fullscreen; apply(); screen = SDL_SetVideoMode(configuration.resolution.x, // SCREEN_HEIGHT(), BPP, screenFlags); configuration.resolution.y, videoinfo->vfmt->BitsPerPixel, screenFlags); return(0); } }; #endif gav-0.9.0/menu/MenuItemExit.h0000644000000000000000000000204707515505165014501 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMEXIT_H__ #define __MENUITEMEXIT_H__ #include "MenuItem.h" #include class MenuItemExit: public MenuItem { public: MenuItemExit() {label = (std::string)"Exit";} int execute(std::stack &s) {exit(0);} }; #endif gav-0.9.0/menu/MenuItemMonitor.h0000644000000000000000000000350610355242121015202 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMMONITOR_H__ #define __MENUITEMMONITOR_H__ #include #include "MenuItem.h" #include "globals.h" class MenuItemMonitor: public MenuItem { public: MenuItemMonitor() { setLabel(); } void setLabel() { std::string monitor; switch ( configuration.monitor_type ) { case MONITOR_NORMAL: monitor = "Normal"; break; case MONITOR_OLD: monitor = "Old"; break; case MONITOR_VERYOLD: monitor = "Very old"; break; case MONITOR_VERYVERYOLD: monitor = "Very, very old"; break; } label = std::string("Monitor Type: ") + monitor; } void apply() { if ( !configuration.monitor_type ) SDL_SetAlpha(background->surface(), 0, 0); else SDL_SetAlpha(background->surface(), SDL_SRCALPHA | SDL_RLEACCEL, 128 - (configuration.monitor_type * 30)); } int execute(std::stack &s) { configuration.monitor_type = (configuration.monitor_type + 1)%4; apply(); setLabel(); return(0); } }; #endif gav-0.9.0/menu/MenuItemNotImplemented.h0000644000000000000000000000257107551664610016517 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMNOTIMPLEMENTED_H__ #define __MENUITEMNOTIMPLEMENTED_H__ #include #include "MenuItem.h" #include "globals.h" class MenuItemNotImplemented: public MenuItem { std::string msg; public: MenuItemNotImplemented(std::string l) { label = l; msg = (std::string)"Menu Item Not Yet Implemented"; } int execute(std::stack &s) { SDL_Rect r; r.x = (screen->w / 2) - msg.length()*(cga->charWidth())/2; r.y = screen->h * 2/3; cga->printXY(screen, &r, msg.c_str()); SDL_Flip(screen); SDL_Delay(1000); return(0); } }; #endif gav-0.9.0/menu/Makefile.cross.w320000644000000000000000000000217107571424466015161 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. RELPATH = menu include ../CommonHeader NAME = menu CXXFLAGS += -I$(GAV_ROOT) DEPEND = Makefile.depend .PHONY: all all: $(OFILES) ($OFILES): $(SRCS) $(CXX) -c $(CXXFLAGS) $< clean: rm -f *.o *.bin *~ $(DEPEND) depend: $(RM) $(DEPEND) $(CXX) $(CXXFLAGS) -M $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/menu/MenuItemPlay.h0000644000000000000000000000207407616576232014502 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMPLAY_H__ #define __MENUITEMPLAY_H__ #include "MenuItem.h" #include "AutomaMainLoop.h" class MenuItemPlay: public MenuItem { public: MenuItemPlay() {label = (std::string)"Play";} int execute(std::stack &s) {return STATE_PLAYING;} }; #endif gav-0.9.0/menu/MenuKeys.h0000644000000000000000000000637607574246627013707 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUKEYS_H__ #define __MENUKEYS_H__ #include #include "MenuItem.h" #include "globals.h" enum { PL1L, PL1R, PL1J, PL2L, PL2R, PL2J }; class MenuKeys: public Menu { int state; bool isPressed, isStillPressed; int _base; public: MenuKeys(int base) { _base = base; state = PL1L; isPressed = false; isStillPressed = false; } virtual int execute(InputState *is, std::stack &s) { char numb[20]; SDL_Rect rect; SDL_Event event = is->getEvent(); rect.y = 30; rect.x = 30; isStillPressed = (isPressed && (event.type == SDL_KEYDOWN)); if ( !isStillPressed ) isPressed = false; sprintf(numb, "Player %d ", 2*_base + ((state <= PL1J)?1:2)); std::string st(numb); switch ( state ) { case PL1L: st += "Left: "; cga->printXY(screen, &rect, st.c_str()); if ( ( event.type != SDL_KEYDOWN ) || isStillPressed ) return(0); controlsArray->setControl(2*_base, CNTRL_LEFT, event.key.keysym.sym); break; case PL1R: st += "Right: "; cga->printXY(screen, &rect, st.c_str()); if ( ( event.type != SDL_KEYDOWN ) || isStillPressed ) return(0); controlsArray->setControl(2*_base, CNTRL_RIGHT, event.key.keysym.sym); break; case PL1J: st += "Jump: "; cga->printXY(screen, &rect, st.c_str()); if ( ( event.type != SDL_KEYDOWN ) || isStillPressed ) return(0); controlsArray->setControl(2*_base, CNTRL_JUMP, event.key.keysym.sym); break; case PL2L: st += "Left: "; cga->printXY(screen, &rect, st.c_str()); if ( ( event.type != SDL_KEYDOWN ) || isStillPressed ) return(0); controlsArray->setControl(2*_base + 1, CNTRL_LEFT, event.key.keysym.sym); break; case PL2R: st += "Right: "; cga->printXY(screen, &rect, st.c_str()); if ( ( event.type != SDL_KEYDOWN ) || isStillPressed ) return(0); controlsArray->setControl(2*_base + 1, CNTRL_RIGHT, event.key.keysym.sym); // event.key.keysym.sym break; case PL2J: st += "Jump: "; cga->printXY(screen, &rect, st.c_str()); if ( ( event.type != SDL_KEYDOWN ) || isStillPressed ) return(0); controlsArray->setControl(2*_base + 1, CNTRL_JUMP, event.key.keysym.sym); // event.key.keysym.sym break; } isPressed = ( event.type == SDL_KEYDOWN ); if ( state == PL2J ) { s.pop(); state = 0; } else state++; return(NO_TRANSITION); } }; #endif gav-0.9.0/menu/MenuItemJoystick.h0000644000000000000000000000326510361725174015367 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMJOYSTICK_H__ #define __MENUITEMJOYSTICK_H__ #include #include "MenuItem.h" #include "globals.h" class MenuItemJoystick: public MenuItem { int _joyId; int _plId; char nstr[10]; public: MenuItemJoystick(int plId, int init) { _joyId = init; _plId = plId; setLabel(); } void setLabel() { label = "Player "; sprintf(nstr, "%d", _plId/2 + 1); label += std::string(nstr); if ( _plId % 2 ) label += " right: "; else label += " left: "; if ( _joyId == -1 ) label += "Not Present"; else { sprintf(nstr, "%d", _joyId); label += "Joystick " + std::string(nstr); } } int execute(std::stack &s) { _joyId = (_joyId+1+1)%(controlsArray->getNJoysticks()+1) - 1; controlsArray->assignJoystick(_plId, _joyId); setLabel(); return(0); } }; #endif // __MENUITEMJOYSTICK_H__ gav-0.9.0/menu/MenuItemSubMenu.h0000644000000000000000000000214607515505165015146 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMSUBMENU_H__ #define __MENUITEMSUBMENU_H__ #include "Menu.h" #include "MenuItem.h" class MenuItemSubMenu: public MenuItem { Menu * submenu; public: MenuItemSubMenu(Menu * m, std::string l): submenu(m) {label = l;} int execute(std::stack &s) {s.push(submenu); return 0;} }; #endif gav-0.9.0/menu/MenuItemBack.h0000644000000000000000000000212407574223236014425 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMBACK_H__ #define __MENUITEMBACK_H__ #include #include "MenuItem.h" #include "globals.h" class MenuItemBack: public MenuItem { public: MenuItemBack(std::string l) { label = l; } int execute(std::stack &s) { s.pop(); return(0); } }; #endif gav-0.9.0/menu/Makefile.Linux0000644000000000000000000000233607571424466014520 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. RELPATH = menu include ../CommonHeader NAME = menu MODULE_NAME = $(NAME)_module.o CXXFLAGS += -I$(GAV_ROOT) DEPEND = Makefile.depend .PHONY: all all: $(MODULE_NAME) $(MODULE_NAME): $(OFILES) $(LD) -r $(OFILES) -o $(MODULE_NAME) ($OFILES): $(SRCS) $(CXX) -c $(CXXFLAGS) $< clean: rm -f *.o *.bin *~ $(DEPEND) depend: $(RM) $(DEPEND) $(CXX) $(CXXFLAGS) -M $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/menu/MenuItemServer.h0000644000000000000000000000226410025313313015015 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMSERVER_H__ #define __MENUITEMSERVER_H__ #include "MenuItem.h" #include "AutomaMainLoop.h" #ifndef NONET #include "NetServer.h" #endif class MenuItemServer: public MenuItem { public: MenuItemServer() {label = (std::string)"Start as server";} int execute(std::stack &s) { #ifndef NONET nets = new NetServer(); #endif return STATE_PLAYING; } }; #endif gav-0.9.0/menu/Makefile0000644000000000000000000000233607571417734013422 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. RELPATH = menu include ../CommonHeader NAME = menu MODULE_NAME = $(NAME)_module.o CXXFLAGS += -I$(GAV_ROOT) DEPEND = Makefile.depend .PHONY: all all: $(MODULE_NAME) $(MODULE_NAME): $(OFILES) $(LD) -r $(OFILES) -o $(MODULE_NAME) ($OFILES): $(SRCS) $(CXX) -c $(CXXFLAGS) $< clean: rm -f *.o *.bin *~ $(DEPEND) depend: $(RM) $(DEPEND) $(CXX) $(CXXFLAGS) -M $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/menu/MenuItemScore.h0000644000000000000000000000242110116075506014627 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMSCORE_H__ #define __MENUITEMSCORE_H__ #include #include "MenuItem.h" #include "globals.h" class MenuItemScore: public MenuItem { public: MenuItemScore() { setLabel(); } void setLabel() { label = "Winning Score: " + configuration.toString(configuration.winning_score); } int execute(std::stack &s) { configuration.winning_score = (configuration.winning_score%50)+5; setLabel(); return(0); } }; #endif gav-0.9.0/menu/MenuItemNotCompiled.h0000644000000000000000000000255207721142230015773 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMNOTCOMPILED_H__ #define __MENUITEMNOTCOMPILED_H__ #include #include "MenuItem.h" #include "globals.h" class MenuItemNotCompiled: public MenuItem { std::string msg; public: MenuItemNotCompiled(std::string l) { label = l; msg = (std::string)"Functionality not compiled"; } int execute(std::stack &s) { SDL_Rect r; r.x = (screen->w / 2) - msg.length()*(cga->charWidth())/2; r.y = screen->h * 2/3; cga->printXY(screen, &r, msg.c_str()); SDL_Flip(screen); SDL_Delay(1000); return(0); } }; #endif gav-0.9.0/menu/MenuItemSave.h0000644000000000000000000000267710117561731014470 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMSAVE_H__ #define __MENUITEMSAVE_H__ #include #include #include "MenuItem.h" #include "globals.h" class MenuItemSave: public MenuItem { public: MenuItemSave() { label = std::string("Save Preferences"); } int execute(std::stack &s) { std::string msg = "Configuration saved."; if ( configuration.createConfigurationFile() == -1 ) msg = "Could not save configuration"; SDL_Rect r; r.x = (screen->w / 2) - msg.length()*(cga->charWidth())/2; r.y = screen->h * 2/3; cga->printXY(screen, &r, msg.c_str()); SDL_Flip(screen); SDL_Delay(1000); return(0); } }; #endif gav-0.9.0/menu/MenuRoot.h0000644000000000000000000000214707515505165013675 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUROOT_H__ #define __MENUROOT_H__ #include #include "Menu.h" #include "InputState.h" class MenuRoot { std::stack menus; public: MenuRoot() {} inline void add(Menu * m) {menus.push(m);} int execute(InputState *is) { return (menus.top())->execute(is, menus); } }; #endif gav-0.9.0/menu/MenuItemTheme.h0000644000000000000000000000257007634620214014626 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMTHEME_H__ #define __MENUITEMTHEME_H__ #include #include #include "MenuItem.h" #include "globals.h" class MenuItemTheme: public MenuItem { public: MenuItemTheme(std::string l) { label = l; } int execute(std::stack &s) { std::string oldName; oldName = CurrentTheme->name(); try { delete(CurrentTheme); CurrentTheme = new Theme(label); } catch (Theme::ThemeErrorException te) { std::cerr << te.message << std::endl; CurrentTheme = new Theme(oldName); } return(0); } }; #endif gav-0.9.0/menu/MenuItem.h0000644000000000000000000000222610116077556013645 0ustar rootroot/* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEM_H__ #define __MENUITEM_H__ #include #include #include "InputState.h" class Menu; class MenuItem { protected: std::string label; public: MenuItem() {} inline void setLabel(std::string l) {label = l;} virtual std::string getLabel() {return label;} virtual int execute(std::stack &s) = 0; virtual ~MenuItem() {} }; #endif gav-0.9.0/menu/MenuItemFPS.h0000644000000000000000000000243207576447135014227 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMFPS_H__ #define __MENUITEMFPS_H__ #include #include "MenuItem.h" #include "globals.h" class MenuItemFPS: public MenuItem { public: MenuItemFPS() { setLabel(); } void setLabel() { char fs[10]; sprintf(fs, "%d", configuration.fps); label = std::string("Frames per second: ") + std::string(fs); } int execute(std::stack &s) { configuration.setFps((configuration.fps % 100) + 10); setLabel(); return(0); } }; #endif gav-0.9.0/menu/MenuItemFrameSkip.h0000644000000000000000000000247707575440103015454 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMFRAMESKIP_H__ #define __MENUITEMFRAMESKIP_H__ #include #include "MenuItem.h" #include "globals.h" class MenuItemFrameSkip: public MenuItem { public: MenuItemFrameSkip() { setLabel(); } void setLabel() { char fs[10]; sprintf(fs, "%d", configuration.frame_skip); label = std::string("Frameskip: ") + std::string(fs); } int execute(std::stack &s) { configuration.frame_skip = (configuration.frame_skip + 1)%10; setLabel(); return(0); } }; #endif gav-0.9.0/menu/Menu.h0000644000000000000000000000233507574223236013031 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENU_H__ #define __MENU_H__ #include #include #include "MenuItem.h" #include "ScreenFont.h" #include "InputState.h" class Menu { std::vector items; int currentItem; unsigned int maxLabelLength; public: Menu(): currentItem(-1), maxLabelLength(0) {} virtual void add(MenuItem * mi); virtual int execute(InputState *is, std::stack &s); virtual ~Menu() {} }; #endif gav-0.9.0/menu/Menu.cpp0000644000000000000000000000421010355262416013350 0ustar rootroot#include "Menu.h" #include #include "SoundMgr.h" using namespace std; void Menu::add(MenuItem * mi) { if (currentItem < 0) currentItem = 0; if ((mi->getLabel()).length() > maxLabelLength) maxLabelLength = (mi->getLabel()).length(); items.push_back(mi); } int Menu::execute(InputState *is, std::stack &s) { SDL_Rect rect; const char * label; ScreenFont * font; static bool spacePressed = false; static bool PrevUp = false; static bool PrevDown = false; // Up if (is->getKeyState()[SDLK_UP]) { if (!PrevUp) { if (currentItem > 0) { currentItem--; #ifdef AUDIO soundMgr->playSound (SND_MENU_SELECT); #endif } else { currentItem=(int)(items.size()-1); #ifdef AUDIO soundMgr->playSound (SND_MENU_SELECT); #endif } PrevUp = true; } } else PrevUp =false; // Down if (is->getKeyState()[SDLK_DOWN]) { if (!PrevDown) { if (currentItem < (int)(items.size()-1)) { currentItem++; #ifdef AUDIO soundMgr->playSound (SND_MENU_SELECT); #endif } else { currentItem=0; #ifdef AUDIO soundMgr->playSound (SND_MENU_SELECT); #endif } PrevDown = true; } } else PrevDown = false; // draw menu items labels rect.y = configuration.CEILING + configuration.env.h/100; for ( unsigned int it = 0; it < items.size(); it++ ) { label = items[it]->getLabel().c_str(); rect.x = (configuration.env.w / 2) - strlen(label)*(cga->charWidth())/2; // UGLY if (it == (unsigned int) currentItem) font = cgaInv; else font = cga; font->printXY(screen, &rect, items[it]->getLabel().c_str()); rect.y += font->charHeight(); } // call the execute method of the current item, if an event occurred if ( (is->getKeyState()[SDLK_SPACE]) || (is->getKeyState()[SDLK_RETURN]) ) { spacePressed = true; } if ( spacePressed && !(is->getKeyState()[SDLK_SPACE]) && !(is->getKeyState()[SDLK_RETURN]) ) { spacePressed = false; #ifdef AUDIO soundMgr->playSound(SND_MENU_ACTIVATE); #endif // AUDIO return items[currentItem]->execute(s); } return 0; } gav-0.9.0/menu/MenuItemBallSpeed.h0000644000000000000000000000332010116075506015406 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMBALLSPEED_H__ #define __MENUITEMBALLSPEED_H__ #include #include "MenuItem.h" #include "globals.h" #define BALL_SPEED_ITEMS 3 class MenuItemBallSpeed: public MenuItem { char * _item[BALL_SPEED_ITEMS]; int _currItem; public: MenuItemBallSpeed() { if (configuration.ballAmplify == DEFAULT_BALL_AMPLIFY) _currItem = 0; else if ( configuration.ballAmplify == DEFAULT_BALL_AMPLIFY + BALL_SPEED_INC ) _currItem = 1; else _currItem = 2; _item[0] = "Normal"; _item[1] = "Fast"; _item[2] = "Too Fast!"; setLabel(); } void setLabel() { label = std::string("Ball Speed: ") + std::string(_item[_currItem]); } int execute(std::stack &s) { _currItem = (_currItem + 1) % BALL_SPEED_ITEMS; configuration.ballAmplify = DEFAULT_BALL_AMPLIFY + BALL_SPEED_INC * _currItem; setLabel(); return(0); } }; #endif gav-0.9.0/menu/MenuItemPlayer.h0000644000000000000000000000462210361725174015022 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMPLAYER_H__ #define __MENUITEMPLAYER_H__ #include #include #include "MenuItem.h" #include "globals.h" enum { TEAM_LEFT = 0, TEAM_RIGHT}; class MenuItemPlayer: public MenuItem { private: std::string prefix; int team; int index; public: MenuItemPlayer(int tm, int idx) { team = tm; index = idx; char numb[10]; sprintf(numb, "%d", idx*2 + tm + 1); prefix = std::string("Player ") + numb + ": "; setLabel(); } void setLabel() { int *src = (team == TEAM_LEFT)?configuration.left_players:configuration.right_players; std::string postfix; switch ( src[index] ) { case PLAYER_NONE: postfix = std::string("None"); break; case PLAYER_COMPUTER: postfix = std::string("Computer / Net"); break; case PLAYER_HUMAN: postfix = std::string("Keyboard / Joy"); break; } label = prefix + postfix; } int execute(std::stack &s) { int *src = (team == TEAM_LEFT)?configuration.left_players:configuration.right_players; switch ( src[index] ) { case PLAYER_NONE: src[index] = PLAYER_HUMAN; if ( team == TEAM_LEFT ) configuration.left_nplayers++; else configuration.right_nplayers++; break; case PLAYER_HUMAN: src[index] = PLAYER_COMPUTER; break; case PLAYER_COMPUTER: if ( index ) { src[index] = PLAYER_NONE; if ( team == TEAM_LEFT ) configuration.left_nplayers--; else configuration.right_nplayers--; } else src[index] = PLAYER_HUMAN; break; } setLabel(); return(0); } }; #endif gav-0.9.0/menu/MenuItemSound.h0000644000000000000000000000240607721005600014643 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMSOUND_H__ #define __MENUITEMSOUND_H__ #include #include "MenuItem.h" #include "globals.h" class MenuItemSound: public MenuItem { public: MenuItemSound() { label = std::string(configuration.sound?"Sound: On":"Sound: Off"); } int execute(std::stack &s) { configuration.sound = (!configuration.sound); label = std::string(configuration.sound?"Sound: On":"Sound: Off"); return(0); } }; #endif // __MENUITEMSOUND_H__ gav-0.9.0/menu/MenuThemes.h0000644000000000000000000000242407574223236014176 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUTHEMES_H__ #define __MENUTHEMES_H__ #include #include "MenuItem.h" #include "globals.h" class MenuThemes: public Menu { bool firstTime; public: MenuThemes(ScreenFont *nf, ScreenFont *rf) { normal_font = nf; selected_font = rf; firstTime = false; } virtual int execute(InputState *is, std::stack &s) { if ( firstTime ) { DIR *dir; if ((dir = opendir(ThemeDir.c_str())) ) } Menu::execute(is, s); } }; #endif gav-0.9.0/menu/MenuItemBigBackground.h0000644000000000000000000000340110116077556016263 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMBIGBACKGROUND_H__ #define __MENUITEMBIGBACKGROUND_H__ #include #include #include "MenuItem.h" #include "globals.h" class MenuItemBigBackground: public MenuItem { public: MenuItemBigBackground() { label = std::string("Big Background: ") + (configuration.bgBig?"Yes":"No"); } int execute(std::stack &s) { const char * currThemeName; configuration.bgBig = !configuration.bgBig; label = std::string(configuration.bgBig?"Big Background: Yes":"Big Background: No"); currThemeName = CurrentTheme->name(); try { delete(CurrentTheme); CurrentTheme = new Theme(currThemeName); } catch (Theme::ThemeErrorException te) { std::cerr << te.message << std::endl; configuration.bgBig = !configuration.bgBig; label = std::string(configuration.bgBig?"Big Background: Yes":"Big Background: No"); CurrentTheme = new Theme(currThemeName); } return(0); } }; #endif gav-0.9.0/menu/MenuItemClient.h0000644000000000000000000000212007616576402015002 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MENUITEMCLIENT_H__ #define __MENUITEMCLIENT_H__ #include "MenuItem.h" #include "AutomaMainLoop.h" class MenuItemClient: public MenuItem { public: MenuItemClient() {label = (std::string)"Start as client";} int execute(std::stack &s) { return STATE_CLIENT; } }; #endif gav-0.9.0/LogicalFrameSeq.cpp0000644000000000000000000000352110355242120014470 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "LogicalFrameSeq.h" #include "GameRenderer.h" #include "globals.h" using namespace std; /* start - the starting width zoom - the zoom factor calculated from background ratio step - the new width must be a 'step' multiple returns the zoom factor nearest to 'zoom', in order to obtain a 'step' multiple. */ double exactScaleFactor(int startw, double zoom, int step) { if ( step == 1 ) return zoom; double corr = 0.0; double ratio = 1/zoom; double fract = (double) startw / ratio; int temp = (int) round(fract / step); int adjustedResize = temp * step; // printf("W: %d NP: %d\n", startw, temp); double adjustedRatio = (double) startw / (double) adjustedResize; /* int tmp2 = (int) (startw / adjustedRatio); // printf ("ar: %g tmp2: %d\n", adjustedRatio, tmp2); if ( tmp2 < adjustedResize ) corr = 0.5; */ return (1/adjustedRatio + (corr/(double) startw)); } void LogicalFrameSeq::blit(int idx, SDL_Surface *dest, SDL_Rect *rect) { gameRenderer->display(dest, rect, _actualFrameSeq, idx); } gav-0.9.0/main.cpp0000644000000000000000000001566410361725173012444 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include "globals.h" #include "ScreenFont.h" #include "AutomaMainLoop.h" #include "StatePlaying.h" #include "StateMenu.h" #include "MenuRoot.h" #include "Menu.h" #include "MenuItem.h" #include "MenuItemSubMenu.h" #include "MenuItemPlay.h" #include "MenuItemExit.h" #include "MenuItemPlayer.h" #include "MenuItemSound.h" #include "MenuItemNotImplemented.h" #include "MenuItemNotCompiled.h" #include "MenuKeys.h" #include "MenuItemBack.h" #include "MenuItemTheme.h" #include "MenuItemFullScreen.h" #include "MenuItemFrameSkip.h" #include "MenuItemFPS.h" #include "MenuItemScore.h" #include "MenuItemMonitor.h" #include "MenuItemBigBackground.h" #include "MenuItemBallSpeed.h" #include "MenuItemSave.h" #include "MenuItemJoystick.h" #ifndef NONET #include "MenuItemClient.h" #include "MenuItemServer.h" #endif #include "Theme.h" #include "Sound.h" #ifndef NONET #include "NetClient.h" #include "NetServer.h" #endif #define BPP 16 using namespace std; #ifdef AUDIO SDL_AudioSpec desired,obtained; SoundMgr * soundMgr = NULL; playing_t playing[MAX_PLAYING_SOUNDS]; void AudioCallBack(void *user_data,Uint8 *audio,int length) { int i; //memset(audio,0 , length); if (!configuration.sound) return; for(i=0; i samples; sound_buf += playing[i].position; if((playing[i].position +length)>playing[i].sound->length){ sound_len = playing[i].sound->length - playing[i].position; } else { sound_len=length; } SDL_MixAudio(audio,sound_buf,sound_len,VOLUME_PER_SOUND); playing[i].position+=length; if(playing[i].position>=playing[i].sound->length){ if (!playing[i].loop) playing[i].active=0; else playing[i].position = 0; } } } } void initJoysticks() { for ( int i = 0; i < SDL_NumJoysticks(); i++ ) { } } void ClearPlayingSounds(void) { int i; for(i=0;i void parseArgs(int argc, char *argv[]) { int i = 1; int resx = -1; int resy = -1; for ( ; i < argc; i++ ) { if ( !strcmp("-w", argv[i]) ) { resx = atoi(argv[++i]); } else if ( !strcmp("-h", argv[i]) ) { resy = atoi(argv[++i]); } } if ( (resx > 0) && (resy >0) ) configuration.setDesiredResolution(resx, resy); } int main(int argc, char *argv[]) { parseArgs(argc, argv); init(); #ifdef AUDIO #if 0 Prova = new Sound("rocket.wav"); Prova->playSound(); #endif #endif /* initialize menus */ Menu m; MenuItemPlay miplay; MenuItemExit miexit; Menu *menuExtra = new Menu(); Menu *menuThemes = new Menu(); Menu *menuJoystick = new Menu(); #ifndef NONET Menu *menuNetwork = new Menu(); #endif MenuItemBack *mib = new MenuItemBack("back"); DIR *dir; if ((dir = opendir(ThemeDir.c_str())) == NULL) { std::cerr << "Cannot find themes directory\n"; exit(0); } struct dirent *themeDir; do { themeDir = readdir(dir); if ( themeDir && (themeDir->d_name[0] != '.') ) menuThemes->add(new MenuItemTheme(string(themeDir->d_name))); } while (themeDir); closedir(dir); menuThemes->add(mib); #ifndef NONET menuNetwork->add(new MenuItemServer()); menuNetwork->add(new MenuItemClient()); menuNetwork->add(mib); #endif menuExtra->add(new MenuItemSubMenu(menuThemes, string("Theme"))); #ifndef NONET menuExtra->add(new MenuItemSubMenu(menuNetwork, string("Network game"))); #endif menuExtra->add(new MenuItemPlayer(TEAM_LEFT, 1)); menuExtra->add(new MenuItemPlayer(TEAM_RIGHT, 1)); menuExtra->add(new MenuItemSubMenu(new MenuKeys(1), string("Define Keys"))); menuExtra->add(new MenuItemFPS()); menuExtra->add(new MenuItemFrameSkip()); menuExtra->add(new MenuItemScore()); menuExtra->add(new MenuItemMonitor()); menuExtra->add(new MenuItemBallSpeed()); menuExtra->add(new MenuItemBigBackground()); menuExtra->add(new MenuItemFullScreen()); menuExtra->add(new MenuItemSave()); menuExtra->add(mib); for (int plId = 0; plId < MAX_PLAYERS; plId++ ) { menuJoystick->add(new MenuItemJoystick(plId, -1)); } menuJoystick->add(mib); m.add(&miplay); m.add(new MenuItemPlayer(TEAM_LEFT, 0)); m.add(new MenuItemPlayer(TEAM_RIGHT, 0)); #ifdef AUDIO m.add(new MenuItemSound()); #else // AUDIO m.add(new MenuItemNotCompiled(string("Sound: Off"))); #endif // AUDIO m.add(new MenuItemSubMenu(new MenuKeys(0), string("Define Keys"))); m.add(new MenuItemSubMenu(menuJoystick, string("Set Joystick"))); m.add(new MenuItemSubMenu(menuExtra, string("Extra"))); m.add(&miexit); mroot = new MenuRoot(); mroot->add(&m); AutomaMainLoop *a = new AutomaMainLoop(); a->start(); return 0; } gav-0.9.0/ControlsArray.h0000644000000000000000000000512510361725173013756 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __CONTROLSARRAY_H__ #define __CONTROLSARRAY_H__ #include #include "InputState.h" #include "globals.h" class Team; typedef struct { int left_key; int right_key; int jump_key; } controls_t; #define MAX_JOYS (4) typedef enum { CNTRL_LEFT = 1, CNTRL_RIGHT = 2, CNTRL_JUMP = 4} cntrl_t; class ControlsArray { triple_t _inputs[MAX_PLAYERS]; controls_t _keyMapping[MAX_PLAYERS]; /* vector from playerId to SDL_Joystick * */ SDL_Joystick *_joyMapping[MAX_PLAYERS]; Uint8 _f[12]; int _nJoys; SDL_Joystick *_joys[MAX_JOYS]; public: ControlsArray() { memset(_inputs, 0, MAX_PLAYERS * sizeof(triple_t)); memset(_f, 0, 12); for ( int i = 0; i < MAX_PLAYERS; i++ ) _joyMapping[i] = NULL; _nJoys = SDL_NumJoysticks(); if ( _nJoys > MAX_JOYS) _nJoys = MAX_JOYS; for ( int i = 0; i < _nJoys; i++ ) _joys[i] = SDL_JoystickOpen(i); initializeControls(); } controls_t getControls(int plId) { return _keyMapping[plId]; } void setControls(int plId, controls_t ctrls) { _keyMapping[plId] = ctrls; } int getNJoysticks() { return _nJoys; } void assignJoystick(int plId, int joyId) { if ( joyId == -1 ) _joyMapping[plId] = NULL; else _joyMapping[plId] = _joys[joyId%_nJoys]; } // void addChannel(){} void setControl(int plId, cntrl_t cntrl, int keysym) { controls_t *t = &_keyMapping[plId]; switch ( cntrl ) { case CNTRL_LEFT: t->left_key = keysym; break; case CNTRL_RIGHT: t->right_key = keysym; break; case CNTRL_JUMP: t->jump_key = keysym; break; } } void initializeControls(); void setControlsState(InputState *is, Team * tl, Team * tr); inline triple_t getCommands(int idx) { return _inputs[idx];} }; #endif // __CONROLSARRAY_H__ gav-0.9.0/ControlsArray.cpp0000644000000000000000000000561210361725173014312 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include "InputState.h" #include "ControlsArray.h" #include "vector" #include "Player.h" #include "Team.h" #include "PlayerAI.h" #ifndef NONET #include "NetServer.h" #endif #define JOY_THRESHOLD (10000) void ControlsArray::initializeControls() { _keyMapping[0].left_key = SDLK_z; _keyMapping[0].right_key = SDLK_c; _keyMapping[0].jump_key = SDLK_LSHIFT; _keyMapping[1].left_key = SDLK_LEFT; _keyMapping[1].right_key = SDLK_RIGHT; _keyMapping[1].jump_key = SDLK_UP; _keyMapping[2].left_key = SDLK_h; _keyMapping[2].right_key = SDLK_k; _keyMapping[2].jump_key = SDLK_u; _keyMapping[3].left_key = SDLK_s; _keyMapping[3].right_key = SDLK_f; _keyMapping[3].jump_key = SDLK_e; // _joyMapping[0] = SDL_JoystickOpen(0); } void ControlsArray::setControlsState(InputState *is, Team * tl, Team * tr) { Uint8 *keystate = is->getKeyState(); int i = 0; std::vector players; SDL_JoystickUpdate(); #ifndef NONET int player; char cmd; if (nets) while ( nets->ReceiveCommand(&player, &cmd) != -1 ) { _inputs[player].left = cmd & CNTRL_LEFT; _inputs[player].right = cmd & CNTRL_RIGHT; _inputs[player].jump = cmd & CNTRL_JUMP; } #endif players = tl->players(); for (i = 0; i < 2; i++) { for ( std::vector::const_iterator it = players.begin(); it != players.end(); it++ ) { if ( (*it)->getCtrl() == PL_CTRL_HUMAN ) { int plId = (*it)->id(); /* first check the keyboard */ _inputs[plId].left = keystate[_keyMapping[plId].left_key]; _inputs[plId].right = keystate[_keyMapping[plId].right_key]; _inputs[plId].jump = keystate[_keyMapping[plId].jump_key]; /* then check the joystick */ SDL_Joystick *js = _joyMapping[plId]; if ( js ) { _inputs[plId].left |= (SDL_JoystickGetAxis(js, 0) < -JOY_THRESHOLD); _inputs[plId].right |= (SDL_JoystickGetAxis(js, 0) > JOY_THRESHOLD); _inputs[plId].jump |= SDL_JoystickGetButton(js, 0); } } else if ( (*it)->getCtrl() == PL_CTRL_AI ) { _inputs[(*it)->id()] = ((PlayerAI *) (*it))->planAction(); } } players = tr->players(); } } gav-0.9.0/Ball.cpp0000644000000000000000000002421610435057207012361 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "Ball.h" #define PI 3.14158 #define GRAVITY 250 #define MAX_TOUCHES 3 #define MIN(a,b) ((ab)?a:b) using namespace std; bool Ball::approaching(int spdx, float spdy) { int sgnx = (spdx>0)?1:(spdx<0)?-1:0; int sgny = (spdy>0)?1:(spdy<0)?-1:0; if ( ((spdx - _spdx) * sgnx) >= 0 ) return(true); if ( ((spdy - _spdy) * sgny) >= 0 ) return(true); return(false); } // evaluates a collision ("sprite"-wise) bool Ball::spriteCollide(Player *p) { SDL_Rect r; r.x = _x; r.y = _y; return(p->collidesWith(_frames, _frameIdx, &r)); } // evaluate a collision bool Ball::collide(Player *p) { return( approaching(p->speedX(), - p->speedY()) && spriteCollide(p) ); } void Ball::update_internal(Player * pl) { int cplx = pl->x() + pl->width() / 2; int cply = pl->y() + pl->height() / 2; int cbx = _x + _frames->width() / 2; int cby = _y + _frames->height() / 2; int dx = (cplx - cbx); int dy = (cply - cby); float beta = dx?atan((float) dy/ (float) dx):(PI/2); float sinb = sin(-beta); float cosb = cos(-beta); float x1, y1; /* service patch */ if (!_spdy && !_spdx) { _spdy = -200; //_spdx = (_x > configuration.NET_X)?-100:100; } y1 = _spdx * sinb + (- _spdy) * cosb; x1 = configuration.ballAmplify * (pl->speedX() * cosb - pl->speedY() * sinb); int oldspdy = _spdy; _spdx = (int) (x1 * cos(beta) - y1 * sin(beta)); _spdy = (int) (- (x1 * sin(beta) + y1 * cos(beta))); if ( (pl->speedX() - _spdx) * dx < 0) _spdx = pl->speedX(); if ( (pl->speedY() - _spdy) * dy > 0) _spdy = (int) pl->speedY(); #define MIN_POS_SPD 100 if ( (_spdy < MIN_POS_SPD) && (cby < cply) ) _spdy = (int) ((1.1 * ELASTIC_SMOOTH) * abs(oldspdy)); } void Ball::assignPoint(int side, Team *t) { if ( _side == side ) { t->score(); #ifdef AUDIO soundMgr->playSound(SND_SCORE); #endif // AUDIO } else { #ifdef AUDIO soundMgr->playSound(SND_SERVICECHANGE); #endif // AUDIO } _side = side; _x = (configuration.NET_X) + side * (configuration.SCREEN_WIDTH/4) - _radius; //((configuration.SCREEN_WIDTH * _side) / 4); _y = ((configuration.SCREEN_HEIGHT * 2) / 3) - _radius ; _spdx = _spdy = _accelY = 0; _scorerSide = 0; resetCollisionCount(); } void Ball::resetCollisionCount() { for (map::iterator it = _collisionCount.begin(); it != _collisionCount.end(); it++ ) { it->second = 0; } } void Ball::resetPos(int x, int y) { _side = -1; _scorerSide = 0; _x = x; _y = y; _spdx = _spdy = 0; _accelY = 0; resetCollisionCount(); } void Ball::draw(SDL_Surface *scr) { SDL_Rect rect; rect.x = _x; rect.y = _y; _frames->blit(_frameIdx, scr, &rect); } float Ball::distance(int x, int y) { int bx = _x + _frames->width()/2; // center of the ball int by = _y + _frames->height()/2; return(sqrt((double) (x - bx)*(x - bx) + (y - by) * (y - by))); } bool Ball::netPartialCollision(int x, int y) { int xmin, xmax, ymin, ymax; xmin = MIN(x, _oldx); xmax = MAX(x, _oldx); ymin = MIN(y, _oldy); ymax = MAX(y, _oldy); if ((xmin < configuration.NET_X) && (xmax > configuration.NET_X)) { int collisionY = (configuration.NET_X - xmin) * (ymax - ymin)/(xmax - xmin) + ymin; if ( (collisionY < configuration.NET_Y ) && (collisionY > configuration.NET_Y - _frames->height()/2) ) return true; } return((x + _frames->width() > configuration.NET_X) && (x < configuration.NET_X) && ( distance(configuration.NET_X, configuration.NET_Y) < (_frames->width()/2)) ); /* (y + _frames->height()/2 < configuration.NET_Y) && (y + _frames->height() > configuration.NET_Y)); */ } bool Ball::netFullCollision(int x, int y) { int xmin, xmax, ymin, ymax; xmin = MIN(x, _oldx); xmax = MAX(x, _oldx); ymin = MIN(y, _oldy); ymax = MAX(y, _oldy); if ((xmin < configuration.NET_X) && (xmax > configuration.NET_X)) { int collisionY = (configuration.NET_X - xmin) * (ymax - ymin)/(xmax - xmin) + ymin; if ( collisionY > configuration.NET_Y ) return true; } return((x + _frames->width() > configuration.NET_X) && (x < configuration.NET_X) && (y + _frames->height()/2 >= configuration.NET_Y)); } void Ball::updateFrame(int passed) { static int overallPassed = 0; overallPassed += passed; if (overallPassed > (configuration.ballFrameConf.ballPeriod/ configuration.ballFrameConf.nBallFrames)) { overallPassed = 0; _frameIdx = (_frameIdx + 1) % configuration.ballFrameConf.nBallFrames; } } // updates the ball position, knowing 'passed' milliseconds went // away void Ball::update(int passed, Team *tleft, Team *tright) { int dx, dy; updateFrame(passed); _oldx = _x; _oldy = _y; if ( _scorerSide ) { _scoredTime += passed; if ( _scoredTime > 650 ) { assignPoint(_scorerSide, (_scorerSide<0)?tleft:tright); return; } } if ( !netPartialCollision(_x, _y) ) // if it's not network supported update_direction(passed); dx = (int) (_spdx * ((float) passed / 1000.0)); dy = (int) (_spdy * ((float) passed / 1000.0)); _x += dx; _y -= dy; // usual problem with y //ball hits upper wall if ( _y < configuration.CEILING ) { _y = configuration.CEILING; _spdy = - (int) (_spdy * ELASTIC_SMOOTH); #ifdef AUDIO soundMgr->playSound(SND_BOUNCE); #endif // AUDIO } //ball hits left wall if ( _x < configuration.LEFT_WALL ) { _x = configuration.LEFT_WALL; _spdx = - (int) (_spdx * ELASTIC_SMOOTH); if ( _collisionCount[tright] ) resetCollisionCount(); #ifdef AUDIO soundMgr->playSound(SND_BOUNCE); #endif // AUDIO } //ball hits right wall if ( _x > (configuration.RIGHT_WALL -_frames->width()) ) { _x = configuration.RIGHT_WALL - _frames->width(); _spdx = - (int) (_spdx * ELASTIC_SMOOTH); if ( _collisionCount[tleft] ) resetCollisionCount(); #ifdef AUDIO soundMgr->playSound(SND_BOUNCE); #endif // AUDIO } // net collision if ( netFullCollision(_x, _y) && !netFullCollision(_oldx, _oldy)) { _spdx = (int) ((- _spdx) * ELASTIC_SMOOTH); if ( _oldx > _x ) _x = 2 * configuration.NET_X - _x; // moves ball out of the net // by the right amount else _x = 2* configuration.NET_X - 2*_frames->width() - _x; #ifdef AUDIO soundMgr->playSound(SND_FULLNET); #endif // AUDIO } else if ( netPartialCollision(_x, _y) ) { if ( !netPartialCollision(_oldx, configuration.NET_Y - 3*_frames->height()/4) ) { if ( _oldy < _y ) { // hits from the top if ( (_x + _frames->width()/8 < configuration.NET_X) && (_x + 7*_frames->width()/8 > configuration.NET_X) ) _spdx = - _spdx; } _spdx = (int) (_spdx * ELASTIC_SMOOTH * ELASTIC_SMOOTH * ELASTIC_SMOOTH); } _y -= _frames->height()/4; //(int) (_frames->height() - //(4*distance(configuration.NET_X, configuration.NET_Y) / _frames->height())); _spdy = (int) fabs(_spdy * ELASTIC_SMOOTH * ELASTIC_SMOOTH); // ball stuck on the net "feature" ;-) if (_x == _oldx) { if (_spdx > 0) _x += 5; else _x -= 5; } #ifdef AUDIO soundMgr->playSound(SND_PARTIALNET); #endif // AUDIO } //ball hits floor if ( _y > (configuration.FLOOR_ORD - _frames->height() ) ) { _y = (configuration.FLOOR_ORD - _frames->height() ); _spdy = - (int) (_spdy * ELASTIC_SMOOTH); if ( !_scorerSide ) { // oldx, so we're safe from collisions against // the net _scorerSide = (_oldx < configuration.NET_X)?1:-1; _scoredTime = 0; } #ifdef AUDIO soundMgr->playSound(SND_BOUNCE); #endif // AUDIO } // collisions with the players for ( int teami = 0; !_scorerSide && (teami < 2); teami ++ ) { Team *team = (teami?tright:tleft); vector plv = team->players(); for ( vector::const_iterator it = plv.begin(); it != plv.end(); it++ ) { // cout << "xy" << (*it)->x() << " " << (*it)->y() << endl; if ( collide(*it) ) { if ( _inCollisionWith != *it ) { _inCollisionWith = *it; // cerr << "collide " << passed << "\n"; if ( !_collisionCount[team] ) resetCollisionCount(); _collisionCount[team]++; #ifdef AUDIO soundMgr->playSound(SND_PLAYERHIT); #endif // AUDIO if ( _collisionCount[team] > MAX_TOUCHES ) { _scorerSide = (team == tleft)?1:-1; _scoredTime = 0; } // cerr << "CollisionCount " << string(teami?"R: ":"L: ") << //_collisionCount[team] << endl; update_internal(*it); while (collide(*it)) { int newx = _x + ((_spdx>0)?1:-1); _y -= (_spdy>0)?1:-1; // usual problem with y if (!netFullCollision(newx, _y) && !netPartialCollision(newx, _y)) _x = newx; } //_inCollisionWith = NULL; } else { while (collide(*it)) { int newx = _x + ((_spdx>0)?1:-1); _y -= (_spdy>0)?1:-1; // usual problem with y if (!netFullCollision(newx, _y) && !netPartialCollision(newx, _y)) _x = newx; } } } else if ( _inCollisionWith == *it ) _inCollisionWith = NULL; } } // to activate 'gravity' if ( !_accelY && (abs(_spdx) + abs(_spdy)) ) _accelY = GRAVITY; /* // over net test if (!_spdx && !_spdy) { _x = configuration.NET_X; _y = configuration.NET_Y - 30; _spdy = 5; } */ /* // stuck test { static int ini = 1; if (ini && !_spdx && !_spdy) { ini = 0; _x = configuration.NET_X - 20; _y = configuration.NET_Y - 50; _spdy = 5; } } */ } gav-0.9.0/FrameSeq.cpp0000644000000000000000000000642310355262416013213 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include "FrameSeq.h" #define max(x, y) ((x)>(y)?(x):(y)) #define min(x, y) ((x)<(y)?(x):(y)) void FrameSeq::blitRect(int idx, SDL_Surface * dest, SDL_Rect * rect) { SDL_Rect r; r.x = (idx % _nframes) * _width; r.y = 0; r.w = rect->w; r.h = rect->h; SDL_BlitSurface(_surface, &r, dest, rect); } void FrameSeq::blit(int idx, SDL_Surface * dest, SDL_Rect * rect) { SDL_Rect r; r.x = (idx % _nframes) * _width; r.y = 0; r.w = _width; r.h = _surface->h; SDL_BlitSurface(_surface, &r, dest, rect); } Uint32 CreateHicolorPixel(SDL_PixelFormat *fmt, Uint8 red, Uint8 green, Uint8 blue) { return( ((red >> fmt->Rloss) << fmt->Rshift) + ((green >> fmt->Gloss) << fmt->Gshift) + ((blue >> fmt->Bloss) << fmt->Bshift) ); } inline Uint32 getPix(void *v, int i, Uint8 bpp) { switch ( bpp ) { case 4: return (Uint32) ((Uint32 *)v)[i]; break; case 3: std::cerr << "Unsupported pixel format: please, report to the GAV team!\n"; exit(0); break; //(Uint32) ((Uint24 *)v)[i]; break; there's no such thing as Uint24! case 2: return (Uint32) ((Uint16 *)v)[i]; break; case 1: return (Uint32) ((Uint8 *)v)[i]; break; } std::cerr << "Unsupported pixel format (" << bpp << "): please, report to the GAV team!\n"; exit(0); return 0; } bool FrameSeq::collidesWith(FrameSeq *fs, int idx1, int idx2, SDL_Rect * rect1, SDL_Rect * rect2) { int xmin = max(rect1->x, rect2->x); int xmax = min(rect1->x + _width, rect2->x + fs->_width); int ymin = max(rect1->y, rect2->y); int ymax = min(rect1->y + _height, rect2->y + fs->_height); if ( (xmin > xmax) || (ymin > ymax) ) return(false); void *pix1 = _surface->pixels; void *pix2 = fs->_surface->pixels; Uint8 pixfmt = screen->format->BytesPerPixel; Uint32 empty_pixel = 0; // faster than CreateHicolorPixel(screen->format, 0, 0, 0); int sp1 = _surface->pitch / pixfmt; int sp2 = fs->_surface->pitch / pixfmt; int xdisp1 = ((idx1 % _nframes) * _width); int xdisp2 = ((idx2 % fs->_nframes) * fs->_width); while ( ymin < ymax ) { // was ymin <= ymax int xrun = xmin; while ( xrun < xmax ) { // was xrun <= xmax int p1off = sp1 * (ymin - rect1->y) + xdisp1 + (xrun - rect1->x); int p2off = sp2 * (ymin - rect2->y) + xdisp2 + (xrun - rect2->x); if ( ( getPix(pix1, p1off, pixfmt) != empty_pixel ) && ( getPix(pix2, p2off, pixfmt) != empty_pixel) ) { return(true); } xrun++; } ymin++; } return(false); } gav-0.9.0/Team.h0000644000000000000000000001017210355242120012025 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _TEAM_H_ #define _TEAM_H_ #include #include #include "Player.h" #include "PlayerHuman.h" #include "PlayerAI.h" #include "PlayerRemote.h" #include "ControlsArray.h" #include "ScreenFont.h" #include "globals.h" class Ball; extern ScreenFont *cga; class Team { private: std::vector _players; int _xmin; int _xmax; int _ymin; int _ymax; int _score; int _side; int _nplayers; int _playerNumInc; inline void addPlayer(Player * p) { _players.push_back(p); for(unsigned int i = 0; i < _players.size(); i++) _players[i]->setX((i+1) * (_xmax + _xmin) / (_players.size()+1) - (p->width() / 2)); p->setY(p->GROUND_LEVEL()); _nplayers++; } public: // side < 0: left, > 0 right Team(int side = -1) : _side(side) { _score = 0; _nplayers = 0; _playerNumInc = (side<0)?0:1; _xmin = (side<0)?(configuration.LEFT_WALL+1):(configuration.SCREEN_WIDTH / 2) ; //304 the real half field width // _xmax = _xmin + 304 ; // _xmax = _xmin + (configuration.SCREEN_WIDTH / 2) - 16; _xmax = _xmin + ((304*configuration.SCREEN_WIDTH)/640); _ymin = 0; _ymax = 0; } inline void score() { _score++; } inline void setScore(int v) { _score = v; } inline int getScore() { return(_score); } inline Player * addPlayerHuman(std::string name, pl_type_t type, int speed = configuration.DEFAULT_SPEED) { Player *p = new PlayerHuman(this, name, type, _nplayers * 2 + _playerNumInc, speed); addPlayer(p); return p; } inline Player * addPlayerRemote(std::string name, pl_type_t type, int speed = configuration.DEFAULT_SPEED) { Player *p = new PlayerRemote(this, name, type, _nplayers * 2 + _playerNumInc, speed); addPlayer(p); return p; } inline Player * addPlayerAI(std::string name, pl_type_t type, Ball * b, int speed = configuration.DEFAULT_SPEED) { Player *p = new PlayerAI(this, name, type, _nplayers * 2 + _playerNumInc, speed, b); addPlayer(p); return p; } inline std::vector players() { return(_players); } inline int xmax() { return _xmax; } inline int xmin() { return _xmin; } inline int ymax() { return _ymax; } inline int ymin() { return _ymin; } inline int side() { return _side; } inline int nplayers() { return _nplayers; } inline void xmax(int v) { _xmax = v; } inline void xmin(int v) { _xmin = v; } inline void ymax(int v) { _ymax = v; } inline void ymin(int v) { _ymin = v; } void draw(SDL_Surface *scr = screen) { SDL_Rect r; r.x = (_xmin < (configuration.SCREEN_WIDTH/3))?100:(_xmax - 100); r.y = 0; for ( std::vector::const_iterator it = _players.begin(); it != _players.end(); it++ ) (*it)->draw(scr); char s[100]; sprintf(s, "%d", _score); cga->printXY(scr, &r, s); } void update(int ticks, ControlsArray *ca) { for ( std::vector::const_iterator it = _players.begin(); it != _players.end(); it++ ) { (*it)->update(ticks, ca); } } ~Team() { Player *pl[_players.size()]; int i = 0; for ( std::vector::const_iterator it = _players.begin(); it != _players.end(); it++ ) { pl[i++] = (*it); } for ( int j = 0; j < i; j++ ) { delete pl[j]; } } }; #endif // _TEAM_H_ gav-0.9.0/README.win320000644000000000000000000000061507571633053012627 0ustar rootrootWelcome to GAV, a GPL rendition of the popular Arcade Volleyball. Some of the menu items have not been implemented yet. Themes support is there, but unaccessible if not from the code. The keys are: left player: z, c and left shift right player: <-, -> and cursor up. To activate a menu item, SPACE. To exit from the game and go back to the menu, ESC To switch to fullscreen (much faster), F10 gav-0.9.0/globals.cpp0000644000000000000000000000212210355242120013111 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Global data */ #include "globals.h" SDL_Surface *screen; FrameSeq *background; ScreenFont *cga, *cgaInv; int screenFlags = 0; const SDL_VideoInfo *videoinfo; MenuRoot *mroot; ControlsArray *controlsArray = NULL; #ifndef NONET NetServer * nets = NULL; NetClient * netc = NULL; #endif gav-0.9.0/Sound.h0000644000000000000000000000253107722666621012253 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __SOUND_H__ #define __SOUND_H__ #include #include "globals.h" #ifdef AUDIO class Sound { private: int id; // id in playing vector sound_t this_sound; int loadAndConvertSound(const char *filename, SDL_AudioSpec *spec,sound_p sound); public: Sound(const char *filename) { loadAndConvertSound(filename,&obtained,&this_sound); } Sound() {}; int loadSound(const char *fname) { return loadAndConvertSound(fname,&obtained,&this_sound); } int playSound(bool loop); void stopSound(); }; #endif #endif //_SOUND_H_ gav-0.9.0/build_linux.sh0000755000000000000000000000022707616506673013671 0ustar rootrootmake clean cp Makefile.Linux Makefile cp automa/Makefile.Linux automa/Makefile cp menu/Makefile.Linux menu/Makefile cp net/Makefile.Linux net/Makefile gav-0.9.0/themes/0000755000000000000000000000000010435311430012252 5ustar rootrootgav-0.9.0/themes/classic/0000755000000000000000000000000010435311430013673 5ustar rootrootgav-0.9.0/themes/classic/plmr.png0000644000076400007640000000151110435045553015361 0ustar zavazavaPNG  IHDR4;N"ggAMA abKGD pHYs  ~tIME 8 IDATxQ D㖇9~[$m){.Q󛽔4_PL@E $4bDڱPOxoL4LBC(C8xN3 rP:c{A5LLBC($F5{3Vﳔ63T3 П 54a{ ?vZq7bƠ&!rQybWxx2Y<{8GBC(ܛp}QN6{;&!!!h,A`IENDB`gav-0.9.0/themes/classic/plml.png0000644000076400007640000000155410435045553015362 0ustar zavazavaPNG  IHDR4;N"ggAMA abKGD pHYs  ~tIME 3`۸IDATx[r0 EN%zۊqs>Z{'1jڎK;cۉRkxkx!PoZDDJ?^4ge ?R3 pJ.X7T+@3IhH([/U(EFaU\[ܗ1f4 X&㿍vR`dlZR9~4YOBC*oRџUmْEԧhnUHhHƷ=U 9—fףmfhFsTl )NO9,6q4[2i&!6u<7 Qf4 А5N}`́{ɡT=Eڛ7j$4b0ʱ]C4ABC*zhK뱺N]ag;wRc%Û |3"Ќf )aFM42ST,ǡKXY ϧѬ !Gs"k[}&`/hx$4bYy?%3h5|fRpV=gkS3 c%nQ]aR>ƕIhHa ݘ??<+׼5IhHEIIhIF?%f뫜 8,gnx̦m/3 mkר%!%b4r׷.43+ 8nкO3O3]4P!!$ۘ-M/翋ZOkRpLIENDB`gav-0.9.0/themes/classic/background.png0000644000076400007640000002520310435045553016532 0ustar zavazavaPNG  IHDRFrgAMA abKGD pHYs  d_tIME 8kq IDATxݏ$y9Uo3/I 9A mFb0"2 HL 6,Y&%rIQ Nb6blDzB:/=]w~Wm>T xX|UUVGn4-KfYu]Kiu/z~8\._yh4} ߟڪ1o|EQ޸q×qFYUUrοRzz˲,bXYEJKUUu.c9_eꫯ# /\>]%pzz*t163b<̏~xc<::oaxlf)tX,O,b4FQo¾ZFQg._<_וe9t`:u}ڵs,||ײ,?/ed2}l6mF.X~6uX,bu]EqTU*TiY~c1yku=q]מ(—G}'vv?BX,EQjL&:N~{}K_9w^}ՉWr9WU;b5?圽\V^x1}^xqaPu'u+mmReg>+W|_f9g ?99㧋'}͛}lh?`yZ+!zG}Eyu=rt<~,KOS-V^?7w^Esn:gdz[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0+kgOPt.E 8W<-8}\q WN1Sx8>w5&PYѹڀ_'=hO=וG ^㴹bCka`k'QDmx;"~)O(vt0*o"$ıg;]^>F/}UORlY'O?)9xnAŁ'KEq,%hpPM݅.泛䪅pS|rF lc-;(L7c: tU曐y`3\Ҥk$(PAx@dHY|zGcM}[R D0%XrP{k/>Bu~+V*W\_u-ᝳDғ]Tj5jM͑N!G;p&G@X7(ʜFXP#a. `R W ~E2hXNv)5U|d@[P!%q,c\ս$γI ^7!%9mOIs*.NVkE0Q]iS1IC@,v'q1Soۆad¢mq5g_f.oAy}\8O_6JS2qV` LPjRh5α,}Wtg}r$3R`"䌘׬`OƎ!_aKm}̎یֆ(b؅SڗXHV:50^@.Lߵ9Nt!SˎS/F.[YZj:@ER RJ=5I:rn邌zt]ԙ,]]#088x =Z~zB #include "Configuration.h" #define FPS (50) class MenuRoot; class ControlsArray; class FrameSeq; class ScreenFont; extern SDL_Surface *screen; extern FrameSeq *background; extern ScreenFont *cga, *cgaInv; extern int screenFlags; extern const SDL_VideoInfo *videoinfo; extern ControlsArray *controlsArray; extern MenuRoot *mroot; extern Configuration configuration; class GameRenderer; extern GameRenderer *gameRenderer; #ifndef NONET class NetClient; class NetServer; #endif class SoundMgr; #ifndef NONET extern NetServer * nets; extern NetClient * netc; #endif extern SoundMgr * soundMgr; #ifdef AUDIO extern SDL_AudioSpec desired,obtained; typedef struct sound_s { Uint8 *samples; Uint32 length; } sound_t, *sound_p; typedef struct playing_s { int active; sound_p sound; Uint32 position; bool loop; } playing_t, *playing_p; #define MAX_PLAYING_SOUNDS 10 extern playing_t playing [MAX_PLAYING_SOUNDS]; #define VOLUME_PER_SOUND SDL_MIX_MAXVOLUME / 2 /* this should be synchronized with char *sound_fnames[] in SoundMgr.cpp */ enum { SND_BOUNCE = 0, SND_MENU_SELECT, SND_MENU_ACTIVATE, SND_SCORE, SND_VICTORY, SND_PARTIALNET, SND_FULLNET, SND_SERVICECHANGE, SND_PLAYERHIT, SND_BACKGROUND_PLAYING, SND_BACKGROUND_MENU // last item is used in SoundMgr.cpp as a limit }; #endif //AUDIO typedef struct { Uint8 left; Uint8 right; Uint8 jump; } triple_t; #define MAXPATHLENGTH (1024) #endif // _GLOBALS_H_ gav-0.9.0/ScreenFont.h0000644000000000000000000000315010355262416013215 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _SCREENFONT_H_ #define _SCREENFONT_H_ #include #include "LogicalFrameSeq.h" #define FONT_FIRST_CHAR ' ' #define FONT_NUMBER 104 class FrameSeq; class ScreenFont { private: FrameSeq *_frames; char _fst; // first character unsigned char _nchars; public: ScreenFont(const char *fname, char fst, unsigned char n) : _fst(fst), _nchars(n) { _frames = new LogicalFrameSeq(fname, (int) n); } ~ScreenFont() { delete(_frames); } void printXY(SDL_Surface *dest, SDL_Rect *r, const char * str, bool wrapAround = true, FrameSeq *background = NULL); void printRow(SDL_Surface *dest, int row, const char *str, FrameSeq *bg = NULL); inline int charWidth() { return(_frames->width()); } inline int charHeight() { return(_frames->height()); } }; #endif // _SCREENFONT_H_ gav-0.9.0/build_win32.sh0000755000000000000000000000024707616506673013476 0ustar rootrootmake clean cp Makefile.cross.w32 Makefile cp automa/Makefile.cross.w32 automa/Makefile cp menu/Makefile.cross.w32 menu/Makefile cp net/Makefile.cross.w32 net/Makefile gav-0.9.0/SoundMgr.h0000644000000000000000000000227107722666621012722 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __SOUNDMGR_H__ #define __SOUNDMGR_H__ #include #include "globals.h" #include "Sound.h" #ifdef AUDIO #define MAX_SOUNDS 16 class SoundMgr { private: Sound *sounds[MAX_SOUNDS]; int nsounds; public: SoundMgr(const char *dir, const char *defdir); ~SoundMgr(); int playSound(int which, bool loop = false); void stopSound(int which); }; #endif #endif //_SOUNDMGR_H_ gav-0.9.0/README.tags0000644000000000000000000000005710354241475012617 0ustar rootroot2005-12-27 PRESCALE (before the scale feature) gav-0.9.0/Configuration.cpp0000644000000000000000000001763110117772772014331 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Configuration options */ #include #include #include #include "Configuration.h" #include "ControlsArray.h" using namespace std; Configuration configuration; Aargh aargh; int Configuration::loadConfiguration() { string fname = confFileName(); if ( !aargh.loadConf(fname.c_str()) ) return(-1); string value; if ( aargh.getArg("left_nplayers", value) ) configuration.left_nplayers = atoi(value.c_str()); if ( aargh.getArg("right_nplayers", value) ) configuration.right_nplayers = atoi(value.c_str()); if ( aargh.getArg("monitor_type", value) ) { if ( value == "normal" ) configuration.monitor_type = MONITOR_NORMAL; else if ( value == "old" ) configuration.monitor_type = MONITOR_OLD; else if ( value == "very_old") configuration.monitor_type = MONITOR_VERYOLD; else if ( value == "very_very_old") configuration.monitor_type = MONITOR_VERYVERYOLD; else cerr << "Unrecognized monitor type \"" << value << "\"\n"; } if ( aargh.getArg("frame_skip", value) ) configuration.frame_skip = atoi(value.c_str()); if ( aargh.getArg("fps", value) ) configuration.setFps(atoi(value.c_str())); for ( int i = 0; i < left_nplayers; i++ ) if ( aargh.getArg(("left_player" + toString(i)), value) ) if ( value == "human") configuration.left_players[i] = PLAYER_HUMAN; else if ( value == "computer") configuration.left_players[i] = PLAYER_COMPUTER; else cerr << "Unrecognized player type \"" << value << "\"\n"; for ( int i = 0; i < MAX_PLAYERS/2; i++ ) { string arg1, arg2, arg3; arg1 = "left_player" + toString(i) + "left"; arg2 = "left_player" + toString(i) + "right"; arg3 = "left_player" + toString(i) + "jump"; if ( aargh.getArg(arg1) && aargh.getArg(arg2) && aargh.getArg(arg3) ) { string lval, rval, jval; controls_t ctrls; aargh.getArg(arg1, lval); aargh.getArg(arg2, rval); aargh.getArg(arg3, jval); ctrls.left_key = atoi(lval.c_str()); ctrls.right_key = atoi(rval.c_str()); ctrls.jump_key = atoi(jval.c_str()); controlsArray->setControls(i*2, ctrls); } } for ( int i = 0; i < right_nplayers; i++ ) if ( aargh.getArg(("right_player" + toString(i)), value) ) if ( value == "human" ) configuration.right_players[i] = PLAYER_HUMAN; else if ( value == "computer") configuration.right_players[i] = PLAYER_COMPUTER; else cerr << "Unrecognized player type \"" << value << "\"\n"; for ( int i = 0; i < MAX_PLAYERS/2; i++ ) { string arg1, arg2, arg3; arg1 = "right_player" + toString(i) + "left"; arg2 = "right_player" + toString(i) + "right"; arg3 = "right_player" + toString(i) + "jump"; if ( aargh.getArg(arg1) && aargh.getArg(arg2) && aargh.getArg(arg3) ) { string lval, rval, jval; controls_t ctrls; aargh.getArg(arg1, lval); aargh.getArg(arg2, rval); aargh.getArg(arg3, jval); ctrls.left_key = atoi(lval.c_str()); ctrls.right_key = atoi(rval.c_str()); ctrls.jump_key = atoi(jval.c_str()); controlsArray->setControls(i*2 + 1, ctrls); } } if ( aargh.getArg("big_background", value) ) configuration.bgBig = (value=="yes"); if ( aargh.getArg("fullscreen", value) ) configuration.fullscreen = (value=="yes"); if ( aargh.getArg("ball_speed", value) ) if ( value == "normal" ) configuration.ballAmplify = DEFAULT_BALL_AMPLIFY; else if ( value == "fast" ) configuration.ballAmplify = DEFAULT_BALL_AMPLIFY + BALL_SPEED_INC; else if ( value == "very_fast" ) configuration.ballAmplify = DEFAULT_BALL_AMPLIFY + 2*BALL_SPEED_INC; else cerr << "Unrecognized ball speed \"" << value << "\"\n"; if ( aargh.getArg("theme", value) ) configuration.currentTheme = value; if ( aargh.getArg("sound", value) ) configuration.sound = (value == "yes"); if ( aargh.getArg("winning_score", value) ) configuration.winning_score = atoi(value.c_str()); return 0; } /* we'll use aargh's dump feature! Yiipeee!! */ int Configuration::saveConfiguration(string fname) { // cerr << "saving to: " << fname << endl; string tosave; aargh.dump(tosave); FILE *fp; if ( (fp = fopen(fname.c_str(), "w")) == NULL ) return(-1); fputs(tosave.c_str(), fp); fclose(fp); return 0; } /* unfortunately, I *HAVE* to go through all the settings... This function puts configuration parameters inside aargh, and then dumps it. */ int Configuration::createConfigurationFile() { string fname = confFileName(); Configuration c = configuration; /* for short :) */ aargh.reset(); aargh.setArg("left_nplayers", c.left_nplayers); aargh.setArg("right_nplayers", c.right_nplayers); switch ( c.monitor_type ) { case MONITOR_NORMAL: aargh.setArg("monitor_type", "normal"); break; case MONITOR_OLD: aargh.setArg("monitor_type", "old"); break; case MONITOR_VERYOLD: aargh.setArg("monitor_type", "very_old"); break; case MONITOR_VERYVERYOLD: aargh.setArg("monitor_type", "very_very_old"); break; } aargh.setArg("frame_skip", c.frame_skip); aargh.setArg("fps", c.fps); for ( int i = 0; i < left_nplayers; i++ ) { switch ( c.left_players[i] ) { case PLAYER_HUMAN: aargh.setArg("left_player" + toString(i), "human"); break; case PLAYER_COMPUTER: aargh.setArg("left_player" + toString(i), "computer"); break; } } for ( int i = 0; i < right_nplayers; i++ ) { switch ( c.right_players[i] ) { case PLAYER_HUMAN: aargh.setArg("right_player" + toString(i), "human"); break; case PLAYER_COMPUTER: aargh.setArg("right_player" + toString(i), "computer"); break; } } aargh.setArg("big_background", c.bgBig?"yes":"no"); aargh.setArg("fullscreen", (c.fullscreen?"yes":"no")); if ( c.ballAmplify == DEFAULT_BALL_AMPLIFY + BALL_SPEED_INC ) aargh.setArg("ball_speed", "fast"); else if ( c.ballAmplify == DEFAULT_BALL_AMPLIFY + 2*BALL_SPEED_INC ) aargh.setArg("ball_speed", "very_fast"); else if ( c.ballAmplify == DEFAULT_BALL_AMPLIFY ) aargh.setArg("ball_speed", "normal"); aargh.setArg("theme", c.currentTheme); aargh.setArg("sound", c.sound?"yes":"no"); aargh.setArg("winning_score", c.winning_score); for ( int i = 0; i < MAX_PLAYERS/2; i++ ) { controls_t ct = controlsArray->getControls(i*2); aargh.setArg("left_player" + toString(i) + "left", ct.left_key); aargh.setArg("left_player" + toString(i) + "right", ct.right_key); aargh.setArg("left_player" + toString(i) + "jump", ct.jump_key); } for ( int i = 0; i < MAX_PLAYERS/2; i++ ) { controls_t ct = controlsArray->getControls(i*2 + 1); aargh.setArg("right_player" + toString(i) + "left", ct.left_key); aargh.setArg("right_player" + toString(i) + "right", ct.right_key); aargh.setArg("right_player" + toString(i) + "jump", ct.jump_key); } return(saveConfiguration(fname)); } string Configuration::confFileName() { string ret; const char *home = getenv("HOME"); if ( home ) { ret = (string(home) + "/" + DEFAULT_CONF_FILENAME); } else { /* gav.ini in the current directory */ ret = string(ALTERNATIVE_CONF_FILENAME); } return ret; } gav-0.9.0/net/0000755000000000000000000000000010435311427011561 5ustar rootrootgav-0.9.0/net/Net.h0000644000000000000000000000527310435074634012475 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __NET_H__ #define __NET_H__ #ifndef NONET #include #include #include "Configuration.h" #include "Ball.h" #include "Team.h" #include "automa/StateWithInput.h" #define PLAYER_FOR_TEAM_IN_NET_GAME 2 #define SERVER_PORT 7145 /* The ID of a client is a char with the higher order 2 bits indicating the team, the left 6 bits say the player number. When a client wants to register itself, it sends a register request with id equal to NET_TEAM_LEFT or NET_TEAM_RIGHT. The server fills the others 6 bits and sends the id back to the client. */ #define NET_TEAM_LEFT 0x80 // 10xxxxxx #define NET_TEAM_RIGHT 0x40 // 01xxxxxx typedef struct { Uint16 x; Uint16 y; Uint16 frame; } net_object_snapshot_t; typedef struct { //unsigned int timestamp; net_object_snapshot_t teaml[PLAYER_FOR_TEAM_IN_NET_GAME]; net_object_snapshot_t teamr[PLAYER_FOR_TEAM_IN_NET_GAME]; net_object_snapshot_t ball; unsigned char scorel; unsigned char scorer; } net_game_snapshot_t; typedef struct { //unsigned int timestamp; unsigned char id; // the client ID unsigned char command; } net_command_t; typedef struct { unsigned char id; unsigned char nplayers_l; unsigned char nplayers_r; unsigned char bgBig; // 0 or 1 unsigned char winning_score; } net_register_t; class Net : public StateWithInput{ protected: UDPsocket mySock; UDPpacket * packetCmd; UDPpacket * packetSnap; UDPpacket * packetRegister; public: Net() { packetSnap = SDLNet_AllocPacket(sizeof(net_game_snapshot_t)); packetSnap->len = packetSnap->maxlen; packetCmd = SDLNet_AllocPacket(sizeof(net_command_t)); packetCmd->len = packetCmd->maxlen; packetRegister = SDLNet_AllocPacket(sizeof(net_register_t)); packetRegister->len = packetRegister->maxlen; } ~Net() { SDLNet_FreePacket(packetSnap); SDLNet_FreePacket(packetCmd); } }; #endif // NONET #endif gav-0.9.0/net/Makefile.cross.w320000644000000000000000000000223407616566640015004 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. RELPATH = net include ../CommonHeader NAME = net CXXFLAGS += -I$(GAV_ROOT) -I$(GAV_ROOT)/menu -I$(GAV_ROOT)/net DEPEND = Makefile.depend .PHONY: all all: $(OFILES) ($OFILES): $(SRCS) $(CXX) -c $(CXXFLAGS) $< clean: rm -f *.o *.bin *~ $(DEPEND) depend: $(RM) $(DEPEND) $(CXX) $(CXXFLAGS) -M $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/net/NetServer.cpp0000644000000000000000000001113210435074634014206 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef NONET #include "NetServer.h" #include "Player.h" using namespace std; int NetServer::StartServer(int port) { /* open the socket */ mySock = SDLNet_UDP_Open((Uint16)port); if(!mySock) { fprintf(stderr, "SDLNet_UDP_Open: %s\n", SDLNet_GetError()); return -1; } return 0; } int NetServer::ComputePlayerID(char id) { unsigned char tm ,pl; tm = (id & NET_TEAM_LEFT)?0:1; pl = id & 0x3F; return ((pl << 1) | tm); } int NetServer::WaitClients(InputState * is, int nclients) { IPaddress * ipa; //char nleft = 0; //char nright = 0; unsigned char * id; int i; bool inserted = false; char pl; _nclients = nclients; while ( !inserted ) { // (nright + nleft) != nclients) { inserted = false; if (SDLNet_UDP_Recv(mySock, packetRegister) != 0) { ipa = (IPaddress*)malloc(sizeof(IPaddress)); memcpy(ipa, &(packetRegister->address), sizeof(IPaddress)); id = &(((net_register_t*)(packetRegister->data))->id); if (*id & NET_TEAM_LEFT) { for (i = 0; (i < configuration.left_nplayers) && !inserted; i++) if ((configuration.left_players[i] == PLAYER_COMPUTER) && !_players[2*i]) { inserted = true; pl = (char)i; } if (inserted) { *id |= pl; //nleft++; } else continue; } else if (*id & NET_TEAM_RIGHT) { for (i = 0; (i < configuration.right_nplayers) && !inserted; i++) if ((configuration.right_players[i] == PLAYER_COMPUTER) && !_players[2*i+1]) { inserted = true; pl = (char)i; } if (inserted) { *id |= pl; //nright++; } else continue; } _players[ComputePlayerID(*id)] = 1; clientIP.push_back(ipa); /* send the ID back to client */ ((net_register_t*)(packetRegister->data))->nplayers_l = configuration.left_nplayers; ((net_register_t*)(packetRegister->data))->nplayers_r = configuration.right_nplayers; ((net_register_t*)(packetRegister->data))->bgBig = configuration.bgBig; ((net_register_t*)(packetRegister->data))->winning_score = configuration.winning_score; SDLNet_UDP_Send(mySock, -1, packetRegister); } else { if (getKeyPressed(is, false) == SDLK_ESCAPE) { return -1; } SDL_Delay(500); } } return (nclients-1); } //Uint16 NetServer::NormalizeCurrentFrame( int NetServer::SendSnapshot(Team *tleft, Team *tright, Ball * ball) { unsigned int i; net_game_snapshot_t * snap = (net_game_snapshot_t *)(packetSnap->data); std::vector plv; snap->scorel = tleft->getScore(); snap->scorer = tright->getScore(); /* fill the left team informations */ plv = tleft->players(); for (i = 0; i < plv.size(); i++) { SDLNet_Write16(plv[i]->x(), &((snap->teaml)[i].x)); SDLNet_Write16(plv[i]->y(), &((snap->teaml)[i].y)); SDLNet_Write16(plv[i]->state(), &((snap->teaml)[i].frame)); } /* fill the right team informations */ plv = tright->players(); for (i = 0; i < plv.size(); i++) { SDLNet_Write16(plv[i]->x(), &((snap->teamr)[i].x)); SDLNet_Write16(plv[i]->y(), &((snap->teamr)[i].y)); SDLNet_Write16(plv[i]->state(), &((snap->teamr)[i].frame)); } /* fill the ball informations */ SDLNet_Write16(ball->x(), &((snap->ball).x)); SDLNet_Write16(ball->y(), &((snap->ball).y)); // ball has just one state //SDLNet_Write16(ball->frame(), &((snap->ball).frame)); /* send the snapshot to all clients */ for (i = 0; i < clientIP.size(); i++) { packetSnap->address = *(clientIP[i]); SDLNet_UDP_Send(mySock, -1, packetSnap); } return 0; } int NetServer::ReceiveCommand(int * player, char * cmd) { if (SDLNet_UDP_Recv(mySock, packetCmd) != 0) { net_command_t * c = (net_command_t*)(packetCmd->data); *player = ComputePlayerID(c->id); *cmd = c->command; return 0; } return -1; } int NetServer::isRemote(int pl) { return _players[pl]; } #endif gav-0.9.0/net/NetServer.h0000644000000000000000000000316210435074634013657 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __NETSERVER_H__ #define __NETSERVER_H__ #ifndef NONET #include "Net.h" #include class NetServer: public Net { std::vector clientIP; int _nclients; int _players[MAX_PLAYERS]; public: NetServer() { memset(_players, 0, MAX_PLAYERS * sizeof(int)); } ~NetServer() { unsigned int i; /* deallocation of clientIP elements */ for (i = 0; i < clientIP.size(); i++) free(clientIP[i]); SDLNet_UDP_Close(mySock); } /* server methods */ int StartServer(int port = SERVER_PORT); int WaitClients(InputState * is, int nclients = 1); int SendSnapshot(Team *tleft, Team *tright, Ball * ball); int ReceiveCommand(int * player, char * cmd); int ComputePlayerID(char id); int isRemote(int pl); inline int nclients() { return _nclients; } }; #endif // NONET #endif gav-0.9.0/net/Makefile.Linux0000644000000000000000000000240107616566640014334 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. RELPATH = net include ../CommonHeader NAME = net MODULE_NAME = $(NAME)_module.o CXXFLAGS += -I$(GAV_ROOT) -I$(GAV_ROOT)/menu -I$(GAV_ROOT)/net DEPEND = Makefile.depend .PHONY: all all: $(MODULE_NAME) $(MODULE_NAME): $(OFILES) $(LD) -r $(OFILES) -o $(MODULE_NAME) ($OFILES): $(SRCS) $(CXX) -c $(CXXFLAGS) $< clean: rm -f *.o *.bin *~ $(DEPEND) depend: $(RM) $(DEPEND) $(CXX) $(CXXFLAGS) -M $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/net/Makefile0000644000000000000000000000240107616566640013236 0ustar rootroot# GAV - Gpl Arcade Volleyball # Copyright (C) 2002 # GAV team (http://sourceforge.net/projects/gav/) # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. RELPATH = net include ../CommonHeader NAME = net MODULE_NAME = $(NAME)_module.o CXXFLAGS += -I$(GAV_ROOT) -I$(GAV_ROOT)/menu -I$(GAV_ROOT)/net DEPEND = Makefile.depend .PHONY: all all: $(MODULE_NAME) $(MODULE_NAME): $(OFILES) $(LD) -r $(OFILES) -o $(MODULE_NAME) ($OFILES): $(SRCS) $(CXX) -c $(CXXFLAGS) $< clean: rm -f *.o *.bin *~ $(DEPEND) depend: $(RM) $(DEPEND) $(CXX) $(CXXFLAGS) -M $(SRCS) >> $(DEPEND) ifeq ($(wildcard $(DEPEND)),$(DEPEND)) include $(DEPEND) endif gav-0.9.0/net/NetClient.h0000644000000000000000000000306710435075340013626 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __NETCLIENT_H__ #define __NETCLIENT_H__ #ifndef NONET #include "Net.h" class NetClient: public Net { IPaddress ipaddress; int channel; // the channel assigned to client char _id; // if I'm a client I've an id char _nplayers_l; char _nplayers_r; private: int receiveData(Uint16 *data); public: NetClient() { } ~NetClient() { SDLNet_UDP_Unbind(mySock, channel); SDLNet_UDP_Close(mySock); } /* client methods */ int ConnectToServer(InputState * is, int * pl, int * pr, char team, const char * hostname, int port = SERVER_PORT); int WaitGameStart(); int ReceiveSnapshot(Team *tleft, Team *tright, Ball * ball, int passed); int SendCommand(char cmd); inline char id() { return _id; } }; #endif // NONET #endif gav-0.9.0/net/NetClient.cpp0000644000000000000000000000754710435075340014170 0ustar rootroot/* -*- C++ -*- */ /* GAV - Gpl Arcade Volleyball Copyright (C) 2002 GAV team (http://sourceforge.net/projects/gav/) 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef NONET #include "NetClient.h" #include "MenuItemBigBackground.h" using namespace std; int NetClient::ConnectToServer(InputState * is, int * pl, int * pr, char team, const char * hostname, int port) { /* open the socket */ mySock = SDLNet_UDP_Open(0); /* resolve the server name */ if (SDLNet_ResolveHost(&ipaddress, (char*) hostname, port) == -1) { fprintf(stderr, "SDLNet_ResolveHost: %s\n", SDLNet_GetError()); return -1; } /* bind */ channel=SDLNet_UDP_Bind(mySock, -1, &ipaddress); if(channel==-1) { fprintf(stderr, "SDLNet_UDP_Bind: %s\n", SDLNet_GetError()); return -1; } packetRegister->address = packetSnap->address = packetCmd->address = ipaddress; ((net_register_t*)(packetRegister->data))->id = team; SDLNet_UDP_Send(mySock, -1, packetRegister); while (!SDLNet_UDP_Recv(mySock, packetRegister)) { if (getKeyPressed(is, false) == SDLK_ESCAPE) { return -1; } } _id = ((net_register_t*)(packetRegister->data))->id; _nplayers_l = ((net_register_t*)(packetRegister->data))->nplayers_l; _nplayers_r = ((net_register_t*)(packetRegister->data))->nplayers_r; if (((net_register_t*)(packetRegister->data))->bgBig != configuration.bgBig) { MenuItemBigBackground menuBG; std::stack st; menuBG.execute(st); } configuration.winning_score = ((net_register_t*)(packetRegister->data))->winning_score; *pl = (int)_nplayers_l; *pr = (int)_nplayers_r; return 0; } int NetClient::WaitGameStart() { while (SDLNet_UDP_Recv(mySock, packetSnap) == 0) SDL_Delay(500); return 0; } inline int NetClient::receiveData(Uint16 *data) { int v = (int)SDLNet_Read16(data); return v; } int NetClient::ReceiveSnapshot(Team *tleft, Team *tright, Ball * ball, int passed) { net_game_snapshot_t * snap; std::vector plv; unsigned int i; if (SDLNet_UDP_Recv(mySock, packetSnap) != 0) { snap = (net_game_snapshot_t*)packetSnap->data; /* fill the left team informations */ plv = tleft->players(); for (i = 0; i < plv.size(); i++) { plv[i]->setX(receiveData(&(snap->teaml)[i].x)); plv[i]->setY(receiveData(&(snap->teaml)[i].y)); plv[i]->updateClient(passed, (pl_state_t)receiveData(&(snap->teaml)[i].frame)); } /* fill the right team informations */ plv = tright->players(); for (i = 0; i < plv.size(); i++) { plv[i]->setX(receiveData(&(snap->teamr)[i].x)); plv[i]->setY(receiveData(&(snap->teamr)[i].y)); plv[i]->updateClient(passed, (pl_state_t)receiveData(&(snap->teamr)[i].frame)); } /* fill the ball informations */ ball->setX(receiveData(&(snap->ball).x)); ball->setY(receiveData(&(snap->ball).y)); ball->updateFrame(passed); /* fill the score information */ tleft->setScore(snap->scorel); tright->setScore(snap->scorer); return 0; } return -1; } int NetClient::SendCommand(char cmd) { net_command_t * command = (net_command_t *)(packetCmd->data); command->id = _id; command->command = cmd; return SDLNet_UDP_Send(mySock, -1, packetCmd)?0:-1; } #endif // NONET gav-0.9.0/sounds/0000755000000000000000000000000010435311430012300 5ustar rootrootgav-0.9.0/sounds/score.wav0000644000076400007640000004345410435045575014160 0ustar zavazavaRIFF$GWAVEfmt DXdataGc  41ZE| !"o#$}$$:%R%G%*%$$#G#{"!~ J1TZ; o 0GSܺFڻگڽF۽SI/p  9YV1J !}"H##|$$*%N%N%/%$$$\#"! pcy<[ cU\m(%hTڭڹ<ۭE!hRX EӗЩhBGhʬɝEHțɬgFDfͬИC@۔ ]<;\:s bYm"$&)*,g./W12345R66a777777c76R65432T1/g.,*)&$l"\c s8]<;^ A DәЩhCGgʭɞFHȚɬiDFgͩИA Aە^=;\:s b\m"$&)*,h./U12345T66d777777e76V65432W1/g.,*)&$m"^b t9Z;;_ ?BӘЫdEFhʫɛHFȝɭhEEgͪКD Cۑe@2X ]0 ? k#&),Z/1k468:<>)@AB D EEF-GGGGGGwGGeFEDC{B#A?>7?&A{BCDEeFGwGGGGGG.GFEE DBA*@><:86n41V/,)&j# #3# lߔaUhө Δ> *qտhaӸi& 9^EQܾ[õaΐ_UmڳP)#ET i)3!$'*-;0295~79;n=?@ BKCeD[E)FFSGGGGGGRGF)FYEgDJCB@?o=;9~7952;0-*'~$4!+jV C$)PnU^ԏbǵ[ݾRF^6 $kӸ`f׿o) =ɓ ΨjSaٗm! 6! k#&),Y/1m468:<>(@AB D EEF,GGGGGGxGGfFEDC}B"A?>9ހZV{5ʂajđUع/NN/׹YfcƂ2|WY؃={t `O"%(+q.13588I:9<>?#A~BCDEeFGxGGGGGG.GFE E DBA)@><:86q41U/,)&m# 2# U\`iN$LʭP4=ȱ!)ҪêQBnͯg7>z򹛼z;5ai@L p fu1$(,148;!?"BDxGIKMOPARHS!TT!ULUFUUTSRQPN5M:U73/+5'"2-KCĐװQ b𪹪SϬ)`PvѸf35oljkπQ 2. CK"&+UTU%UT1TfSaR#QON$LJG3EqB{?L<8K5v1n-))$  MVh'JժѫRֿ9xnbiʪ˪gcny9ؿQɨͪJ)gUN  $,)j-z1K58M<|?sB/EG J#LNO#Q`RfS0TT&UPUBUT|TSRQ\PNMJHWF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