Changeset 279
- Timestamp:
- Jan 24, 2011, 1:52:54 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/monsterz/board.cpp
r277 r279 35 35 Game *game; 36 36 int screen, board, tiles; 37 int click ;37 int click, whip; 38 38 Piece *pieces[8][8]; 39 39 Piece *grabbed; … … 43 43 Int2 mouse; 44 44 Int3 buttons; 45 float nextblink ;45 float nextblink, whipdelay; 46 46 47 47 enum … … 67 67 data->tiles = Tiler::Register(PNG_TILES, 48, 48, 1.0f); 68 68 data->click = Sampler::Register(WAV_CLICK); 69 data->whip = Sampler::Register(WAV_WHIP); 69 70 70 71 srand(rand() ^ time(NULL)); … … 74 75 for (int i = 0; i < 8; i++) 75 76 { 76 int id = 25 + 5 * (rand() % 8);77 int id = 25 + 5 * (rand() % 7); 77 78 data->pieces[i][j] = new Piece(game, Int2(i, j), id); 78 79 if (j) … … 95 96 data->mashes = NULL; 96 97 data->nextblink = 0.0f; 98 data->whipdelay = 0.0f; 97 99 data->state = BoardData::IDLE; 98 100 } … … 111 113 data->nextblink = (float)(200 + rand() % 500); 112 114 } 115 116 /* Do not whip too often, the sound may become annoying */ 117 data->whipdelay -= deltams; 113 118 114 119 /* Get rid of finished mashes */ … … 164 169 if (cur_cell != data->dst_cell) 165 170 { 171 if (data->whipdelay < 0.0f) 172 { 173 Sampler::PlaySample(data->whip); 174 data->whipdelay = 300.0f; 175 } 166 176 if (data->dst_cell != Int2(-1)) 167 177 data->pieces[data->dst_cell.i] … … 295 305 * the board. */ 296 306 Int2 newpos = Int2(i * 48, below->GetPos().y + 48); 297 int id = 25 + 5 * (rand() % 8);307 int id = 25 + 5 * (rand() % 7); 298 308 data->pieces[i][7] = new Piece(data->game, Int2(i, 7), id); 299 309 data->pieces[i][7]->SetBelow(below); … … 359 369 Tiler::Deregister(data->tiles); 360 370 Sampler::Deregister(data->click); 371 Sampler::Deregister(data->whip); 361 372 delete data; 362 373 } -
trunk/monsterz/mash.cpp
r278 r279 31 31 private: 32 32 Game *game; 33 int duh, pop; 33 34 Piece *pieces[8 * 8]; 34 35 Int2 cells[8 * 8]; … … 54 55 data->game = game; 55 56 Ticker::Ref(game); 57 data->duh = Sampler::Register(WAV_DUH); 58 data->pop = Sampler::Register(WAV_POP); 56 59 data->npieces = 0; 57 60 data->state = MashData::WAIT; … … 91 94 if (allready) 92 95 { 96 Sampler::PlaySample(data->pop); 93 97 for (int n = 0; n < data->npieces; n++) 94 98 data->pieces[n]->Pop(); … … 137 141 for (int n = 0; n < data->npieces; n++) 138 142 Ticker::Unref(data->pieces[n]); 143 Sampler::Deregister(data->duh); 144 Sampler::Deregister(data->pop); 139 145 Ticker::Unref(data->game); 140 146 delete data; -
trunk/monsterz/monsterz.h
r253 r279 14 14 15 15 static char const * const WAV_CLICK = "monsterz/click.wav"; 16 16 static char const * const WAV_DUH = "monsterz/duh.wav"; 17 static char const * const WAV_POP = "monsterz/pop.wav"; 18 static char const * const WAV_WHIP = "monsterz/whip.wav"; -
trunk/win32/monsterz.vcxproj
r257 r279 15 15 <ClInclude Include="..\monsterz\game.h" /> 16 16 <ClInclude Include="..\monsterz\mash.h" /> 17 <ClInclude Include="..\monsterz\monsterz.h" /> 17 18 <ClInclude Include="..\monsterz\piece.h" /> 18 19 <ClInclude Include="..\src\audio.h" />
Note: See TracChangeset
for help on using the changeset viewer.