Added Biniax2 sources

This commit is contained in:
pelya
2012-09-17 17:26:24 +03:00
parent a6a9e0a43a
commit 7247509c04
22 changed files with 4764 additions and 4 deletions

View File

@@ -0,0 +1,51 @@
# The application settings for Android libSDL port
AppSettingVersion=17
LibSdlVersion=1.2
AppName="Biniax2"
AppFullName=com.biniax.sdl
ScreenOrientation=h
InhibitSuspend=n
AppDataDownloadUrl="!Game data|data.zip"
VideoDepthBpp=16
NeedDepthBuffer=n
NeedStencilBuffer=n
NeedGles2=n
SwVideoMode=y
SdlVideoResize=y
SdlVideoResizeKeepAspect=n
CompatibilityHacks=n
CompatibilityHacksStaticInit=n
CompatibilityHacksTextInputEmulatesHwKeyboard=n
AppUsesMouse=n
AppNeedsTwoButtonMouse=n
ShowMouseCursor=n
ForceRelativeMouseMode=n
AppNeedsArrowKeys=y
AppNeedsTextInput=n
AppUsesJoystick=n
AppUsesAccelerometer=n
AppUsesMultitouch=n
NonBlockingSwapBuffers=n
RedefinedKeys="RETURN"
AppTouchscreenKeyboardKeysAmount=2
AppTouchscreenKeyboardKeysAmountAutoFire=0
RedefinedKeysScreenKb="RETURN SPACE"
StartupMenuButtonTimeout=0
HiddenMenuOptions=''
FirstStartMenuOptions=''
MultiABI=n
AppVersionCode=1301
AppVersionName="1.3.01"
ResetSdlConfigForThisVersion=n
DeleteFilesOnUpgrade="%"
CompiledLibraries="sdl_image sdl_mixer"
CustomBuildScript=n
AppCflags=''
AppLdflags=''
AppSubdirsBuild='src/*'
AppCmdline=''
ReadmeText='^.'
MinimumScreenSize=n
AdmobPublisherId=n
AdmobTestDeviceId=
AdmobBannerSize=

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,127 @@
/******************************************************************************
BINIAX SETUP IMPLEMENTATIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2007
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
/******************************************************************************
INCLUDES
******************************************************************************/
#include "inc.h"
/******************************************************************************
FUNCTIONS
******************************************************************************/
#define _Cfg_Buffer 255
#define csConfigName "config.bnx2"
struct BNX_SETUP
{
BNX_BOOL sound;
BNX_BOOL music;
BNX_BOOL fullscreen;
BNX_BOOL touch;
} _Cfg;
BNX_BOOL cfgCheckRegistered( char * RegCode );
BNX_BOOL cfgInit()
{
FILE *f;
char buffer[ _Cfg_Buffer ];
int nTemp;
_Cfg.sound = BNX_TRUE;
_Cfg.music = BNX_TRUE;
_Cfg.fullscreen = BNX_FALSE;
_Cfg.touch = BNX_FALSE;
f = fopen( sysGetFullFileName( csConfigName ), "rt" );
if ( f == 0 )
{
return BNX_FALSE;
}
fgets( buffer, _Cfg_Buffer, f );
sscanf( buffer, "SOUND=%d", &nTemp );
_Cfg.sound = (BNX_BOOL) nTemp;
fgets( buffer, _Cfg_Buffer, f );
sscanf( buffer, "MUSIC=%d", &nTemp );
_Cfg.music = (BNX_BOOL) nTemp;
fgets( buffer, _Cfg_Buffer, f );
sscanf( buffer, "FULLSCREEN=%d", &nTemp );
_Cfg.fullscreen = (BNX_BOOL) nTemp;
fgets( buffer, _Cfg_Buffer, f );
sscanf( buffer, "TOUCH=%d", &nTemp );
_Cfg.touch = (BNX_BOOL) nTemp;
fclose( f );
return BNX_TRUE;
}
BNX_BOOL cfgGetSound()
{
return _Cfg.sound;
}
BNX_BOOL cfgGetMusic()
{
return _Cfg.music;
}
BNX_BOOL cfgGetFullscreen()
{
return _Cfg.fullscreen;
}
BNX_BOOL cfgGetTouch()
{
return _Cfg.touch;
}
void cfgSetSound( BNX_BOOL v )
{
_Cfg.sound = v;
}
void cfgSetMusic( BNX_BOOL v )
{
_Cfg.music = v;
}
void cfgSetFullscreen( BNX_BOOL v )
{
_Cfg.fullscreen = v;
}
void cfgSetTouch( BNX_BOOL v )
{
_Cfg.touch = v;
}

View File

@@ -0,0 +1,52 @@
/******************************************************************************
BINIAX CONFIG DEFINITIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2009
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
#ifndef _BNX_CFG_H
#define _BNX_CFG_H
/******************************************************************************
INCLUDES
******************************************************************************/
#include "inc.h"
/******************************************************************************
FUNCTIONS
******************************************************************************/
BNX_BOOL cfgInit();
BNX_BOOL cfgGetSound();
BNX_BOOL cfgGetMusic();
BNX_BOOL cfgGetFullscreen();
BNX_BOOL cfgGetTouch();
void cfgSetSound( BNX_BOOL v );
void cfgSetMusic( BNX_BOOL v );
void cfgSetFullscreen( BNX_BOOL v );
void cfgSetTouch( BNX_BOOL v );
#endif

View File

