Commit af1ec3bb authored by Gerstrong's avatar Gerstrong

Better Stereo Sound integration in Galaxy

parent 10e407f0
......@@ -32,6 +32,8 @@ typedef struct
// Game Sounds
enum GameSound{
// Common Blocks
SOUND_KEEN_WALK, SOUND_KEEN_WALK2,
SOUND_KEEN_JUMP, SOUND_KEEN_POGO,
SOUND_KEEN_DIE, SOUND_KEEN_FALL,
......@@ -66,11 +68,13 @@ SOUND_EARTHPOW,
SOUND_TANK_FIRE,
SOUND_KEEN_BLOK,
// Ep3 Specific
SOUND_MEEP,
SOUND_ANKH,
SOUND_MORTIMER,
SOUND_FOOTSLAM,
// Galaxy Specific
SOUND_CANT_SWIM,
SOUND_GET_WETSUIT,
SOUND_KEEN_SWIM,
......@@ -83,7 +87,6 @@ SOUND_STATUS_SLIDE_OUT,
SOUND_BUBBLE,
SOUND_FLAG_APPEAR,
SOUND_FLAG_LAND,
SOUND_SQUISH_SKYPEST,
SOUND_MINE_EXPLOSION,
SOUND_TRESURE_STEALER_TELEPORT,
......@@ -95,7 +98,6 @@ SOUND_BERKELOID_FIREBALL_LANDING,
SOUND_DARTGUN_SHOOT,
SOUND_DOPEFISH_BURP,
SOUND_SLUG_DEFECATE,
SOUND_PLAYER_PADDLE,
SOUND_COMPUTER_PADDLE,
SOUND_HIT_SIDEWALL,
......
......@@ -503,6 +503,12 @@ void CObject::kill()
void CObject::blink(Uint16 frametime)
{ m_blinktime = frametime; }
void CObject::playSound( const GameSound snd,
const SoundPlayMode mode )
{
g_pSound->playStereofromCoord(snd, mode, scrx);
}
////
// Action format (Galaxy only now...)
////
......
......@@ -22,6 +22,7 @@
#include "graphics/CGfxEngine.h"
#include "options.h"
#include "engine/CEventContainer.h"
#include "sdl/sound/CSound.h"
// Enumerations are here
#include "objenums.h"
......@@ -226,6 +227,12 @@ public:
void kill_intersecting_tile(int mpx, int mpy, CObject &theObject);
CMap *getMapPtr() { return mp_Map; }
/**
* \description plays certain sound of an object. Stereo will automatically applied when used
*/
void playSound( const GameSound snd,
const SoundPlayMode mode=PLAY_NOW );
bool getActionNumber(int16_t ActionNumber);
bool getActionStatus(int16_t ActionNumber);
int16_t getActionNumber();
......
......@@ -135,7 +135,7 @@ bool CObject::moveSlopedTileDown( int x, int y, const int xspeed )
const char slope = TileProperty[mp_Map->at(x>>CSF, y>>CSF)].bup;
// Check first, if there is a tile on players level
// Check first, if there is a tile on objects level
if( slope >=2 && slope<=7 )
{
int yb1, yb2;
......@@ -159,10 +159,12 @@ bool CObject::moveSlopedTileDown( int x, int y, const int xspeed )
if( m_Pos.y > newpos_y )
m_Pos.y = newpos_y;
return true;
onslope = true;
}
else
return false;
onslope = false;
return onslope;
}
void CObject::moveSlopedTileUp( int x, int y, const int xspeed )
......@@ -196,7 +198,11 @@ void CObject::moveSlopedTileUp( int x, int y, const int xspeed )
Uint32 newpos_y = y_csf - m_BBox.y1 + y_rel + (1<<STC);
if( m_Pos.y < newpos_y )
m_Pos.y = newpos_y;
onslope = true;
}
else
onslope = false;
}
// returns nonzero if object1 overlaps object2
......
......@@ -6,6 +6,7 @@
*/
#include "CBullets.h"
#include "sdl/sound/CSound.h"
namespace galaxy
{
......@@ -26,13 +27,17 @@ CObject(pmap, x, y, OBJ_RAY)
m_ActionBaseOffset = 0x1738;
setActionForce(A_KEENSHOT_MOVING);
setActionSprite();
calcBouncingBoxes();
playSound( SOUND_KEEN_FIRE );
}
void CBullets::process()
{
if( blockedd || blockedu || blockedl || blockedr )
if( !getActionNumber(A_KEENSHOT_IMPACT) && (blockedd || blockedu || blockedl || blockedr || onslope) )
{
setAction(A_KEENSHOT_IMPACT);
playSound( SOUND_SHOT_HIT );
}
processActionRoutine();
......
......@@ -95,12 +95,11 @@ void CPlayerLevel::tryToShoot( const VectorD2<int> &pos, const direction_t &dir
{
if(m_Inventory.Item.m_bullets > 0)
{
g_pSound->playStereofromCoord( SOUND_KEEN_FIRE , PLAY_NOW, pos.x );
m_ObjectPtrs.push_back(new CBullets(mp_Map, pos.x, pos.y, dir));
}
else
{
g_pSound->playStereofromCoord( SOUND_GUN_CLICK , PLAY_NOW, pos.x );
playSound( SOUND_GUN_CLICK );
}
}
......@@ -276,7 +275,7 @@ void CPlayerLevel::processPogo()
else
{
if(blockedu)
g_pSound->playSound( SOUND_KEEN_BUMPHEAD );
playSound( SOUND_KEEN_BUMPHEAD );
CObject::processFalling();
setAction(A_KEEN_POGO_UP);
......@@ -309,7 +308,7 @@ void CPlayerLevel::processPogo()
}
m_jumpheight = 0;
g_pSound->playSound( SOUND_KEEN_POGO );
playSound( SOUND_KEEN_POGO );
}
moveYDir(yinertia);
......@@ -390,7 +389,7 @@ void CPlayerLevel::processJumping()
{
// Check whether we should bump the head
if( blockedu )
g_pSound->playSound( SOUND_KEEN_BUMPHEAD );
playSound( SOUND_KEEN_BUMPHEAD );
yinertia -= 20;
if( getActionNumber(A_KEEN_JUMP) )
......@@ -446,7 +445,6 @@ void CPlayerLevel::processLookingUp()
if( m_playcontrol[PA_FIRE] && !m_fired )
{
setActionForce(A_KEEN_SHOOT+2);
g_pSound->playStereofromCoord(SOUND_KEEN_FIRE , PLAY_NOW, getXPosition());
const VectorD2<int> newVec(getXMidPos()-(3<<STC), getYUpPos()-(16<<STC));
tryToShoot(newVec, UP);
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processShootWhileStanding;
......@@ -509,7 +507,7 @@ void CPlayerLevel::processPressUp() {
if (flag==MISCFLAG_SWITCHPLATON || flag == MISCFLAG_SWITCHPLATOFF ||
flag == MISCFLAG_SWITCHBRIDGE)
{
g_pSound->playSound( SOUND_GUN_CLICK );
playSound( SOUND_GUN_CLICK );
setAction(A_KEEN_SLIDE);
if(flag == MISCFLAG_SWITCHBRIDGE)
{
......@@ -617,7 +615,7 @@ void CPlayerLevel::processPressDucking()
supportedbyobject = false;
blockedd = false;
setAction(A_KEEN_FALL);
g_pSound->playSound( SOUND_KEEN_FALL );
playSound( SOUND_KEEN_FALL );
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processFalling;
}
......@@ -1057,7 +1055,7 @@ void CPlayerLevel::processStanding()
m_jumped = true;
m_climbing = false;
m_vDir = NONE;
g_pSound->playSound( SOUND_KEEN_JUMP );
playSound( SOUND_KEEN_JUMP );
}
......@@ -1103,7 +1101,7 @@ void CPlayerLevel::processStanding()
m_jumpheight = 0;
setAction(A_KEEN_POGO_START);
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processPogo;
g_pSound->playSound( SOUND_KEEN_POGO );
playSound( SOUND_KEEN_POGO );
m_pogotoggle = true;
}
}
......@@ -1180,6 +1178,7 @@ void CPlayerLevel::processRunning()
{
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processFalling;
setAction(A_KEEN_FALL);
playSound( SOUND_KEEN_FALL );
}
......@@ -1194,7 +1193,7 @@ void CPlayerLevel::processRunning()
m_jumped = true;
m_climbing = false;
m_vDir = NONE;
g_pSound->playSound( SOUND_KEEN_JUMP );
playSound( SOUND_KEEN_JUMP );
}
// He could shoot
......@@ -1204,7 +1203,6 @@ void CPlayerLevel::processRunning()
const int newy = getYPosition()+(4<<STC);
if(m_Inventory.Item.m_bullets > 0)
{
g_pSound->playStereofromCoord(SOUND_KEEN_FIRE, PLAY_NOW, newx);
m_ObjectPtrs.push_back(new CBullets(mp_Map, newx, newy, m_hDir));
}
......@@ -1225,7 +1223,7 @@ void CPlayerLevel::processRunning()
m_jumpheight = 0;
setAction(A_KEEN_POGO_START);
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processPogo;
g_pSound->playSound( SOUND_KEEN_POGO );
playSound( SOUND_KEEN_POGO );
m_pogotoggle = true;
}
......@@ -1254,7 +1252,7 @@ void CPlayerLevel::processRunning()
moveToHorizontal((l_x>>CSF)<<CSF);
setAction(A_KEEN_SLIDE);
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processPlaceGem;
g_pSound->playSound( SOUND_DOOR_OPEN );
playSound( SOUND_DOOR_OPEN );
}
}
......@@ -1280,10 +1278,6 @@ void CPlayerLevel::processFalling()
m_jumpdown = false;
}
// While falling keen can of course move into both x-directions
//if(getActionNumber(A_KEEN_FALL))
//xinertia += (m_playcontrol[PA_X]>>1);
if(blockedd)
{
setAction(A_KEEN_STAND);
......
......@@ -58,7 +58,8 @@ void CPoisonSlug::processCrawling()
{
m_timer = 0;
mp_processState = &CPoisonSlug::processPooing;
setAction(A_SLUG_POOING);
setAction( A_SLUG_POOING );
playSound( SOUND_SLUG_DEFECATE );
m_ObjectPtrs.push_back(new CSlugSlime(mp_Map, getXLeftPos(), getYDownPos()-(8<<STC)));
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment