MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / Sound_Play

Method Sound_Play

Source/Fodder.cpp:3874–3925  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3872
3873}
3874void cFodder::Sound_Play(sSprite* pSprite, int16 pSoundEffect, int16 pPriority) {
3875
3876 if (mSoundDisabled)
3877 return;
3878
3879 static uint16 word_81DF6 = 0;
3880
3881 uint16_t d0 = word_81DF6 + 1;
3882 d0 = (d0 & 3) | 2;
3883 word_81DF6 = d0;
3884
3885 int16* a4 = mSound_Timer;
3886 int16* a6 = mSound_Priority;
3887
3888 if (a6[d0] <= pPriority) {
3889 a6[d0] = pPriority;
3890 }
3891 else {
3892 if (a4[d0] != 0) {
3893 return;
3894 }
3895 a6[d0] = pPriority;
3896 }
3897 a4[d0] = 0x0C;
3898
3899 //loc_14BD4
3900 int16 Data8 = mCameraX >> 16;
3901 Data8 += getCameraWidth() / 2;
3902
3903 if (pSprite != INVALID_SPRITE_PTR)
3904 Data8 -= pSprite->field_0;
3905
3906 int16 DataC = mCameraY >> 16;
3907 DataC += getCameraHeight() / 2;
3908
3909 if (pSprite != INVALID_SPRITE_PTR)
3910 DataC -= pSprite->field_4;
3911
3912 int16 X = 0;
3913 int16 Y = 0;
3914
3915 Map_Get_Distance_BetweenPoints_Within_640(X, Y, Data8, DataC);
3916
3917 int Volume = 40;
3918 Volume -= (X / 16);
3919
3920 if (Volume <= 0)
3921 return;
3922
3923 if (!mStartParams->mDisableSound)
3924 mSound->Sound_Play(mMapLoaded->getTileType(), pSoundEffect, Volume, d0);
3925}
3926
3927void cFodder::Mission_Intro_Helicopter_Start() {
3928 mBriefingHelicopter_TimeScale = 60.0f / mWindow->GetRefreshRate();

Callers

nothing calls this directly

Calls 1

getTileTypeMethod · 0.80

Tested by

no test coverage detected