@@ -0,0 +1,237 @@
/******************************************************************************
BINIAX GAME-RELATED DEFINITIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2009
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
#ifndef _BNX_GAME_H
#define _BNX_GAME_H
/******************************************************************************
INCLUDES
******************************************************************************/
#include "types.h"
/******************************************************************************
DEFINITIONS
******************************************************************************/
#define csSaveGameName "autosave.bnx2"
/******************************************************************************
CONSTANTS
******************************************************************************/
#define cGridX 5 /* X size of the grid */
#define cGridY 7 /* Y size of the grid */
#define cMaxElements 4 /* Maximum num. of elements */
#define cBeginFlag 254 /* Minimum flag index */
#define cBrickFlag 254 /* Brick in game map */
#define cPlayerFlag 255 /* Flag of the player in map*/
#define cElementLimit 200 /* Less than this is a pair */
#define cInitLines 3 /* Lines to add on start... */
#define cDeltaTime 60 /* Time for game step in ms */
#define cMaxScroll 70 /* Slowest scroll in steps. */
#define cMinScroll 18 /* Fastest scroll in steps. */
#define cMultiScroll 22 /* Constant speed in multi. */
#define cScoreStep 10 /* How to increas the score */
#define cClearInit 1 /* Initial clear counter */
#define cClearMax 15 /* Maximum clears */
#define cComboMinor 2 /* How long chain for c.min.*/
#define cComboNormal 3 /* How long chain for c.nor.*/
#define cComboBig 4 /* How long chain for c.big */
#define cComboMega 5 /* How long chain for c.meg.*/
#define cClearIncrement 100 /* Increment clear at every 100 lines */
#define cMaxMoves 2 /* Max moves to scroll in turn mode. */
#define cMaxMovesInLevel 4 /* Max moves to scroll in turn - in level. */
#define cShakeAfter 8 /* Shake after X remainig ticks to scroll */
#define cElCorrect 15 /* Elements to take to speed-up the game */
#define cMaxSpeedScore 5000 /* Score, at each the max speed is reached */
#define cFileVersion 130 /* File version for compatibility.130=1.30 */
#define cSaveFileSize 116 /* Size of save game file in bytes */
enum BNX_Players
{
cPlayer1 = 0,
cPlayer2,
cMaxPlayers
};
enum BNX_Modes
{
cModeRealtime = 1,
cModeTurn,
cModeMultiplayer,
cModeNetworkServer,
cModeNetworkClient,
cMaxModes
};
enum BNX_Messages
{
cTextIngameScore = 0,
cTextMultiScore,
cTextMultiRound1,
cTextMultiRound2,
cTextMultiRoundN,
cTextGameOver,
cTextBestScore,
cTextExtraMessages,
};
enum BNX_NetMessages
{
cNetMessageStart = 0,
cNetMessageEnterIP,
cNetMessageConnecting,
cNetMessageError,
cMaxNetMessages
};
enum BNX_Extras
{
cExtraMinorCombo = 0,
cExtraCombo,
cExtraBigCombo,
cExtraMegaCombo,
cExtraFieldMastered,
cExtraBrush,
cMaxExtras
};
enum BNX_Roadmap
{
cRoadBeginnerScore = 2000,
cRoadRookieScore = 4000,
cRoadNoviceScore = 8000,
cRoadAdvancedScore = 16000,
cRoadExpertScore = 32000,
cRoadMasterScore = 64000,
cRoadKingScore = 128000,
};
enum BNX_Options
{
cOptionContinue = 0,
cOptionNewRealtime,
cOptionNewTurn,
cOptionNewMultiplayer,
cOptionHall,
cOptionHelp,
cOptionQuit,
cMaxOptions
};
enum BNX_MultiOptions
{
cOptionMultiSame = 0,
cOptionMultiServer,
cOptionMultiClient,
cOptionMultiBack,
cMaxMultiOptions
};
enum BNX_LoopResult
{
cDoNothing = 0,
cDoSave,
cDoRestart,
cDoNetError
};
enum BNX_States
{
cStateMainMenu = 0,
cStateMultiMenu,
cStateHelp,
cStateHallView,
cStateHallEnter,
cStateGame,
cStateConnectionClosed
};
/******************************************************************************
GAME DATA
******************************************************************************/
/* Player definition */
typedef struct BNX_PLAYER
{
BNX_INT8 x; /* X position in grid */
BNX_INT8 y; /* Y position in grid */
BNX_INT8 e; /* Element index */
} BNX_PLAYER;
/* Game definition */
typedef struct BNX_GAME
{
BNX_UINT32 moment; /* Game moment */
BNX_PLAYER player[ cMaxPlayers ]; /* The players */
BNX_UINT8 grid[ cGridX ][ cGridY ]; /* Game field / grid */
BNX_UINT16 mode; /* Game mode - one of _BNX_Modes */
BNX_INT32 score[ cMaxPlayers ]; /* Score */
BNX_INT32 wins[ cMaxPlayers ]; /* Multiplayer Score */
BNX_INT32 best[ cMaxModes ]; /* Best score */
BNX_INT16 scroll; /* Current scroll step - realtime*/
BNX_INT16 speed; /* Current game speed - realtime */
BNX_INT16 moves; /* Moves counter - turn mode only*/
BNX_INT16 clears; /* Clear column counter */
BNX_BOOL ingame; /* Game is running */
BNX_UINT32 sounds; /* Flag with sounds to play */
BNX_UINT8 message; /* Type of message to show */
BNX_UINT32 lines; /* Lines counter */
BNX_INT16 level; /* Last level */
BNX_INT16 level_count; /* Count current level line */
} BNX_GAME;
/******************************************************************************
For the grid definition assume, that indexes in grid are as follows :
........[ cGridX-1][ cGridY-1 ]
...............................
...............................
[ 0 ][ 0 ].....................
The scroll down removes the first row (with index 0).
Pairs are coded in the BYTE as xxxxyyyy. You can get left element of the
pair with (PAIR >> 4) and the right one with (PAIR & 0xf)
"Legal" pairs consists of two DIFFERENT elements !
Pair 0-0 (or just 0) is an empty space.
******************************************************************************/
#define pairLeft( pair ) ( (pair) >> 4 )
#define pairRight( pair ) ( (pair) & 0xf )
#define soundMask( index ) ( 1 << ( index ) )
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,280 @@
/******************************************************************************
BINIAX GRAPHICS-RELATED DEFINITIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2009
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
#ifndef _BNX_GFX_H
#define _BNX_GFX_H
/******************************************************************************
INCLUDES
******************************************************************************/
#include "inc.h"
#include <SDL.h>
#include <SDL_image.h>
/******************************************************************************
GRAPHICS CONSTANTS
******************************************************************************/
#define cGfxScreenX 800
#define cGfxScreenY 600
#define cGfxColorDepth 16
#define cGfxZeroX 32
#define cGfxZeroY 527
#define cGfxNextPlusX 48
#define cGfxShieldPlusX 0
#define cGfxPairPlusX 128
#define cGfxPairPlusY -64
#define cGfxPlayerPlusX 24
#define cGfxMarkerPlusX 70
#define cGfxMarkerPlusY -64
#define cGfxFontSizeX 16
#define cGfxFontSizeY 32
#define cGfxFontTileX 14
#define cGfxFontTileY 10
#define cGfxInfoBar 30
#define cGfxSpraySize 5
#define cGfxSpray 300
#define cGfxScoreX 30
#define cGfxScoreY 54
#define cGfxBestX 330
#define cGfxBestY 54
#define cGfxScore1X 30
#define cGfxScore1Y 28
#define cGfxScore2X 30
#define cGfxScore2Y 68
#define cGfxMoveCX 690
#define cGfxMoveCY 185
#define cGfxLegendX 683
#define cGfxLegendY 150
#define cGfxOptionX 332
#define cGfxOptionY 240
#define cGfxOptionDY 36
#define cGfxMenuEffect 500
#define cGfxMessageX 75
#define cGfxMessageY 210
#define cGfxRunsLeftX ( cGfxScreenX >> 1 )
#define cGfxRunsLeftY 570
#define cGfxClearsAX 684
#define cGfxClearsAY 330
#define cGfxClearsTX 684
#define cGfxClearsTY 545
#define cGfxHelpX ( cGfxScreenX >> 1 )
#define cGfxHelpY 7
#define cGfxHelpDY 30
#define cGfxHelpLines (( cGfxScreenY - cGfxHelpY ) / cGfxHelpDY)
#define cGfxHelpPage (cGfxHelpLines >> 1)
#define cGfxFall 4
#define cGfxShake 3
#define cGfxCursors 2
#define cGfxBrickElement 4
#define cGfxMaxElements ( cMaxElements + 1 )
#define cGfxWinBlending 200
#define cGfxCursorSpeed 3
#define cGfxMaxTextLine 128
#define cGfxMaxPartTime 60
#define cGfxExePartTime 6
#define cGfxParticleSet 4
#define cGfxMaxParticles cGridX * cGridY
#define cGfxParticleLife 50
#define cGfxParticleSpeed 30
#define cGfxParticleMinSp 10
#define cGfxParticleFall 4
#define cGfxParticleState 3
#define cGfxMaxWave 16
#define cGfxStrLen 200
#define cGfxMaxAlpha 255
#define cGfxAlphaStep 16
#define cGfxWelcomeWait 1200
#define cGfxJTextLive 30
#define cGfxJTextSpeed -10
#define cGfxRoadmapBX 96
#define cGfxRoadmapBY 329
#define cGfxRoadmapDY -51
#define cGfxRoadmapBSize 50
#define cGfxRoadmapIter 32
#define cGfxKeyboardX 185
#define cGfxKeyboardY1 315
#define cGfxKeyboardY2 185
#define cGfxKeyGridX 10
#define cGfxKeyGridY 4
#define cGfxHofNoKeyboard 0
#define cGfxHofKeyboardUp 1
#define cGfxHofKeyboardDn 2
#define cGfxTutorialSteps 12
/* Stupid touch-screen patch */
enum {
cGfxIndField = 0,
cGfxIndEscape,
cGfxIndSpaceR,
cGfxIndSpaceT,
cGfxIndMax,
};
typedef struct BNX_BOX
{
BNX_INT16 x1;
BNX_INT16 y1;
BNX_INT16 x2;
BNX_INT16 y2;
} BNX_BOX;
static BNX_BOX _BNX_BOXES[ cGfxIndMax ] = {
{ 18, 128, 656, 588 },
{ 715, 0, 800, 40 },
{ 680, 310, 780, 380 },
{ 680, 515, 780, 580 }
};
static BNX_BOX _BNX_MENU_BOXES[ cMaxOptions ] = {
{ 183, 290, 475, 314 },
{ 210, 323, 450, 348 },
{ 209, 361, 450, 386 },
{ 241, 395, 420, 420 },
{ 232, 430, 426, 457 },
{ 296, 468, 364, 492 },
{ 295, 503, 362, 528 }
};
static char virtualKBD[ cGfxKeyGridY ][ cGfxKeyGridX ] = {
"1234567890",
"QWERTYUIOP",
"ASDFGHJKLe",
"ZXCVBNM b",
};
/******************************************************************************
LOCAL GRAPHICS DATA (VIDEO BUFFERS, IMAGES, FONTS, ETC.)
******************************************************************************/
typedef char BNX_HELPLINE[ cGfxMaxTextLine ];
typedef struct BNX_PARTICLE
{
BNX_INT16 x[ cGfxParticleSet ];
BNX_INT16 y[ cGfxParticleSet ];
BNX_INT16 dx[ cGfxParticleSet ];
BNX_INT16 dy[ cGfxParticleSet ];
BNX_INT16 status;
} BNX_PARTICLE;
typedef struct BNX_JUMPYTEXT
{
BNX_INT16 x;
BNX_INT16 y;
BNX_INT16 index;
BNX_INT16 downtime;
} BNX_JUMPYTEXT;
typedef struct BNX_GFX
{
SDL_Surface *screen;
SDL_Surface *logo;
SDL_Surface *splash;
SDL_Surface *roadmap;
SDL_Surface *help;
SDL_Surface *window;
SDL_Surface *background[ cMaxModes ];
SDL_Surface *elements[ cGfxMaxElements ];
SDL_Surface *movecount;
SDL_Surface *cursors[ cGfxCursors ];
SDL_Surface *markers[ cMaxPlayers ];
SDL_Surface *part[ cGfxParticleState ];
SDL_Surface *font;
SDL_Surface *keyboard;
BNX_HELPLINE *helptxt;
BNX_INT16 helplin;
BNX_JUMPYTEXT jtext;
BNX_PARTICLE particle[ cGfxMaxParticles ];
} BNX_GFX;
/******************************************************************************
PUBLIC FUNCTIONS
******************************************************************************/
BNX_BOOL gfxInit();
void gfxUpdate();
void gfxRenderEntry( void );
void gfxRenderMenu( const BNX_INT16 option );
void gfxRenderHelp( BNX_INT16 *line );
void gfxRenderHof( BNX_HALL *hof, BNX_INT16 hofview );
void gfxRenderGame( BNX_GAME *game );
void gfxPrintText( BNX_INT16 x, BNX_INT16 y, const char *text );
void gfxPrintTextWave( BNX_INT16 x, BNX_INT16 y, const char *text, BNX_INT16 start );
void gfxMessageBox( BNX_INT16 x, BNX_INT16 y, const char *text );
void gfxGetVirtualKey( BNX_GAME *game, BNX_INP *inp );
void gfxGetVirtualChar( BNX_GAME *game, BNX_INP *inp );
BNX_INT16 gfxGetMenuOption( BNX_INP *inp );
void gfxGetHelpPen( BNX_INP *inp );
/******************************************************************************
HELPER FUNCTIONS
******************************************************************************/
#endif

