dungeon_crawler

diff prototype/src/main.cc @ 49:303743485aba

pretty much implemented the positional torch sound sources
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 18 Sep 2012 00:34:29 +0300
parents aa9e28670ae2
children c40efa9cf844
line diff
     1.1 --- a/prototype/src/main.cc	Mon Sep 17 08:40:59 2012 +0300
     1.2 +++ b/prototype/src/main.cc	Tue Sep 18 00:34:29 2012 +0300
     1.3 @@ -267,23 +267,27 @@
     1.4  	cam.input_move(dx, 0, dy);
     1.5  
     1.6  	tileset->update_tiles(msec);
     1.7 +
     1.8 +	level->set_player_position(cam.get_position());
     1.9  	level->update(msec, dt);
    1.10  
    1.11  	// play the walking sound if we're walking
    1.12 -	int cellx, celly;
    1.13 -	level->get_cell_coords_at(cam.get_position(), &cellx, &celly);
    1.14 +	if(cfg.sound) {
    1.15 +		int cellx, celly;
    1.16 +		level->get_cell_coords_at(cam.get_position(), &cellx, &celly);
    1.17  
    1.18 -	const AudioSample *move_sample;
    1.19 -	if(did_move && (move_sample = level->get_sample(cellx, celly, TILE_SAMPLE_WALK))) {
    1.20 -		if(move_sample != move_sound->get_sample()) {
    1.21 -			move_sound->stop();
    1.22 -			move_sound->set_sample(move_sample);
    1.23 -			move_sound->play();
    1.24 -		}
    1.25 -	} else {
    1.26 -		if(move_sound->get_sample()) {
    1.27 -			move_sound->stop();
    1.28 -			move_sound->set_sample(0);
    1.29 +		const AudioSample *move_sample;
    1.30 +		if(did_move && (move_sample = level->get_sample(cellx, celly, TILE_SAMPLE_WALK))) {
    1.31 +			if(move_sample != move_sound->get_sample()) {
    1.32 +				move_sound->stop();
    1.33 +				move_sound->set_sample(move_sample);
    1.34 +				move_sound->play();
    1.35 +			}
    1.36 +		} else {
    1.37 +			if(move_sound->get_sample()) {
    1.38 +				move_sound->stop();
    1.39 +				move_sound->set_sample(0);
    1.40 +			}
    1.41  		}
    1.42  	}
    1.43