//arena.cpp implementation #include #include #include #include "comconst.h" #include "arena.h" #include "worm.h" #include "sound.h" #define SPEEDINGUP 1000 BOOL CArena::mWormIn[MAXWORMS]; CWorm* CArena::mWorms[MAXWORMS]; BOOL CArena::mWormLeft[MAXWORMS]; #define MAXSOUND 2000 #define MINSOUND 400 CArena::CArena() { for (int g=0; gRespond(); running=mWorms[g]->Move(orderingTable); //mJumpCount++; /*if (running && (mJumpCount>10-(mSpeed*2))) { mWorms[g]->Respond(); running=mWorms[g]->Move(orderingTable); mJumpCount=0; }*/ if (!running) { mWormLeft[g]=FALSE; mWormsLeft--; for (int h=0; hIncScore(); if (mWorms[h]->GetScore()>=(mWormsIn-1)*10) { CSound::WinnerSound(); return 2; } } } CSound::DieSound(); if (mWormsLeft<2) { CSound::ResetSpeed(); return 0; } } } } mTimeCount++; if (mTimeCount>SPEEDINGUP) { /*if (mSpeed=mNextSound) { mNextSound=((rand()*(MAXSOUND-MINSOUND)/RAND_MAX)+MINSOUND); mSoundCount=0; int wormwithbiggestscore=999; int biggestscore=0; for (int g=0; gGetScore()>biggestscore) { wormwithbiggestscore=mWorms[g]->GetColour(); biggestscore=mWorms[g]->GetScore(); } else { if (mWorms[g]->GetScore()==biggestscore) { wormwithbiggestscore=999; } } } } if (wormwithbiggestscore<999) { CSound::AheadSound(wormwithbiggestscore); } } return 1; } int CArena::GetWinner() { for (int g=0; g