View File

@@ -0,0 +1,295 @@
/******************************************************************************
BINIAX HALL OF FAME IMPLEMENTATIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2006-2009
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
/******************************************************************************
INCLUDES
******************************************************************************/
#include <string.h>
#include "inc.h"
#define chCursor '_' /* Cursor ON */
#define chSpace ' ' /* Cursor OFF*/
#define csHOFName "hof.bnx2" /* File name */
#define cHOFFileSize 504 /* File size */
BNX_HALL Hof;
/******************************************************************************
FUNCTIONS
******************************************************************************/
void hofAddLetter( BNX_INT16 pos, char a, char *name );
void hofBlinkCursor( BNX_INT16 pos, char *name );
void hofResetCursor( BNX_INT16 pos, char *name );
void hofAddLetter( BNX_INT16 pos, char a, char *name )
{
if ( pos < cHofNameLen-1 )
{
name[ pos ] = a;
}
}
void hofBlinkCursor( BNX_INT16 pos, char *name )
{
static BNX_INT16 delayer = 0;
if ( pos < cHofNameLen-1 )
{
if ( (delayer & 1) == 0 )
{
if ( name[ pos ] == chSpace )
{
name[ pos ] = chCursor;
}
else
{
name[ pos ] = chSpace;
}
delayer = 0;
}
delayer ++;
}
}
void hofResetCursor( BNX_INT16 pos, char *name )
{
if ( pos < cHofNameLen-1 )
{
name[ pos ] = chSpace;
}
}
BNX_BOOL hofInit()
{
FILE *file;
BNX_INT16 i, j;
for ( i = 0; i < cHofEntries; ++i )
{
strcpy( Hof.arcade[ i ].name, "JORDAN " );
Hof.arcade[ i ].score = (cHofEntries - i) * cHofInitScore;
strcpy( Hof.tactic[ i ].name, "JORDAN " );
Hof.tactic[ i ].score = (cHofEntries - i) * cHofInitScore;
}
if ( sysGetFileLen( sysGetFullFileName( csHOFName ) ) != cHOFFileSize )
return BNX_FALSE;
file = fopen( sysGetFullFileName( csHOFName ), "rb" );
if ( file == (FILE *) NULL )
return BNX_FALSE;
for ( i = 0; i < cHofEntries; ++i )
{
for ( j = 0; j < cHofNameLen; ++j )
{
Hof.arcade[ i ].name[ j ] = sysFGet8( file );
}
sysFGet2byte( file );
Hof.arcade[ i ].score = sysFGet32( file );
}
for ( i = 0; i < cHofEntries; ++i )
{
for ( j = 0; j < cHofNameLen; ++j )
{
Hof.tactic[ i ].name[ j ] = sysFGet8( file );
}
sysFGet2byte( file );
Hof.tactic[ i ].score = sysFGet32( file );
}
fclose( file );
return BNX_TRUE;
}
BNX_BOOL hofSave()
{
FILE *file;
int i, j;
file = fopen( sysGetFullFileName( csHOFName ), "wb" );
if ( file == (FILE *) NULL )
return BNX_FALSE;
for ( i = 0; i < cHofEntries; ++i )
{
for ( j = 0; j < cHofNameLen; ++j )
{
sysFPut8( Hof.arcade[ i ].name[ j ], file );
}
sysFPut2byte( file );
sysFPut32( Hof.arcade[ i ].score, file );
}
for ( i = 0; i < cHofEntries; ++i )
{
for ( j = 0; j < cHofNameLen; ++j )
{
sysFPut8( Hof.tactic[ i ].name[ j ], file );
}
sysFPut2byte( file );
sysFPut32( Hof.tactic[ i ].score, file );
}
fclose( file );
return BNX_TRUE;
}
BNX_BOOL hofEnter( BNX_GAME *game )
{
BNX_INT32 startTime;
BNX_INT16 viewoption = cGfxHofNoKeyboard;
BNX_INT16 curPos = 0;
BNX_INT16 i, j;
char cChar = 0;
BNX_HALL_ENTRY *recEntry = 0;
switch ( game->mode )
{
case cModeRealtime:
for ( i = 0; i < cHofEntries; ++i )
{
if ( Hof.arcade[ i ].score < game->score[ cPlayer1 ] )
{
recEntry = &Hof.arcade[ i ];
viewoption = cGfxHofKeyboardDn;
break;
}
}
for ( j = cHofEntries-1; j > i; --j )
{
strcpy( Hof.arcade[ j ].name, Hof.arcade[ j-1 ].name );
Hof.arcade[ j ].score = Hof.arcade[ j-1 ].score;
}
break;
case cModeTurn:
for ( i = 0; i < cHofEntries; ++i )
{
if ( Hof.tactic[ i ].score < game->score[ cPlayer1 ] )
{
recEntry = &Hof.tactic[ i ];
viewoption = cGfxHofKeyboardUp;
break;
}
}
for ( j = cHofEntries-1; j > i; --j )
{
strcpy( Hof.tactic[ j ].name, Hof.tactic[ j-1 ].name );
Hof.arcade[ j ].score = Hof.tactic[ j-1 ].score;
}
break;
default:
return BNX_TRUE;
}
if ( recEntry == 0 )
{
return BNX_FALSE;
}
strcpy( recEntry->name, " " );
recEntry->score = game->score[ cPlayer1 ];
inpInit();
do
{
startTime = sysGetTime();
gfxGetVirtualChar( game, inpDirect() );
cChar = inpGetChar();
if ( cChar > 0 )
{
hofAddLetter( curPos, cChar, recEntry->name );
if ( curPos < cHofNameLen - 1 )
{
curPos++;
}
}
if ( inpKeyDel() == BNX_TRUE )
{
hofResetCursor( curPos, recEntry->name );
if ( curPos > 0 )
{
curPos--;
}
}
hofBlinkCursor( curPos, recEntry->name );
inpUpdate();
gfxRenderHof( &Hof, viewoption );
gfxUpdate();
sndUpdate();
sysUpdate();
// Synchronize with the clock
while ( sysGetTime() - startTime < cDeltaTime )
{
sysUpdate();
}
}
while ( inpKeyA() == BNX_FALSE && inpKeyB() == BNX_FALSE );
hofResetCursor( curPos, recEntry->name );
return BNX_TRUE;
}
void hofView()
{
BNX_INT32 startTime;
inpInit();
do
{
startTime = sysGetTime();
inpUpdate();
gfxGetHelpPen( inpDirect() );
gfxRenderHof( &Hof, cGfxHofNoKeyboard );
gfxUpdate();
sndUpdate();
sysUpdate();
// Synchronize with the clock
while ( sysGetTime() - startTime < cDeltaTime )
{
sysUpdate();
}
}
while ( inpKeyA() == BNX_FALSE );
}
BNX_HALL *hofGet()
{
return (BNX_HALL *) &Hof;
}

