dungeon_crawler
diff prototype/src/tile.cc @ 48:aa9e28670ae2
added sound playback, more to do
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 17 Sep 2012 08:40:59 +0300 |
parents | f3030df27110 |
children | 303743485aba |
line diff
1.1 --- a/prototype/src/tile.cc Sun Sep 16 08:16:50 2012 +0300 1.2 +++ b/prototype/src/tile.cc Mon Sep 17 08:40:59 2012 +0300 1.3 @@ -21,6 +21,8 @@ 1.4 { 1.5 tset = tileset; 1.6 last_upd = LONG_MIN; 1.7 + 1.8 + memset(samples, 0, sizeof samples); 1.9 } 1.10 1.11 Tile::~Tile() 1.12 @@ -39,6 +41,14 @@ 1.13 } 1.14 } 1.15 1.16 +AudioSample *Tile::get_sample(int sidx) const 1.17 +{ 1.18 + if(sidx >= 0 && sidx < MAX_TILE_SAMPLES) { 1.19 + return samples[sidx]; 1.20 + } 1.21 + return 0; 1.22 +} 1.23 + 1.24 const struct psys_attributes * const *Tile::get_unique_psys() const 1.25 { 1.26 return &psattr[0]; 1.27 @@ -85,6 +95,11 @@ 1.28 printf("loaded tile %s: %d meshes, %d lights\n", saved_fname, (int)meshes.size(), (int)lights.size()); 1.29 1.30 aiReleaseImport(scn); 1.31 + 1.32 + // XXX get the default audio samples for now 1.33 + SampleSet *sampleset = tset->get_samples(); 1.34 + samples[TILE_SAMPLE_WALK] = sampleset->get("walk_stone.ogg"); 1.35 + samples[TILE_SAMPLE_RUN] = sampleset->get("run_stone.ogg"); 1.36 return true; 1.37 } 1.38