From e0ae5a62ab1df0d9b58fa37399e2f590b4bc7cd2 Mon Sep 17 00:00:00 2001 From: pelya Date: Fri, 12 Nov 2010 13:32:08 +0200 Subject: [PATCH] Added GPL Arcade Volleyball sources --- .../application/gav/AndroidAppSettings.cfg | 32 ++ project/jni/application/gav/AndroidBuild.sh | 21 + .../jni/application/gav/gav-0.9.0/Ball.cpp | 400 ++++++++++++++++++ project/jni/application/gav/gav-0.9.0/Ball.h | 146 +++++++ .../jni/application/gav/gav-0.9.0/CHANGELOG | 54 +++ .../application/gav/gav-0.9.0/CommonHeader | 41 ++ .../gav/gav-0.9.0/Configuration.cpp | 241 +++++++++++ .../application/gav/gav-0.9.0/Configuration.h | 237 +++++++++++ .../gav/gav-0.9.0/ControlsArray.cpp | 100 +++++ .../application/gav/gav-0.9.0/ControlsArray.h | 104 +++++ .../application/gav/gav-0.9.0/FrameSeq.cpp | 116 +++++ .../jni/application/gav/gav-0.9.0/FrameSeq.h | 87 ++++ .../gav/gav-0.9.0/GameRenderer.cpp | 47 ++ .../application/gav/gav-0.9.0/GameRenderer.h | 53 +++ .../application/gav/gav-0.9.0/InputState.cpp | 50 +++ .../application/gav/gav-0.9.0/InputState.h | 47 ++ project/jni/application/gav/gav-0.9.0/LICENSE | 340 +++++++++++++++ .../gav/gav-0.9.0/LogicalFrameSeq.cpp | 62 +++ .../gav/gav-0.9.0/LogicalFrameSeq.h | 80 ++++ .../jni/application/gav/gav-0.9.0/Makefile | 70 +++ .../application/gav/gav-0.9.0/Makefile.Linux | 70 +++ .../gav/gav-0.9.0/Makefile.cross.w32 | 64 +++ .../jni/application/gav/gav-0.9.0/Player.cpp | 183 ++++++++ .../jni/application/gav/gav-0.9.0/Player.h | 182 ++++++++ .../application/gav/gav-0.9.0/PlayerAI.cpp | 244 +++++++++++ .../jni/application/gav/gav-0.9.0/PlayerAI.h | 50 +++ .../application/gav/gav-0.9.0/PlayerHuman.h | 39 ++ .../application/gav/gav-0.9.0/PlayerRemote.h | 39 ++ project/jni/application/gav/gav-0.9.0/README | 61 +++ .../jni/application/gav/gav-0.9.0/README.tags | 1 + .../application/gav/gav-0.9.0/README.win32 | 13 + .../gav/gav-0.9.0/ResizeSurface.cpp | 198 +++++++++ .../application/gav/gav-0.9.0/ResizeSurface.h | 29 ++ .../application/gav/gav-0.9.0/ScreenFont.cpp | 67 +++ .../application/gav/gav-0.9.0/ScreenFont.h | 58 +++ .../jni/application/gav/gav-0.9.0/Sound.cpp | 99 +++++ project/jni/application/gav/gav-0.9.0/Sound.h | 48 +++ .../application/gav/gav-0.9.0/SoundMgr.cpp | 96 +++++ .../jni/application/gav/gav-0.9.0/SoundMgr.h | 48 +++ project/jni/application/gav/gav-0.9.0/Team.h | 169 ++++++++ .../jni/application/gav/gav-0.9.0/Theme.cpp | 137 ++++++ project/jni/application/gav/gav-0.9.0/Theme.h | 229 ++++++++++ project/jni/application/gav/gav-0.9.0/aarg.h | 179 ++++++++ .../application/gav/gav-0.9.0/automa/Automa.h | 55 +++ .../gav/gav-0.9.0/automa/AutomaMainLoop.cpp | 113 +++++ .../gav/gav-0.9.0/automa/AutomaMainLoop.h | 47 ++ .../application/gav/gav-0.9.0/automa/Makefile | 48 +++ .../gav/gav-0.9.0/automa/Makefile.Linux | 48 +++ .../gav/gav-0.9.0/automa/Makefile.cross.w32 | 44 ++ .../application/gav/gav-0.9.0/automa/State.h | 46 ++ .../gav/gav-0.9.0/automa/StateClient.cpp | 231 ++++++++++ .../gav/gav-0.9.0/automa/StateClient.h | 49 +++ .../gav/gav-0.9.0/automa/StateMenu.h | 76 ++++ .../gav/gav-0.9.0/automa/StatePlaying.cpp | 260 ++++++++++++ .../gav/gav-0.9.0/automa/StatePlaying.h | 48 +++ .../gav/gav-0.9.0/automa/StateWithInput.h | 75 ++++ .../application/gav/gav-0.9.0/build_linux.sh | 5 + .../application/gav/gav-0.9.0/build_osx.sh | 5 + .../application/gav/gav-0.9.0/build_win32.sh | 5 + .../jni/application/gav/gav-0.9.0/globals.cpp | 43 ++ .../jni/application/gav/gav-0.9.0/globals.h | 113 +++++ .../jni/application/gav/gav-0.9.0/main.cpp | 302 +++++++++++++ .../application/gav/gav-0.9.0/menu/Makefile | 48 +++ .../gav/gav-0.9.0/menu/Makefile.Linux | 48 +++ .../gav/gav-0.9.0/menu/Makefile.cross.w32 | 44 ++ .../application/gav/gav-0.9.0/menu/Menu.cpp | 94 ++++ .../jni/application/gav/gav-0.9.0/menu/Menu.h | 46 ++ .../application/gav/gav-0.9.0/menu/MenuItem.h | 43 ++ .../gav/gav-0.9.0/menu/MenuItemBack.h | 42 ++ .../gav/gav-0.9.0/menu/MenuItemBallSpeed.h | 65 +++ .../gav-0.9.0/menu/MenuItemBigBackground.h | 57 +++ .../gav/gav-0.9.0/menu/MenuItemClient.h | 35 ++ .../gav/gav-0.9.0/menu/MenuItemExit.h | 35 ++ .../gav/gav-0.9.0/menu/MenuItemFPS.h | 50 +++ .../gav/gav-0.9.0/menu/MenuItemFrameSkip.h | 51 +++ .../gav/gav-0.9.0/menu/MenuItemFullScreen.h | 60 +++ .../gav/gav-0.9.0/menu/MenuItemJoystick.h | 68 +++ .../gav/gav-0.9.0/menu/MenuItemMonitor.h | 75 ++++ .../gav/gav-0.9.0/menu/MenuItemNotCompiled.h | 48 +++ .../gav-0.9.0/menu/MenuItemNotImplemented.h | 48 +++ .../gav/gav-0.9.0/menu/MenuItemPlay.h | 35 ++ .../gav/gav-0.9.0/menu/MenuItemPlayer.h | 102 +++++ .../gav/gav-0.9.0/menu/MenuItemSave.h | 51 +++ .../gav/gav-0.9.0/menu/MenuItemScore.h | 49 +++ .../gav/gav-0.9.0/menu/MenuItemServer.h | 43 ++ .../gav/gav-0.9.0/menu/MenuItemSound.h | 43 ++ .../gav/gav-0.9.0/menu/MenuItemSubMenu.h | 36 ++ .../gav/gav-0.9.0/menu/MenuItemTheme.h | 53 +++ .../application/gav/gav-0.9.0/menu/MenuKeys.h | 117 +++++ .../application/gav/gav-0.9.0/menu/MenuRoot.h | 41 ++ .../gav/gav-0.9.0/menu/MenuThemes.h | 50 +++ .../application/gav/gav-0.9.0/net/Makefile | 48 +++ .../gav/gav-0.9.0/net/Makefile.Linux | 48 +++ .../gav/gav-0.9.0/net/Makefile.cross.w32 | 44 ++ .../jni/application/gav/gav-0.9.0/net/Net.h | 102 +++++ .../gav/gav-0.9.0/net/NetClient.cpp | 128 ++++++ .../application/gav/gav-0.9.0/net/NetClient.h | 61 +++ .../gav/gav-0.9.0/net/NetServer.cpp | 168 ++++++++ .../application/gav/gav-0.9.0/net/NetServer.h | 62 +++ .../application/gav/gav-0.9.0/osx-info.plist | 20 + .../gav/gav-0.9.0/package/gav.desktop | 10 + .../application/gav/gav-0.9.0/package/gav.png | Bin 0 -> 2083 bytes .../gav/gav-0.9.0/package/gav.spec | 76 ++++ .../gav/gav-0.9.0/package/themes.spec | 105 +++++ project/jni/application/gav/icon.png | Bin 0 -> 14646 bytes 105 files changed, 8693 insertions(+) create mode 100644 project/jni/application/gav/AndroidAppSettings.cfg create mode 100755 project/jni/application/gav/AndroidBuild.sh create mode 100644 project/jni/application/gav/gav-0.9.0/Ball.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/Ball.h create mode 100644 project/jni/application/gav/gav-0.9.0/CHANGELOG create mode 100644 project/jni/application/gav/gav-0.9.0/CommonHeader create mode 100644 project/jni/application/gav/gav-0.9.0/Configuration.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/Configuration.h create mode 100644 project/jni/application/gav/gav-0.9.0/ControlsArray.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/ControlsArray.h create mode 100644 project/jni/application/gav/gav-0.9.0/FrameSeq.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/FrameSeq.h create mode 100644 project/jni/application/gav/gav-0.9.0/GameRenderer.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/GameRenderer.h create mode 100644 project/jni/application/gav/gav-0.9.0/InputState.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/InputState.h create mode 100644 project/jni/application/gav/gav-0.9.0/LICENSE create mode 100644 project/jni/application/gav/gav-0.9.0/LogicalFrameSeq.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/LogicalFrameSeq.h create mode 100644 project/jni/application/gav/gav-0.9.0/Makefile create mode 100644 project/jni/application/gav/gav-0.9.0/Makefile.Linux create mode 100644 project/jni/application/gav/gav-0.9.0/Makefile.cross.w32 create mode 100644 project/jni/application/gav/gav-0.9.0/Player.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/Player.h create mode 100644 project/jni/application/gav/gav-0.9.0/PlayerAI.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/PlayerAI.h create mode 100644 project/jni/application/gav/gav-0.9.0/PlayerHuman.h create mode 100644 project/jni/application/gav/gav-0.9.0/PlayerRemote.h create mode 100644 project/jni/application/gav/gav-0.9.0/README create mode 100644 project/jni/application/gav/gav-0.9.0/README.tags create mode 100644 project/jni/application/gav/gav-0.9.0/README.win32 create mode 100644 project/jni/application/gav/gav-0.9.0/ResizeSurface.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/ResizeSurface.h create mode 100644 project/jni/application/gav/gav-0.9.0/ScreenFont.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/ScreenFont.h create mode 100644 project/jni/application/gav/gav-0.9.0/Sound.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/Sound.h create mode 100644 project/jni/application/gav/gav-0.9.0/SoundMgr.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/SoundMgr.h create mode 100644 project/jni/application/gav/gav-0.9.0/Team.h create mode 100644 project/jni/application/gav/gav-0.9.0/Theme.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/Theme.h create mode 100644 project/jni/application/gav/gav-0.9.0/aarg.h create mode 100644 project/jni/application/gav/gav-0.9.0/automa/Automa.h create mode 100644 project/jni/application/gav/gav-0.9.0/automa/AutomaMainLoop.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/automa/AutomaMainLoop.h create mode 100644 project/jni/application/gav/gav-0.9.0/automa/Makefile create mode 100644 project/jni/application/gav/gav-0.9.0/automa/Makefile.Linux create mode 100644 project/jni/application/gav/gav-0.9.0/automa/Makefile.cross.w32 create mode 100644 project/jni/application/gav/gav-0.9.0/automa/State.h create mode 100644 project/jni/application/gav/gav-0.9.0/automa/StateClient.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/automa/StateClient.h create mode 100644 project/jni/application/gav/gav-0.9.0/automa/StateMenu.h create mode 100644 project/jni/application/gav/gav-0.9.0/automa/StatePlaying.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/automa/StatePlaying.h create mode 100644 project/jni/application/gav/gav-0.9.0/automa/StateWithInput.h create mode 100755 project/jni/application/gav/gav-0.9.0/build_linux.sh create mode 100755 project/jni/application/gav/gav-0.9.0/build_osx.sh create mode 100755 project/jni/application/gav/gav-0.9.0/build_win32.sh create mode 100644 project/jni/application/gav/gav-0.9.0/globals.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/globals.h create mode 100644 project/jni/application/gav/gav-0.9.0/main.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/menu/Makefile create mode 100644 project/jni/application/gav/gav-0.9.0/menu/Makefile.Linux create mode 100644 project/jni/application/gav/gav-0.9.0/menu/Makefile.cross.w32 create mode 100644 project/jni/application/gav/gav-0.9.0/menu/Menu.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/menu/Menu.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItem.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemBack.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemBallSpeed.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemBigBackground.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemClient.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemExit.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemFPS.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemFrameSkip.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemFullScreen.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemJoystick.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemMonitor.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemNotCompiled.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemNotImplemented.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemPlay.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemPlayer.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemSave.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemScore.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemServer.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemSound.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemSubMenu.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuItemTheme.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuKeys.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuRoot.h create mode 100644 project/jni/application/gav/gav-0.9.0/menu/MenuThemes.h create mode 100644 project/jni/application/gav/gav-0.9.0/net/Makefile create mode 100644 project/jni/application/gav/gav-0.9.0/net/Makefile.Linux create mode 100644 project/jni/application/gav/gav-0.9.0/net/Makefile.cross.w32 create mode 100644 project/jni/application/gav/gav-0.9.0/net/Net.h create mode 100644 project/jni/application/gav/gav-0.9.0/net/NetClient.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/net/NetClient.h create mode 100644 project/jni/application/gav/gav-0.9.0/net/NetServer.cpp create mode 100644 project/jni/application/gav/gav-0.9.0/net/NetServer.h create mode 100644 project/jni/application/gav/gav-0.9.0/osx-info.plist create mode 100644 project/jni/application/gav/gav-0.9.0/package/gav.desktop create mode 100644 project/jni/application/gav/gav-0.9.0/package/gav.png create mode 100644 project/jni/application/gav/gav-0.9.0/package/gav.spec create mode 100644 project/jni/application/gav/gav-0.9.0/package/themes.spec create mode 100644 project/jni/application/gav/icon.png diff --git a/project/jni/application/gav/AndroidAppSettings.cfg b/project/jni/application/gav/AndroidAppSettings.cfg new file mode 100644 index 000000000..c291d29ff --- /dev/null +++ b/project/jni/application/gav/AndroidAppSettings.cfg @@ -0,0 +1,32 @@ +# The application settings for Android libSDL port +AppSettingVersion=14 +LibSdlVersion=1.2 +AppName="GPL Arcade Voleyball" +AppFullName=net.gav.sdl +ScreenOrientation=h +InhibitSuspend=n +AppDataDownloadUrl="Data files size is 1 Mb|http://anddev.at.ua/data/gav-data.zip" +SdlVideoResize=y +SdlVideoResizeKeepAspect=n +NeedDepthBuffer=n +AppUsesMouse=n +AppNeedsTwoButtonMouse=n +AppNeedsArrowKeys=y +AppNeedsTextInput=y +AppUsesJoystick=n +AppHandlesJoystickSensitivity=n +AppUsesMultitouch=n +NonBlockingSwapBuffers=n +RedefinedKeys="RETURN LSHIFT RSHIFT LCTRL RETURN" +AppTouchscreenKeyboardKeysAmount=3 +AppTouchscreenKeyboardKeysAmountAutoFire=0 +MultiABI=n +AppVersionCode=12001 +AppVersionName="2.2.01" +CompiledLibraries="jpeg png sdl_image sdl_net" +CustomBuildScript=n +AppCflags='' +AppLdflags='' +AppSubdirsBuild='' +AppUseCrystaXToolchain=y +ReadmeText='^You may press "Home" now - the data will be downloaded in background' diff --git a/project/jni/application/gav/AndroidBuild.sh b/project/jni/application/gav/AndroidBuild.sh new file mode 100755 index 000000000..8d2407245 --- /dev/null +++ b/project/jni/application/gav/AndroidBuild.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +LOCAL_PATH=`dirname $0` +LOCAL_PATH=`cd $LOCAL_PATH && pwd` + +# Hacks for broken configure scripts +#rm -rf $LOCAL_PATH/../../obj/local/armeabi/libSDL_*.so +#rm -rf $LOCAL_PATH/../../obj/local/armeabi/libsdl_main.so + +# Uncomment if your configure expects SDL libraries in form "libSDL_name.so" +#if [ -e $LOCAL_PATH/../../obj/local/armeabi/libsdl_mixer.so ] ; then +# ln -sf libsdl_mixer.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_Mixer.so +#fi + +#for F in $LOCAL_PATH/../../obj/local/armeabi/libsdl_*.so; do +# LIBNAME=`echo $F | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libsdl_\(.*\)[.]so@\1@"` +# ln -sf libsdl_$LIBNAME.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_$LIBNAME.so +#done + +../setEnvironment.sh make -C gav-0.9.0 -j2 +cp -f gav-0.9.0/gav libapplication.so diff --git a/project/jni/application/gav/gav-0.9.0/Ball.cpp b/project/jni/application/gav/gav-0.9.0/Ball.cpp new file mode 100644 index 000000000..8286e1b89 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Ball.cpp @@ -0,0 +1,400 @@ +/* -*- 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; + } + } + */ +} + diff --git a/project/jni/application/gav/gav-0.9.0/Ball.h b/project/jni/application/gav/gav-0.9.0/Ball.h new file mode 100644 index 000000000..35fe24550 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Ball.h @@ -0,0 +1,146 @@ +/* -*- 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_ diff --git a/project/jni/application/gav/gav-0.9.0/CHANGELOG b/project/jni/application/gav/gav-0.9.0/CHANGELOG new file mode 100644 index 000000000..16db551cd --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/CHANGELOG @@ -0,0 +1,54 @@ +Current 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 + diff --git a/project/jni/application/gav/gav-0.9.0/CommonHeader b/project/jni/application/gav/gav-0.9.0/CommonHeader new file mode 100644 index 000000000..0481c601e --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/CommonHeader @@ -0,0 +1,41 @@ +# 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 = arm-eabi-ld +CXX = arm-eabi-g++ + +CXXFLAGS= `sdl-config --cflags` -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fexceptions -fno-rtti -mthumb -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -g -Wall -DAUDIO -I/home/lubomyr/src/endless_space/android-ndk-r4-crystax/build/platforms/android-8/arch-arm/usr/include -I/home/lubomyr/project/jni/sdl-1.2/include -I/home/lubomyr/project/jni/sdl_image/include -I/home/lubomyr/project/jni/sdl_net/include + +ifndef NET +CXXFLAGS+= -DNONET +endif + +ifdef NET +LDFLAGS= `sdl-config --libs` -nostdlib -Wl,-soname,libapplication.so -Wl,-shared,-Bsymbolic -Wl,--whole-archive -Wl,--no-whole-archive /home/lubomyr/src/endless_space/android-ndk-r4-crystax/build/prebuilt/linux-x86/arm-eabi-4.4.0/arm-eabi/lib/libstdc++.a /home/lubomyr/src/endless_space/android-ndk-r4-crystax/build/platforms/android-8/arch-arm/usr/lib/libc.a -L/home/lubomyr/project/obj/local/armeabi -lsdl-1.2 -lsdl_image -lsdl_net -lm -llog -lgcc -L/home/lubomyr/src/endless_space/android-ndk-r4-crystax/build/platforms/android-8/arch-arm/usr/lib +else +LDFLAGS= `sdl-config --libs` -nostdlib -Wl,-soname,libapplication.so -Wl,-shared,-Bsymbolic -Wl,--whole-archive -Wl,--no-whole-archive -L/home/lubomyr/project/obj/local/armeabi -lsdl-1.2 -lsdl_image -lm -L/home/lubomyr/src/endless_space/android-ndk-r4-crystax/build/platforms/android-8/arch-arm/usr/lib +endif + +SRCS = $(wildcard *.cpp) +OFILES = $(SRCS:%.cpp=%.o) + diff --git a/project/jni/application/gav/gav-0.9.0/Configuration.cpp b/project/jni/application/gav/gav-0.9.0/Configuration.cpp new file mode 100644 index 000000000..4dd261aa6 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Configuration.cpp @@ -0,0 +1,241 @@ +/* -*- 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; +} diff --git a/project/jni/application/gav/gav-0.9.0/Configuration.h b/project/jni/application/gav/gav-0.9.0/Configuration.h new file mode 100644 index 000000000..b7b698635 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Configuration.h @@ -0,0 +1,237 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/ControlsArray.cpp b/project/jni/application/gav/gav-0.9.0/ControlsArray.cpp new file mode 100644 index 000000000..14da58395 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/ControlsArray.cpp @@ -0,0 +1,100 @@ +/* -*- 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(); + } +} + diff --git a/project/jni/application/gav/gav-0.9.0/ControlsArray.h b/project/jni/application/gav/gav-0.9.0/ControlsArray.h new file mode 100644 index 000000000..542d2f4a3 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/ControlsArray.h @@ -0,0 +1,104 @@ +/* -*- 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__ + diff --git a/project/jni/application/gav/gav-0.9.0/FrameSeq.cpp b/project/jni/application/gav/gav-0.9.0/FrameSeq.cpp new file mode 100644 index 000000000..f8c42f7f7 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/FrameSeq.cpp @@ -0,0 +1,116 @@ +/* -*- 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); +} + + diff --git a/project/jni/application/gav/gav-0.9.0/FrameSeq.h b/project/jni/application/gav/gav-0.9.0/FrameSeq.h new file mode 100644 index 000000000..d7c5946d7 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/FrameSeq.h @@ -0,0 +1,87 @@ +/* -*- 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 __FRAMESEQ_H__ +#define __FRAMESEQ_H__ + +#include +#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 diff --git a/project/jni/application/gav/gav-0.9.0/GameRenderer.cpp b/project/jni/application/gav/gav-0.9.0/GameRenderer.cpp new file mode 100644 index 000000000..196a668df --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/GameRenderer.cpp @@ -0,0 +1,47 @@ +/* -*- 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); +} diff --git a/project/jni/application/gav/gav-0.9.0/GameRenderer.h b/project/jni/application/gav/gav-0.9.0/GameRenderer.h new file mode 100644 index 000000000..8f38cb923 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/GameRenderer.h @@ -0,0 +1,53 @@ +/* -*- 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_ + diff --git a/project/jni/application/gav/gav-0.9.0/InputState.cpp b/project/jni/application/gav/gav-0.9.0/InputState.cpp new file mode 100644 index 000000000..ec2e581fd --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/InputState.cpp @@ -0,0 +1,50 @@ +/* -*- 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() { +} + diff --git a/project/jni/application/gav/gav-0.9.0/InputState.h b/project/jni/application/gav/gav-0.9.0/InputState.h new file mode 100644 index 000000000..85f62d494 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/InputState.h @@ -0,0 +1,47 @@ +/* -*- 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 + diff --git a/project/jni/application/gav/gav-0.9.0/LICENSE b/project/jni/application/gav/gav-0.9.0/LICENSE new file mode 100644 index 000000000..5b6e7c66c --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/project/jni/application/gav/gav-0.9.0/LogicalFrameSeq.cpp b/project/jni/application/gav/gav-0.9.0/LogicalFrameSeq.cpp new file mode 100644 index 000000000..c0542a8f9 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/LogicalFrameSeq.cpp @@ -0,0 +1,62 @@ +/* -*- 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); +} diff --git a/project/jni/application/gav/gav-0.9.0/LogicalFrameSeq.h b/project/jni/application/gav/gav-0.9.0/LogicalFrameSeq.h new file mode 100644 index 000000000..c9f2683c0 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/LogicalFrameSeq.h @@ -0,0 +1,80 @@ +/* -*- 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__ diff --git a/project/jni/application/gav/gav-0.9.0/Makefile b/project/jni/application/gav/gav-0.9.0/Makefile new file mode 100644 index 000000000..6a0f2375a --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Makefile @@ -0,0 +1,70 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/Makefile.Linux b/project/jni/application/gav/gav-0.9.0/Makefile.Linux new file mode 100644 index 000000000..6a0f2375a --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Makefile.Linux @@ -0,0 +1,70 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/Makefile.cross.w32 b/project/jni/application/gav/gav-0.9.0/Makefile.cross.w32 new file mode 100644 index 000000000..6e912ef1d --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Makefile.cross.w32 @@ -0,0 +1,64 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/Player.cpp b/project/jni/application/gav/gav-0.9.0/Player.cpp new file mode 100644 index 000000000..45de25643 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Player.cpp @@ -0,0 +1,183 @@ +/* -*- 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)); +} diff --git a/project/jni/application/gav/gav-0.9.0/Player.h b/project/jni/application/gav/gav-0.9.0/Player.h new file mode 100644 index 000000000..24c7c0d93 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Player.h @@ -0,0 +1,182 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/PlayerAI.cpp b/project/jni/application/gav/gav-0.9.0/PlayerAI.cpp new file mode 100644 index 000000000..68c1fb7e4 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/PlayerAI.cpp @@ -0,0 +1,244 @@ +/* -*- 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; +} + diff --git a/project/jni/application/gav/gav-0.9.0/PlayerAI.h b/project/jni/application/gav/gav-0.9.0/PlayerAI.h new file mode 100644 index 000000000..234cbb7ad --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/PlayerAI.h @@ -0,0 +1,50 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/PlayerHuman.h b/project/jni/application/gav/gav-0.9.0/PlayerHuman.h new file mode 100644 index 000000000..ba0c3eb85 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/PlayerHuman.h @@ -0,0 +1,39 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/PlayerRemote.h b/project/jni/application/gav/gav-0.9.0/PlayerRemote.h new file mode 100644 index 000000000..e099bacbe --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/PlayerRemote.h @@ -0,0 +1,39 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/README b/project/jni/application/gav/gav-0.9.0/README new file mode 100644 index 000000000..2644a5928 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/README @@ -0,0 +1,61 @@ +Welcome 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 diff --git a/project/jni/application/gav/gav-0.9.0/README.tags b/project/jni/application/gav/gav-0.9.0/README.tags new file mode 100644 index 000000000..86695ea6c --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/README.tags @@ -0,0 +1 @@ +2005-12-27 PRESCALE (before the scale feature) diff --git a/project/jni/application/gav/gav-0.9.0/README.win32 b/project/jni/application/gav/gav-0.9.0/README.win32 new file mode 100644 index 000000000..b96542cd0 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/README.win32 @@ -0,0 +1,13 @@ +Welcome 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 + diff --git a/project/jni/application/gav/gav-0.9.0/ResizeSurface.cpp b/project/jni/application/gav/gav-0.9.0/ResizeSurface.cpp new file mode 100644 index 000000000..cae76340e --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/ResizeSurface.cpp @@ -0,0 +1,198 @@ +/* -*- 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; +} + diff --git a/project/jni/application/gav/gav-0.9.0/ResizeSurface.h b/project/jni/application/gav/gav-0.9.0/ResizeSurface.h new file mode 100644 index 000000000..cd5ebcfda --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/ResizeSurface.h @@ -0,0 +1,29 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/ScreenFont.cpp b/project/jni/application/gav/gav-0.9.0/ScreenFont.cpp new file mode 100644 index 000000000..5aa8b90e4 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/ScreenFont.cpp @@ -0,0 +1,67 @@ +/* -*- 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); +} diff --git a/project/jni/application/gav/gav-0.9.0/ScreenFont.h b/project/jni/application/gav/gav-0.9.0/ScreenFont.h new file mode 100644 index 000000000..7c9baaa4d --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/ScreenFont.h @@ -0,0 +1,58 @@ +/* -*- 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_ diff --git a/project/jni/application/gav/gav-0.9.0/Sound.cpp b/project/jni/application/gav/gav-0.9.0/Sound.cpp new file mode 100644 index 000000000..19e7c9341 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Sound.cpp @@ -0,0 +1,99 @@ +/* -*- 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 "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_ diff --git a/project/jni/application/gav/gav-0.9.0/SoundMgr.cpp b/project/jni/application/gav/gav-0.9.0/SoundMgr.cpp new file mode 100644 index 000000000..b15ac5857 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/SoundMgr.cpp @@ -0,0 +1,96 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/SoundMgr.h b/project/jni/application/gav/gav-0.9.0/SoundMgr.h new file mode 100644 index 000000000..e7a945ef8 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/SoundMgr.h @@ -0,0 +1,48 @@ +/* -*- 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_ diff --git a/project/jni/application/gav/gav-0.9.0/Team.h b/project/jni/application/gav/gav-0.9.0/Team.h new file mode 100644 index 000000000..012df7871 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Team.h @@ -0,0 +1,169 @@ +/* -*- 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_ diff --git a/project/jni/application/gav/gav-0.9.0/Theme.cpp b/project/jni/application/gav/gav-0.9.0/Theme.cpp new file mode 100644 index 000000000..f04b34a80 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Theme.cpp @@ -0,0 +1,137 @@ +/* -*- 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()); +} diff --git a/project/jni/application/gav/gav-0.9.0/Theme.h b/project/jni/application/gav/gav-0.9.0/Theme.h new file mode 100644 index 000000000..6b7e9db02 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/Theme.h @@ -0,0 +1,229 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/aarg.h b/project/jni/application/gav/gav-0.9.0/aarg.h new file mode 100644 index 000000000..a21287058 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/aarg.h @@ -0,0 +1,179 @@ +/* -*- 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_ diff --git a/project/jni/application/gav/gav-0.9.0/automa/Automa.h b/project/jni/application/gav/gav-0.9.0/automa/Automa.h new file mode 100644 index 000000000..473a37005 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/Automa.h @@ -0,0 +1,55 @@ +/* -*- 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_ diff --git a/project/jni/application/gav/gav-0.9.0/automa/AutomaMainLoop.cpp b/project/jni/application/gav/gav-0.9.0/automa/AutomaMainLoop.cpp new file mode 100644 index 000000000..6fd7edf4a --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/AutomaMainLoop.cpp @@ -0,0 +1,113 @@ +/* -*- 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); +} diff --git a/project/jni/application/gav/gav-0.9.0/automa/AutomaMainLoop.h b/project/jni/application/gav/gav-0.9.0/automa/AutomaMainLoop.h new file mode 100644 index 000000000..8d8e00abb --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/AutomaMainLoop.h @@ -0,0 +1,47 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/automa/Makefile b/project/jni/application/gav/gav-0.9.0/automa/Makefile new file mode 100644 index 000000000..454d272ed --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/Makefile @@ -0,0 +1,48 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/automa/Makefile.Linux b/project/jni/application/gav/gav-0.9.0/automa/Makefile.Linux new file mode 100644 index 000000000..454d272ed --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/Makefile.Linux @@ -0,0 +1,48 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/automa/Makefile.cross.w32 b/project/jni/application/gav/gav-0.9.0/automa/Makefile.cross.w32 new file mode 100644 index 000000000..62cd38621 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/Makefile.cross.w32 @@ -0,0 +1,44 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/automa/State.h b/project/jni/application/gav/gav-0.9.0/automa/State.h new file mode 100644 index 000000000..f6edc2cc1 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/State.h @@ -0,0 +1,46 @@ +/* -*- 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_ diff --git a/project/jni/application/gav/gav-0.9.0/automa/StateClient.cpp b/project/jni/application/gav/gav-0.9.0/automa/StateClient.cpp new file mode 100644 index 000000000..01eddac22 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/StateClient.cpp @@ -0,0 +1,231 @@ +/* -*- 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); +} diff --git a/project/jni/application/gav/gav-0.9.0/automa/StateClient.h b/project/jni/application/gav/gav-0.9.0/automa/StateClient.h new file mode 100644 index 000000000..638e22e11 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/StateClient.h @@ -0,0 +1,49 @@ +/* -*- 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_ diff --git a/project/jni/application/gav/gav-0.9.0/automa/StateMenu.h b/project/jni/application/gav/gav-0.9.0/automa/StateMenu.h new file mode 100644 index 000000000..ca609aeea --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/StateMenu.h @@ -0,0 +1,76 @@ +/* -*- 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__ diff --git a/project/jni/application/gav/gav-0.9.0/automa/StatePlaying.cpp b/project/jni/application/gav/gav-0.9.0/automa/StatePlaying.cpp new file mode 100644 index 000000000..9a890c3fd --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/StatePlaying.cpp @@ -0,0 +1,260 @@ +/* -*- 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); +} diff --git a/project/jni/application/gav/gav-0.9.0/automa/StatePlaying.h b/project/jni/application/gav/gav-0.9.0/automa/StatePlaying.h new file mode 100644 index 000000000..f7daae637 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/StatePlaying.h @@ -0,0 +1,48 @@ +/* -*- 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_ diff --git a/project/jni/application/gav/gav-0.9.0/automa/StateWithInput.h b/project/jni/application/gav/gav-0.9.0/automa/StateWithInput.h new file mode 100644 index 000000000..ee04d8f89 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/automa/StateWithInput.h @@ -0,0 +1,75 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/build_linux.sh b/project/jni/application/gav/gav-0.9.0/build_linux.sh new file mode 100755 index 000000000..06b86dd8d --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/build_linux.sh @@ -0,0 +1,5 @@ +make clean +cp Makefile.Linux Makefile +cp automa/Makefile.Linux automa/Makefile +cp menu/Makefile.Linux menu/Makefile +cp net/Makefile.Linux net/Makefile diff --git a/project/jni/application/gav/gav-0.9.0/build_osx.sh b/project/jni/application/gav/gav-0.9.0/build_osx.sh new file mode 100755 index 000000000..e203d494a --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/build_osx.sh @@ -0,0 +1,5 @@ +rm -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.plist \ No newline at end of file diff --git a/project/jni/application/gav/gav-0.9.0/build_win32.sh b/project/jni/application/gav/gav-0.9.0/build_win32.sh new file mode 100755 index 000000000..8972bf80e --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/build_win32.sh @@ -0,0 +1,5 @@ +make 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 diff --git a/project/jni/application/gav/gav-0.9.0/globals.cpp b/project/jni/application/gav/gav-0.9.0/globals.cpp new file mode 100644 index 000000000..988a8f945 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/globals.cpp @@ -0,0 +1,43 @@ +/* -*- 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 + diff --git a/project/jni/application/gav/gav-0.9.0/globals.h b/project/jni/application/gav/gav-0.9.0/globals.h new file mode 100644 index 000000000..833bb9f51 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/globals.h @@ -0,0 +1,113 @@ +/* -*- 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 _GLOBALS_H_ +#define _GLOBALS_H_ + +#include +#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_ diff --git a/project/jni/application/gav/gav-0.9.0/main.cpp b/project/jni/application/gav/gav-0.9.0/main.cpp new file mode 100644 index 000000000..bf2d024a4 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/main.cpp @@ -0,0 +1,302 @@ +/* -*- 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; +} diff --git a/project/jni/application/gav/gav-0.9.0/menu/Makefile b/project/jni/application/gav/gav-0.9.0/menu/Makefile new file mode 100644 index 000000000..b11075edc --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/Makefile @@ -0,0 +1,48 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/Makefile.Linux b/project/jni/application/gav/gav-0.9.0/menu/Makefile.Linux new file mode 100644 index 000000000..b11075edc --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/Makefile.Linux @@ -0,0 +1,48 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/Makefile.cross.w32 b/project/jni/application/gav/gav-0.9.0/menu/Makefile.cross.w32 new file mode 100644 index 000000000..96021808e --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/Makefile.cross.w32 @@ -0,0 +1,44 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/Menu.cpp b/project/jni/application/gav/gav-0.9.0/menu/Menu.cpp new file mode 100644 index 000000000..fbea44584 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/Menu.cpp @@ -0,0 +1,94 @@ +#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; +} + diff --git a/project/jni/application/gav/gav-0.9.0/menu/Menu.h b/project/jni/application/gav/gav-0.9.0/menu/Menu.h new file mode 100644 index 000000000..87d1363a7 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/Menu.h @@ -0,0 +1,46 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItem.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItem.h new file mode 100644 index 000000000..2e8d72b74 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItem.h @@ -0,0 +1,43 @@ +/* + 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemBack.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemBack.h new file mode 100644 index 000000000..9f416274a --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemBack.h @@ -0,0 +1,42 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemBallSpeed.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemBallSpeed.h new file mode 100644 index 000000000..73a0e490c --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemBallSpeed.h @@ -0,0 +1,65 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemBigBackground.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemBigBackground.h new file mode 100644 index 000000000..e789c9c21 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemBigBackground.h @@ -0,0 +1,57 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemClient.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemClient.h new file mode 100644 index 000000000..d41256f35 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemClient.h @@ -0,0 +1,35 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemExit.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemExit.h new file mode 100644 index 000000000..4c6e8df25 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemExit.h @@ -0,0 +1,35 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemFPS.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemFPS.h new file mode 100644 index 000000000..97003d82a --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemFPS.h @@ -0,0 +1,50 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemFrameSkip.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemFrameSkip.h new file mode 100644 index 000000000..d81383d73 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemFrameSkip.h @@ -0,0 +1,51 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemFullScreen.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemFullScreen.h new file mode 100644 index 000000000..d39b69e76 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemFullScreen.h @@ -0,0 +1,60 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemJoystick.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemJoystick.h new file mode 100644 index 000000000..0cb153bfa --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemJoystick.h @@ -0,0 +1,68 @@ +/* -*- 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__ diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemMonitor.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemMonitor.h new file mode 100644 index 000000000..154347ab1 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemMonitor.h @@ -0,0 +1,75 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemNotCompiled.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemNotCompiled.h new file mode 100644 index 000000000..0c27ad875 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemNotCompiled.h @@ -0,0 +1,48 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemNotImplemented.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemNotImplemented.h new file mode 100644 index 000000000..09aba2a20 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemNotImplemented.h @@ -0,0 +1,48 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemPlay.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemPlay.h new file mode 100644 index 000000000..bccd1a097 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemPlay.h @@ -0,0 +1,35 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemPlayer.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemPlayer.h new file mode 100644 index 000000000..964d7b9e6 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemPlayer.h @@ -0,0 +1,102 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemSave.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemSave.h new file mode 100644 index 000000000..b065d235a --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemSave.h @@ -0,0 +1,51 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemScore.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemScore.h new file mode 100644 index 000000000..c6d5b439b --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemScore.h @@ -0,0 +1,49 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemServer.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemServer.h new file mode 100644 index 000000000..5d2145106 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemServer.h @@ -0,0 +1,43 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemSound.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemSound.h new file mode 100644 index 000000000..3ee5914cd --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemSound.h @@ -0,0 +1,43 @@ +/* -*- 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__ diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemSubMenu.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemSubMenu.h new file mode 100644 index 000000000..606bccab7 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemSubMenu.h @@ -0,0 +1,36 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuItemTheme.h b/project/jni/application/gav/gav-0.9.0/menu/MenuItemTheme.h new file mode 100644 index 000000000..40a235690 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuItemTheme.h @@ -0,0 +1,53 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuKeys.h b/project/jni/application/gav/gav-0.9.0/menu/MenuKeys.h new file mode 100644 index 000000000..b4df8790b --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuKeys.h @@ -0,0 +1,117 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuRoot.h b/project/jni/application/gav/gav-0.9.0/menu/MenuRoot.h new file mode 100644 index 000000000..56975fd8c --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuRoot.h @@ -0,0 +1,41 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/menu/MenuThemes.h b/project/jni/application/gav/gav-0.9.0/menu/MenuThemes.h new file mode 100644 index 000000000..1bb475e64 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/menu/MenuThemes.h @@ -0,0 +1,50 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/net/Makefile b/project/jni/application/gav/gav-0.9.0/net/Makefile new file mode 100644 index 000000000..bfa87d2cf --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/net/Makefile @@ -0,0 +1,48 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/net/Makefile.Linux b/project/jni/application/gav/gav-0.9.0/net/Makefile.Linux new file mode 100644 index 000000000..bfa87d2cf --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/net/Makefile.Linux @@ -0,0 +1,48 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/net/Makefile.cross.w32 b/project/jni/application/gav/gav-0.9.0/net/Makefile.cross.w32 new file mode 100644 index 000000000..257e6709c --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/net/Makefile.cross.w32 @@ -0,0 +1,44 @@ +# 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 diff --git a/project/jni/application/gav/gav-0.9.0/net/Net.h b/project/jni/application/gav/gav-0.9.0/net/Net.h new file mode 100644 index 000000000..44728ed39 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/net/Net.h @@ -0,0 +1,102 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/net/NetClient.cpp b/project/jni/application/gav/gav-0.9.0/net/NetClient.cpp new file mode 100644 index 000000000..2542abdc3 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/net/NetClient.cpp @@ -0,0 +1,128 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/net/NetClient.h b/project/jni/application/gav/gav-0.9.0/net/NetClient.h new file mode 100644 index 000000000..2213d8a7d --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/net/NetClient.h @@ -0,0 +1,61 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/net/NetServer.cpp b/project/jni/application/gav/gav-0.9.0/net/NetServer.cpp new file mode 100644 index 000000000..0aedec9db --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/net/NetServer.cpp @@ -0,0 +1,168 @@ +/* -*- 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 + diff --git a/project/jni/application/gav/gav-0.9.0/net/NetServer.h b/project/jni/application/gav/gav-0.9.0/net/NetServer.h new file mode 100644 index 000000000..33ac7e000 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/net/NetServer.h @@ -0,0 +1,62 @@ +/* -*- 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 diff --git a/project/jni/application/gav/gav-0.9.0/osx-info.plist b/project/jni/application/gav/gav-0.9.0/osx-info.plist new file mode 100644 index 000000000..38006cd7a --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/osx-info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + gav + CFBundleIdentifier + com.gavproject.gav + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0.0d1 + + diff --git a/project/jni/application/gav/gav-0.9.0/package/gav.desktop b/project/jni/application/gav/gav-0.9.0/package/gav.desktop new file mode 100644 index 000000000..d73eb6eda --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/package/gav.desktop @@ -0,0 +1,10 @@ +[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 diff --git a/project/jni/application/gav/gav-0.9.0/package/gav.png b/project/jni/application/gav/gav-0.9.0/package/gav.png new file mode 100644 index 0000000000000000000000000000000000000000..68047da18a12ae3c07211460703b8da05cc2d135 GIT binary patch literal 2083 zcmeAS@N?(olHy`uVBq!ia0y~yU@!n-4mJh`hH$2z?Fx;TbZ%(*%~Z^9KGKVB${x+Rl(PGB)(u1Nmm!l%w{J<|j6C}Gut#Y&zf+B7VHbaGKp@8=--!*~ z&urUj4F&k#3cc8~=2TmP!!F;+w=}mDiajptk`z*Yw_~yMwu`y)b>E-Ot4@D+#zHds zSL^A$-^=Ts-}!9&{LjBR#pVH;TjbdKvKlxOSR}Tb`qgN+Al>)(rXa1bkK4NzY}3(Q z+w35G;M;D48~ppv2%KSQG?}pRiyQ;v0@fAguhKcPN+cTI-f)>dB}npG=O>N>iU~JF zO3oZ|;V-x&z!xbi^XbaGrxUKWbxIWM{IgE1O`oy1k3n&1;&Gday73)*GCkid6e&4Z zp|w?+WzP+^l0z~M%v;VgM0aGYUF@~;2e%@F409h-&2#w+=8yF5RLAOxS84hvC|%cR z*vj(qv4ph+Th59V&&57*X58hG+4(nH$vWTJgs(BQ!+oj6jK+1E{&Oc>J-I;HOGRi& zkftVIYln+c$;?ur1HuFxej1K<({1ZJ|YV}xOH*t69#xU2hmWU`CFz(>kvE2Xl=JkIk z_kFihlk#)&mTF7>@JTuSt$7Ofn!j>Ka+yw_KHbybKiNmkbNOY4EnBt-@U>eOJYcwD zYGkL}e8En=H1Dla*fA^iSmp$ zZSyz-cAeNEaUyNAkDuSJl$Ry5O03S#v#nmRapK9mjNOj~Dt1gY5cnsuV}5J%jU?^q$ zv5Ku|$EBW}<`Esj6h;4ZkJUf^9+&K-;gplsFm0;aaD782bDf4Mv+9MF0h^Z{Fl7$!O-cQ}#pU$I!$tRP-%feI z`&Hi6ZJo8@tqn`f`&_&mwl^>{@Nf5;UH02G;oA0%4?>FsXBb^N>fz*8_GUwgfmFNy z{b`$4_y@e5)fE1It>BKfpiPMvf35IU5T2rOe@n=u1E#H7J0G4jezZ*Wh3wR?H6K;x z?BVD=?e{Zj^NHL!dm>&5i%H(dx82S-eck)k=-n-4i?+jAOo?yNg+X=lIT)P21< z&lEN+(b)TPz3a*+vtPJ2_X*X_L$ClS=Qd^in_dmMw6VR`nwuBQ3=>J=QZOKH*F$ zF>;KIx-BP?r6zx{XY-#ozZ^K$%13K?hdhiqv3u#9gSRICQcb>>@~U!@A%9YKUYYEN zs)f?}wI?56w|_iWeYQ+~u!f~~>yZfGGg}W&_RX7V-oEnuLFxK-{cQp>r_WVz;94s5 zT7AKl&eJdW64I9VH_eb=_kOG2GoGGr&z1`<+sk00-<2)*^6`y5bGRGlc!iXdMLibX zbN;t<<8t}`EoZ;SFSL}JZc?@~(&o%`eb1DC#q2eCrQ4omSL~78X4ew_?(`cMp%2$g zYW~H}sAd+6QVsh5KwqeF{?#sD)x$LmcOES6f2O54LHvYB7Nf=4?a>Z*NzIJl=HTjfiEM4Cidk&a3}=zm~|IvY38l$M!kp+jn2iUE5W?QmJF=B zEUh=m&(^Q6nr!ePvGx9MRzHz>>o@R2P&ec*@64>+rEGvtDCZyj5B2^Fgp|Lvy15tr+i>T|ogI4=LZ&hlh_xS>n#HmzXoXheo;RgyW~~)> z3*|hrSngnbqeJN91D?t5*SR|L9lbQS?swT*x^R{8153S4b@}@vLQ>hbTx)N*pCH2} z@!_*e`qZHPvG2F9Hf46~v7aON<7Bhlr{{<28B+JonRT=0$TS891_n=8KbLh*2~7Zp CYSFs@ literal 0 HcmV?d00001 diff --git a/project/jni/application/gav/gav-0.9.0/package/gav.spec b/project/jni/application/gav/gav-0.9.0/package/gav.spec new file mode 100644 index 000000000..1b5d9356c --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/package/gav.spec @@ -0,0 +1,76 @@ +Summary: 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 + + diff --git a/project/jni/application/gav/gav-0.9.0/package/themes.spec b/project/jni/application/gav/gav-0.9.0/package/themes.spec new file mode 100644 index 000000000..7aa75a970 --- /dev/null +++ b/project/jni/application/gav/gav-0.9.0/package/themes.spec @@ -0,0 +1,105 @@ +# 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 + + diff --git a/project/jni/application/gav/icon.png b/project/jni/application/gav/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ad30aedf682d20f308972fa37de16b6e45ba5e2d GIT binary patch literal 14646 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≠=G0ciX1p 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