View File

@@ -0,0 +1,69 @@
/******************************************************************************
BINIAX HALL OF FAME DEFINITIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2009
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
#ifndef _BNX_HOF_H
#define _BNX_HOF_H
/******************************************************************************
INCLUDES
******************************************************************************/
#include "inc.h"
#define cHofEntries 7
#define cHofNameLen 30
#define cHofInitScore 1000
/******************************************************************************
HALL OF FAME DATATYPES
******************************************************************************/
typedef struct BNX_HALL_ENTRY
{
char name[ cHofNameLen ];
BNX_INT32 score;
} BNX_HALL_ENTRY;
typedef struct BNX_HALL
{
BNX_HALL_ENTRY arcade[ cHofEntries ];
BNX_HALL_ENTRY tactic[ cHofEntries ];
} BNX_HALL;
/******************************************************************************
FUNCTIONS
******************************************************************************/
BNX_BOOL hofInit();
BNX_BOOL hofSave();
void hofView();
BNX_BOOL hofEnter( BNX_GAME *game );
BNX_HALL *hofGet();
#endif

View File

@@ -0,0 +1,72 @@
/******************************************************************************
BINIAX ALL INCLUDES
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2007
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
#ifndef _BNX_INC_H
#define _BNX_INC_H
/******************************************************************************
INCLUDES
******************************************************************************/
#include "game.h"
#include "hof.h"
#define __WIN32
/* Desktop / SDL includes */
#ifdef __WIN32
#include "types.h"
#include "inp.h"
#include "gfx.h"
#include "snd.h"
#include "sys.h"
#include "cfg.h"
//#include "net.h"
#include <SDL.h>
#endif
/* WinCE / EasyCE includes */
#ifdef __WINCE
#include "wince/types.h"
#include "wince/inp.h"
#include "wince/gfx.h"
#include "wince/snd.h"
#include "wince/sys.h"
#endif
/* Symbain / Series60 includes */
#ifdef __SERIES60
#include "symbian/types.h"
#include "symbian/inp.h"
#include "symbian/gfx.h"
#include "symbian/snd.h"
#include "symbian/sys.h"
#endif
#endif

View File

@@ -0,0 +1,333 @@
/******************************************************************************
BINIAX INPUT-RELATED IMPLEMENTATIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2009
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
/******************************************************************************
INCLUDES
******************************************************************************/
#include <stdlib.h>
#include "inc.h"
/******************************************************************************
FUNCTIONS
******************************************************************************/
BNX_BOOL inpInit()
{
_Inp.keyUp = BNX_FALSE;
_Inp.keyDown = BNX_FALSE;
_Inp.keyLeft = BNX_FALSE;
_Inp.keyRight = BNX_FALSE;
_Inp.keyAltUp = BNX_FALSE;
_Inp.keyAltDown = BNX_FALSE;
_Inp.keyAltLeft = BNX_FALSE;
_Inp.keyAltRight= BNX_FALSE;
_Inp.keyPageUp = BNX_FALSE;
_Inp.keyPageDown= BNX_FALSE;
_Inp.keyA = BNX_FALSE;
_Inp.keyB = BNX_FALSE;
_Inp.keyQuit = BNX_FALSE;
_Inp.keyDel = BNX_FALSE;
_Inp.mousePress = BNX_FALSE;
_Inp.mouseX = 0;
_Inp.mouseY = 0;
_Inp.letter = 0;
return BNX_TRUE;
}
void inpUpdate()
{
SDL_Event event;
int x, y;
while( SDL_PollEvent( &event ) )
{
switch( event.type )
{
case SDL_KEYDOWN:
switch( event.key.keysym.sym )
{
case SDLK_SPACE :
_Inp.keyC = BNX_TRUE;
break;
case SDLK_RETURN :
_Inp.keyA = BNX_TRUE;
break;
case SDLK_ESCAPE :
_Inp.keyB = BNX_TRUE;
break;
case SDLK_KP8:
case SDLK_UP :
_Inp.keyUp = BNX_TRUE;
break;
case SDLK_KP2:
case SDLK_DOWN :
_Inp.keyDown = BNX_TRUE;
break;
case SDLK_KP4:
case SDLK_LEFT :
_Inp.keyLeft = BNX_TRUE;
break;
case SDLK_KP6:
case SDLK_RIGHT :
_Inp.keyRight = BNX_TRUE;
break;
case SDLK_w :
_Inp.keyAltUp = BNX_TRUE;
break;
case SDLK_s :
_Inp.keyAltDown = BNX_TRUE;
break;
case SDLK_a :
_Inp.keyAltLeft = BNX_TRUE;
break;
case SDLK_d :
_Inp.keyAltRight= BNX_TRUE;
break;
case SDLK_BACKSPACE :
case SDLK_DELETE :
_Inp.keyDel = BNX_TRUE;
break;
case SDLK_PAGEUP :
_Inp.keyPageUp = BNX_TRUE;
break;
case SDLK_PAGEDOWN :
_Inp.keyPageDown= BNX_TRUE;
break;
}
if ( event.key.keysym.sym >= SDLK_a && event.key.keysym.sym <= SDLK_z )
{
_Inp.letter = (event.key.keysym.sym - SDLK_a) + 'A';
}
else if ( event.key.keysym.sym >= SDLK_0 && event.key.keysym.sym <= SDLK_9 )
{
_Inp.letter = (event.key.keysym.sym - SDLK_0) + '0';
}
else if ( event.key.keysym.sym == SDLK_SPACE )
{
_Inp.letter = ' ';
}
break;
case SDL_MOUSEBUTTONDOWN :
_Inp.mousePress = BNX_TRUE;
break;
case SDL_QUIT:
SDL_Quit();
exit( 2 );
break;
}
}
SDL_GetMouseState( &x, &y );
_Inp.mouseX = x;
_Inp.mouseY = y;
}
BNX_BOOL inpKeyLeft()
{
if ( _Inp.keyLeft == BNX_TRUE )
{
_Inp.keyLeft = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyRight()
{
if ( _Inp.keyRight == BNX_TRUE )
{
_Inp.keyRight = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyUp()
{
if ( _Inp.keyUp == BNX_TRUE )
{
_Inp.keyUp = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyDown()
{
if ( _Inp.keyDown == BNX_TRUE )
{
_Inp.keyDown = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyAltLeft()
{
if ( _Inp.keyAltLeft == BNX_TRUE )
{
_Inp.keyAltLeft = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyAltRight()
{
if ( _Inp.keyAltRight == BNX_TRUE )
{
_Inp.keyAltRight = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyAltUp()
{
if ( _Inp.keyAltUp == BNX_TRUE )
{
_Inp.keyAltUp = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyAltDown()
{
if ( _Inp.keyAltDown == BNX_TRUE )
{
_Inp.keyAltDown = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyA()
{
if ( _Inp.keyA == BNX_TRUE )
{
_Inp.keyA = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyB()
{
if ( _Inp.keyB == BNX_TRUE )
{
_Inp.keyB = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyC()
{
if ( _Inp.keyC == BNX_TRUE )
{
_Inp.keyC = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyPageUp()
{
if ( _Inp.keyPageUp == BNX_TRUE )
{
_Inp.keyPageUp = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyPageDown()
{
if ( _Inp.keyPageDown == BNX_TRUE )
{
_Inp.keyPageDown = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpKeyDel()
{
if ( _Inp.keyDel == BNX_TRUE )
{
_Inp.keyDel = BNX_FALSE;
return BNX_TRUE;
}
return BNX_FALSE;
}
BNX_BOOL inpExit()
{
return _Inp.keyQuit;
}
char inpGetChar()
{
char ch = 0;
if ( _Inp.letter > 0 )
{
ch = _Inp.letter;
_Inp.letter = 0;
}
return ch;
}
BNX_INP *inpDirect()
{
return &_Inp;
}

View File

@@ -0,0 +1,103 @@
/******************************************************************************
BINIAX INPUT-RELATED DEFINITIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2007
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
#ifndef _BNX_INP_H
#define _BNX_INP_H
/******************************************************************************
INCLUDES
******************************************************************************/
#include "inc.h"
#define cInpKeyEnter SDLK_RETURN
#define cInpKeyBackspace SDLK_BACKSPACE
/******************************************************************************
LOCAL INPUT DATA (KEY FLAGS, POINTERS, ETC.)
******************************************************************************/
typedef struct BNX_INP
{
BNX_BOOL keyUp;
BNX_BOOL keyDown;
BNX_BOOL keyLeft;
BNX_BOOL keyRight;
BNX_BOOL keyAltUp;
BNX_BOOL keyAltDown;
BNX_BOOL keyAltLeft;
BNX_BOOL keyAltRight;
BNX_BOOL keyPageUp;
BNX_BOOL keyPageDown;
BNX_BOOL keyA;
BNX_BOOL keyB;
BNX_BOOL keyC;
BNX_BOOL keyQuit;
BNX_BOOL keyDel;
BNX_BOOL mousePress;
BNX_INT16 mouseX;
BNX_INT16 mouseY;
char letter;
BNX_UINT32 moment;
} BNX_INP;
BNX_INP _Inp;
/******************************************************************************
FUNCTIONS
******************************************************************************/
BNX_BOOL inpInit();
void inpUpdate();
BNX_BOOL inpKeyLeft();
BNX_BOOL inpKeyRight();
BNX_BOOL inpKeyUp();
BNX_BOOL inpKeyDown();
BNX_BOOL inpKeyAltLeft();
BNX_BOOL inpKeyAltRight();
BNX_BOOL inpKeyAltUp();
BNX_BOOL inpKeyAltDown();
BNX_BOOL inpKeyPageUp();
BNX_BOOL inpKeyPageDown();
BNX_BOOL inpKeyA();
BNX_BOOL inpKeyB();
BNX_BOOL inpKeyC();
BNX_BOOL inpKeyDel();
BNX_BOOL inpExit();
char inpGetChar();
BNX_INP *inpDirect();
#endif

View File

@@ -0,0 +1,174 @@
/******************************************************************************
BINIAX 2 LEVEL DEFINITIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2006-2007
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
#ifndef _BNX_LEV_H
#define _BNX_LEV_H
#include "types.h"
#include "game.h"
#define cLinesPart01 3
#define cLinesPart02 3
#define cLinesPart03 4
#define cLinesPart04 4
#define cLinesPart05 6
#define cLinesPart06 6
#define cLinesPart07 6
#define cLinesPart08 6
#define cLinesPart09 4
#define cLinesPart10 5
#define cLinesPart11 5
#define cLinesPart12 5
#define cLinesPart13 10
#define cLinesPart14 10
#define cLinesAll cLinesPart01+cLinesPart02+cLinesPart03+cLinesPart04+cLinesPart05+\
cLinesPart06+cLinesPart07+cLinesPart08+cLinesPart09+cLinesPart10+\
cLinesPart11+cLinesPart12+cLinesPart13+cLinesPart14
#define cMaxLevels 14 /* All possibe levels */
#define cMaxLevelsTurn 6 /* First N levels suitable for tactic mode */
#define cMaxLevelsMulti 10 /* First N levels suitable for multiplayer */
#define cStartLevelsAfter 100 /* Start the levels after 100 lines scroll */
#define cNextLevelAt 30 /* Insert level at each N lines of scroll */
#define cLevelInactive -1 /* Inacive value for all meanings */
static BNX_INT16 BNX_LEVEL_INFO[] = { cLinesPart01, cLinesPart02, cLinesPart03,
cLinesPart04, cLinesPart05, cLinesPart06,
cLinesPart07, cLinesPart08, cLinesPart09,
cLinesPart10, cLinesPart11, cLinesPart12,
cLinesPart13, cLinesPart13, cLinesPart14
};
static char BNX_LEVEL[ cLinesAll ][ cGridX ] =
{
// level 1 - 3 lines
{ 0,1,0,1,0 },
{ 0,0,0,0,0 },
{ 1,0,0,0,1 },
// level 2 - 3 lines
{ 0,1,0,0,0 },
{ 0,0,1,0,0 },
{ 0,0,0,1,0 },
// level 3 - 4 lines
{ 1,0,0,0,1 },
{ 1,0,1,0,1 },
{ 1,0,0,0,1 },
{ 1,0,0,0,1 },
// level 4 - 4 lines
{ 0,1,0,0,0 },
{ 0,0,0,1,0 },
{ 0,1,0,0,0 },
{ 0,0,0,1,0 },
// level 5 - 6 lines
{ 1,0,0,0,1 },
{ 1,0,0,0,1 },
{ 0,0,0,0,0 },
{ 0,0,0,0,0 },
{ 0,1,0,1,0 },
{ 0,1,0,1,0 },
// level 6 - 6 lines
{ 1,0,0,0,0 },
{ 0,0,0,1,1 },
{ 0,1,0,0,0 },
{ 0,0,0,1,1 },
{ 1,0,0,0,0 },
{ 0,0,0,1,1 },
// level 7 - 6 lines
{ 0,1,0,1,0 },
{ 0,1,0,1,0 },
{ 0,0,0,1,0 },
{ 0,0,0,1,0 },
{ 0,1,0,0,0 },
{ 0,1,0,0,0 },
// level 8 - 6 lines
{ 1,0,1,0,1 },
{ 1,0,0,0,1 },
{ 0,0,0,0,0 },
{ 0,1,0,1,0 },
{ 0,0,0,0,0 },
{ 1,0,1,0,1 },
// level 9 - 4 lines
{ 0,0,1,0,0 },
{ 0,1,0,1,0 },
{ 0,1,0,1,0 },
{ 0,0,1,0,0 },
// level 10 - 5 lines
{ 0,0,0,0,0 },
{ 0,0,1,0,0 },
{ 0,1,1,1,0 },
{ 0,0,1,0,0 },
{ 0,0,0,0,0 },
// level 11 - 5 lines
{ 0,1,0,1,0 },
{ 0,0,1,0,0 },
{ 0,0,0,1,0 },
{ 0,0,1,0,0 },
{ 0,1,0,0,0 },
// level 12 - 5 lines
{ 0,1,0,1,0 },
{ 0,0,0,0,0 },
{ 1,1,0,1,1 },
{ 0,0,0,0,0 },
{ 0,0,1,0,0 },
// level 13 - 10 lines
{ 1,0,0,0,1 },
{ 0,1,0,1,0 },
{ 0,1,0,1,0 },
{ 0,0,0,0,0 },
{ 0,0,1,0,0 },
{ 0,0,1,0,0 },
{ 0,0,0,0,0 },
{ 0,1,0,1,0 },
{ 0,1,0,1,0 },
{ 1,0,0,0,1 },
// level 14 - 10 lines
{ 0,0,1,0,0 },
{ 1,1,1,0,0 },
{ 0,0,0,0,0 },
{ 0,0,1,1,0 },
{ 0,0,1,0,0 },
{ 0,0,1,0,0 },
{ 1,0,1,0,0 },
{ 1,0,0,0,0 },
{ 1,1,0,1,1 },
{ 1,1,0,1,1 },
};
#endif

View File

@@ -0,0 +1,151 @@
/******************************************************************************
BINIAX SOUND-RELATED IMPLEMENTATIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2009
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
/******************************************************************************
INCLUDES
******************************************************************************/
#include <stdlib.h>
#include <SDL_mixer.h>
#include "inc.h"
/******************************************************************************
LOCALS
******************************************************************************/
BNX_SND _Snd;
/******************************************************************************
FUNCTIONS
******************************************************************************/
BNX_BOOL sndInit()
{
BNX_INT32 audio_rate = 44000;
BNX_UINT16 audio_format = AUDIO_S16;
BNX_INT32 audio_channels = 2;
BNX_BOOL loaded = BNX_TRUE;
if ( Mix_OpenAudio( audio_rate, audio_format, audio_channels, 1024 ) < 0 )
{
cfgSetMusic( BNX_FALSE );
cfgSetSound( BNX_FALSE );
return BNX_TRUE;
}
else
{
Mix_QuerySpec( &audio_rate, &audio_format, &audio_channels );
}
Mix_VolumeMusic( MIX_MAX_VOLUME >> 1 );
_Snd.sounds[ 1 ] = Mix_LoadWAV( "data/sound/sfx1.wav" );
_Snd.sounds[ 2 ] = Mix_LoadWAV( "data/sound/sfx2.wav" );
_Snd.sounds[ 3 ] = Mix_LoadWAV( "data/sound/sfx3.wav" );
_Snd.sounds[ 4 ] = Mix_LoadWAV( "data/sound/sfx4.wav" );
_Snd.sounds[ 5 ] = Mix_LoadWAV( "data/sound/sfx5.wav" );
_Snd.music[ 0 ] = Mix_LoadMUS( "data/music/biniax_common00.it" );
_Snd.music[ 1 ] = Mix_LoadMUS( "data/music/biniax_common01.it" );
_Snd.music[ 2 ] = Mix_LoadMUS( "data/music/biniax_common02.it" );
_Snd.music[ 3 ] = Mix_LoadMUS( "data/music/biniax_common03.it" );
_Snd.music[ 4 ] = Mix_LoadMUS( "data/music/biniax_common04.it" );
_Snd.music[ 5 ] = Mix_LoadMUS( "data/music/biniax_common05.it" );
_Snd.music[ 6 ] = Mix_LoadMUS( "data/music/biniax_common06.it" );
_Snd.music[ 7 ] = Mix_LoadMUS( "data/music/biniax_common07.it" );
return loaded;
}
void sndUpdate()
{
return;
}
void sndPlay( BNX_GAME *game )
{
BNX_UINT32 snd = 0;
BNX_UINT32 sndmask = 1;
if ( cfgGetSound() == BNX_FALSE )
{
return;
}
while ( game->sounds != cSndNone && snd <= cSndLast )
{
sndmask = 1 << snd;
if ( (game->sounds & sndmask) != cSndNone )
{
if ( _Snd.sounds[ snd ] != NULL )
{
Mix_PlayChannel( snd % cSndChannels, _Snd.sounds[ snd ], 0 );
}
}
game->sounds &= ~sndmask;
snd ++;
}
}
void sndPlayMusic( BNX_INT16 index )
{
if ( cfgGetMusic() == BNX_FALSE )
{
return;
}
if ( index >= 0 && index < cSndMaxMusic )
{
_Snd.curMusic = index;
Mix_PlayMusic( _Snd.music[ index ], 1 );
}
}
void sndUpdateMusic( BNX_GAME *game, BNX_BOOL change )
{
BNX_INT32 newMusic;
if ( cfgGetMusic() == BNX_FALSE )
{
return;
}
if ( Mix_PlayingMusic() == 0 )
{
if ( change == BNX_TRUE )
{
do
{
newMusic = sysRand( cSndMaxMusic-1 );
} while( _Snd.curMusic == newMusic );
_Snd.curMusic = newMusic;
}
sndPlayMusic( _Snd.curMusic );
}
}

View File

@@ -0,0 +1,84 @@
/******************************************************************************
BINIAX SOUND-RELATED DEFINITIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2007
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
#ifndef _BNX_SND_H
#define _BNX_SND_H
/******************************************************************************
INCLUDES
******************************************************************************/
#include <SDL_mixer.h>
#include "inc.h"
/******************************************************************************
CONSTANTS
******************************************************************************/
#define cSndChannels 8
#define cSndMaxMusic 8
#define cSndMenu 7
enum _BNX_Sounds {
cSndNone = 0,
cSndTake,
cSndFail,
cSndScroll,
cSndShake,
cSndSweep,
cSndLast,
};
/******************************************************************************
LOCAL SOUND DATA (WAV SAMPLES, ETC.)
******************************************************************************/
typedef struct BNX_SND {
BNX_INT32 curMusic;
Mix_Chunk *sounds[ cSndLast ];
Mix_Music *music[ cSndMaxMusic ];
} BNX_SND;
/******************************************************************************
FUNCTIONS
******************************************************************************/
BNX_BOOL sndInit();
void sndUpdate();
void sndPlay( BNX_GAME *game );
void sndPlayMusic( BNX_INT16 index );
void sndUpdateMusic( BNX_GAME *game, BNX_BOOL change );
//void sndPlay( BNX_INT16 index );
#endif

View File

@@ -0,0 +1,135 @@
/******************************************************************************
BINIAX SYSTEM-RELATED IMPLEMENTATIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2009
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
/******************************************************************************
INCLUDES
******************************************************************************/
#include <stdlib.h>
#include "inc.h"
/******************************************************************************
FUNCTIONS
******************************************************************************/
BNX_BOOL sysInit()
{
atexit( SDL_Quit );
sysRandInit( sysGetTime() );
return BNX_TRUE;
}
BNX_INT32 sysRand( BNX_INT32 max )
{
return ( BNX_INT32 ) rand() % max;
}
void sysRandInit( BNX_UINT32 init )
{
srand( init );
}
BNX_UINT32 sysGetTime()
{
return ( BNX_UINT32 ) SDL_GetTicks();
}
char* sysGetFullFileName( char *file )
{
return (char *) file;
}
void sysUpdate()
{
SDL_Delay( 1 );
}
/******************************************************************************
FILE FUNCTIONS
******************************************************************************/
BNX_UINT32 sysGetFileLen( char *file )
{
BNX_UINT32 len = 0;
FILE *f;
f = fopen( file, "rb" );
if ( f == (FILE *) NULL )
return 0;
while( !feof( f ) )
{
fgetc( f );
++len;
}
fclose( f );
return len-1;
}
void sysFPut8( BNX_UINT8 n, FILE *f )
{
fputc( n, f );
}
void sysFPut16( BNX_UINT16 n, FILE *f )
{
fputc( (char) (n & 0xff), f );
fputc( (char) (n >> 8), f );
}
void sysFPut32( BNX_UINT32 n, FILE *f )
{
fputc( (char) (n & 0xff), f );
fputc( (char) ((n >> 8) & 0xff), f );
fputc( (char) ((n >> 16) & 0xff), f );
fputc( (char) ((n >> 24) & 0xff), f );
}
BNX_UINT8 sysFGet8( FILE *f )
{
BNX_INT8 n = 0;
n = fgetc( f );
return n;
}
BNX_UINT16 sysFGet16( FILE *f )
{
BNX_UINT16 n = 0;
n = (BNX_UINT16) fgetc( f );
n |= (BNX_UINT16) fgetc( f ) << 8;
return n;
}
BNX_UINT32 sysFGet32( FILE *f )
{
BNX_UINT32 n = 0;
n = (BNX_UINT32) fgetc( f );
n |= (BNX_UINT32) fgetc( f ) << 8;
n |= (BNX_UINT32) fgetc( f ) << 16;
n |= (BNX_UINT32) fgetc( f ) << 24;
return n;
}

View File

@@ -0,0 +1,87 @@
/******************************************************************************
BINIAX SYSTEM-RELATED DEFINITIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2009
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
#ifndef _BNX_SYS_H
#define _BNX_SYS_H
/******************************************************************************
INCLUDES
******************************************************************************/
#include "inc.h"
/******************************************************************************
MACRO
******************************************************************************/
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define NORM16(X) (X)
#define NORM32(X) (X)
#else
#define NORM16(X) SDL_Swap16(X)
#define NORM32(X) SDL_Swap32(X)
#endif
/******************************************************************************
FUNCTIONS
******************************************************************************/
BNX_BOOL sysInit();
BNX_INT32 sysRand( BNX_INT32 max );
void sysRandInit( BNX_UINT32 init );
BNX_UINT32 sysGetTime();
char* sysGetFullFileName( char *file );
void sysUpdate();
/******************************************************************************
FILE FUNCIONS
******************************************************************************/
BNX_UINT32 sysGetFileLen( char *file );
void sysFPut8( BNX_UINT8 n, FILE *f );
void sysFPut16( BNX_UINT16 n, FILE *f );
void sysFPut32( BNX_UINT32 n, FILE *f );
BNX_UINT8 sysFGet8( FILE *f );
BNX_UINT16 sysFGet16( FILE *f );
BNX_UINT32 sysFGet32( FILE *f );
/* File allignemt macro */
#define sysFPut1byte(F) {sysFPut8(0,(F));}
#define sysFPut2byte(F) {sysFPut8(0,(F));sysFPut8(0,(F));}
#define sysFPut3byte(F) {sysFPut8(0,(F));sysFPut8(0,(F));sysFPut8(0,(F));}
#define sysFGet1byte(F) {sysFGet8(F);}
#define sysFGet2byte(F) {sysFGet8(F);sysFGet8(F);}
#define sysFGet3byte(F) {sysFGet8(F);sysFGet8(F);sysFGet8(F);}
#endif

View File

@@ -0,0 +1,63 @@
/******************************************************************************
BINIAX 2 TEXT MESSAGES
COPYRIGHT JORDAN TUZSUZOV, (C) 2006-2007
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
#ifndef _BNX_TXT_H
#define _BNX_TXT_H
#include "game.h"
char *TXT_HofCase[] = {
"BEST ARCADE SCORES",
"BEST TACTIC SCORES"
};
char *TXT_MenuMain[ cMaxOptions ] = {
"CONTINUE LAST GAME",
"NEW ARCADE GAME",
"NEW TACTIC GAME",
"MULTIPLAYER",
"HALL OF FAME",
"HELP",
"EXIT"
};
char *TXT_MenuMulti[ cMaxOptions ] = {
"SAME MACHINE MULTIPLAYER",
"START NETWORK GAME",
"JOIN NETWORK GAME",
"BACK"
};
char *TXT_Extras[ cMaxExtras ] = {
"MINOR COMBO +5",
"COMBO +10",
"BIG COMBO +20",
"MEGA COMBO +40",
"FIELD MASTERED +100",
"NEW BROOM",
};
#endif

View File

@@ -0,0 +1,54 @@
/******************************************************************************
BINIAX TYPE DEFINITIONS
COPYRIGHT JORDAN TUZSUZOV, (C) 2005-2007
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
LICENSE ORIGIN : http://www.gzip.org/zlib/zlib_license.html
For complete product license refer to LICENSE.TXT file
******************************************************************************/
#ifndef _BNX_TYPES_H
#define _BNX_TYPES_H
/******************************************************************************
UNSIGNED TYPES
******************************************************************************/
typedef unsigned char BNX_UINT8;
typedef unsigned short int BNX_UINT16;
typedef unsigned int BNX_UINT32;
/******************************************************************************
SIGNED TYPES
******************************************************************************/
typedef char BNX_INT8;
typedef short int BNX_INT16;
typedef int BNX_INT32;
/******************************************************************************
LOGICAL TYPES
******************************************************************************/
typedef char BNX_BOOL;
#define BNX_TRUE 1
#define BNX_FALSE 0
#endif

View File

@@ -134,10 +134,10 @@ extern int SDL_ANDROID_isTouchscreenKeyboardUsed;
#define SDL_ANDROID_KEYCODE_1 END
#endif
#ifndef SDL_ANDROID_KEYCODE_2
#define SDL_ANDROID_KEYCODE_2 PAGEUP
#define SDL_ANDROID_KEYCODE_2 NO_REMAP
#endif
#ifndef SDL_ANDROID_KEYCODE_3
#define SDL_ANDROID_KEYCODE_3 PAGEDOWN
#define SDL_ANDROID_KEYCODE_3 NO_REMAP
#endif
#ifndef SDL_ANDROID_KEYCODE_4
#define SDL_ANDROID_KEYCODE_4 LCTRL
@@ -166,10 +166,10 @@ extern int SDL_ANDROID_isTouchscreenKeyboardUsed;
#define SDL_ANDROID_SCREENKB_KEYCODE_1 SDL_ANDROID_KEYCODE_1
#endif
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_2
#define SDL_ANDROID_SCREENKB_KEYCODE_2 SDL_ANDROID_KEYCODE_2
#define SDL_ANDROID_SCREENKB_KEYCODE_2 PAGEUP
#endif
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_3
#define SDL_ANDROID_SCREENKB_KEYCODE_3 SDL_ANDROID_KEYCODE_3
#define SDL_ANDROID_SCREENKB_KEYCODE_3 PAGEDOWN
#endif
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_4
#define SDL_ANDROID_SCREENKB_KEYCODE_4 SDL_ANDROID_KEYCODE_6