UINT32 PlayJA2Sample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan )
{
	//SoundLog((CHAR8 *)String(" Play sound %s on volume %d", szSoundEffects[usNum], ubVolume));

	SOUNDPARMS spParms;

	memset(&spParms, 0xff, sizeof(SOUNDPARMS));

	spParms.uiSpeed = usRate;

	if ( strstr( szSoundEffects[usNum], "WEAPONS" ) == NULL )
	{
		spParms.uiVolume = CalculateSoundEffectsVolume( ubVolume );
	}
	else
	{
		spParms.uiVolume = (UINT32)( ( ubVolume / (FLOAT) HIGHVOLUME ) * guiSoundEffectsVolume +.5 ) * (1 + gGameExternalOptions.guiWeaponSoundEffectsVolume / 100);
	}

	spParms.uiVolume &= 0xFFL;
	spParms.uiLoop = ubLoops;
	spParms.uiPan = uiPan & 0xFFL;
	spParms.uiPriority=GROUP_PLAYER;

	//SoundLog((CHAR8 *)String(" Play sound %s on volume %d", szSoundEffects[usNum], spParms.uiVolume));

	return(SoundPlay(szSoundEffects[usNum], &spParms));
}
//*****************************************************************************
//
// Handles change notifications for the radio button widgets.
//
//*****************************************************************************
void
OnRadioChange(tWidget *pWidget, unsigned long bSelected)
{
    //
    // Find the index of this radio button in the first group.
    //
    for(g_ulLangIdx = 0; g_ulLangIdx < NUM_RADIO1_BUTTONS; g_ulLangIdx++)
    {
        if(pWidget == (tWidget *)(g_psRadioButtons1 + g_ulLangIdx))
        {
            break;
        }
    }

    //
    // Change any dynamic language strings.
    //
    ChangeLanguage(g_pLanguageTable[g_ulLangIdx].usLanguage);

    //
    // Issue the initial paint request to the widgets.
    //
    WidgetPaint(WIDGET_ROOT);

    //
    // Play the key click sound.
    //
    SoundPlay(g_pusKeyClick, sizeof(g_pusKeyClick) / 2);
}
//*****************************************************************************
//
// Handles change notifications for the radio button widgets.
//
//*****************************************************************************
void
OnRadioChange(tWidget *pWidget, unsigned long bSelected)
{
    unsigned long ulIdx;

    //
    // Find the index of this radio button in the first group.
    //
    for(ulIdx = 0; ulIdx < NUM_RADIO1_BUTTONS; ulIdx++)
    {
        if(pWidget == (tWidget *)(g_psRadioButtons1 + ulIdx))
        {
            break;
        }
    }

    //
    // See if the radio button was found.
    //
    if(ulIdx == NUM_RADIO1_BUTTONS)
    {
        //
        // Find the index of this radio button in the second group.
        //
        for(ulIdx = 0; ulIdx < NUM_RADIO2_BUTTONS; ulIdx++)
        {
            if(pWidget == (tWidget *)(g_psRadioButtons2 + ulIdx))
            {
                break;
            }
        }

        //
        // Return if the radio button could not be found.
        //
        if(ulIdx == NUM_RADIO2_BUTTONS)
        {
            return;
        }

        //
        // Sind the radio button is in the second group, offset the index to
        // the indicators associated with the second group.
        //
        ulIdx += NUM_RADIO1_BUTTONS;
    }

    //
    // Set the matching indicator based on the selected state of the radio
    // button.
    //
    CanvasImageSet(g_psRadioButtonIndicators + ulIdx,
                   bSelected ? g_pucLightOn : g_pucLightOff);
    WidgetPaint((tWidget *)(g_psRadioButtonIndicators + ulIdx));

    //
    // Play the key click sound.
    //
    SoundPlay(g_pusKeyClick, sizeof(g_pusKeyClick) / 2);
}
bool ScreenMissionBriefing(const struct MissionOptions *m)
{
	const int w = gGraphicsDevice.cachedConfig.Res.x;
	const int h = gGraphicsDevice.cachedConfig.Res.y;
	const int y = h / 4;
	MissionBriefingData mData;
	memset(&mData, 0, sizeof mData);
	mData.IsOK = true;

	// Title
	CMALLOC(mData.Title, strlen(m->missionData->Title) + 32);
	sprintf(mData.Title, "Mission %d: %s",
		m->index + 1, m->missionData->Title);
	mData.TitleOpts = FontOptsNew();
	mData.TitleOpts.HAlign = ALIGN_CENTER;
	mData.TitleOpts.Area = gGraphicsDevice.cachedConfig.Res;
	mData.TitleOpts.Pad.y = y - 25;

	// Password
	if (m->index > 0)
	{
		sprintf(
			mData.Password, "Password: %s", gAutosave.LastMission.Password);
		mData.PasswordOpts = FontOptsNew();
		mData.PasswordOpts.HAlign = ALIGN_CENTER;
		mData.PasswordOpts.Area = gGraphicsDevice.cachedConfig.Res;
		mData.PasswordOpts.Pad.y = y - 15;
	}

	// Split the description, and prepare it for typewriter effect
	mData.TypewriterCount = 0;
	// allow some slack for newlines
	CMALLOC(mData.Description, strlen(m->missionData->Description) * 2 + 1);
	CCALLOC(mData.TypewriterBuf, strlen(m->missionData->Description) * 2 + 1);
	// Pad about 1/6th of the screen width total (1/12th left and right)
	FontSplitLines(m->missionData->Description, mData.Description, w * 5 / 6);
	mData.DescriptionPos = Vec2iNew(w / 12, y);

	// Objectives
	mData.ObjectiveDescPos =
		Vec2iNew(w / 6, y + FontStrH(mData.Description) + h / 10);
	mData.ObjectiveInfoPos =
		Vec2iNew(w - (w / 6), mData.ObjectiveDescPos.y + FontH());
	mData.ObjectiveHeight = h / 12;
	mData.MissionOptions = m;

	GameLoopData gData = GameLoopDataNew(
		&mData, MissionBriefingUpdate,
		&mData, MissionBriefingDraw);
	GameLoop(&gData);
	if (mData.IsOK)
	{
		SoundPlay(&gSoundDevice, StrSound("mg"));
	}

	CFREE(mData.Title);
	CFREE(mData.Description);
	CFREE(mData.TypewriterBuf);
	return mData.IsOK;
}
void ScreenDogfightScores(void)
{
	GameLoopData gData = GameLoopDataNew(
		NULL, GameLoopWaitForAnyKeyOrButtonFunc, NULL, DogfightScoresDraw);
	GameLoop(&gData);
	SoundPlay(&gSoundDevice, StrSound("mg"));
}
Exemple #6
0
void GM_MainMenu::KeyPress (unsigned char key, int x, int y) {
    SoundPlay("sounds/key.wav");
	desktop.CastEvent(GLICT_KEYPRESS, &key, 0);
	#ifdef USEGLUT
	glutPostRedisplay();
	#endif
}
Exemple #7
0
void TitleScreenDoLogic(bool* Continue, bool* Error, Uint32 Milliseconds)
{
	(void)Continue;
	(void)Error;
	cpSpaceStep(space.Space, Milliseconds * 0.001);
	for (int i = 0; i < MAX_PLAYERS; i++)
	{
		PlayerUpdate(&players[i], Milliseconds);

		// Check which players have fallen below their start pads
		cpVect pos = cpBodyGetPosition(players[i].Body);
		if (pos.y < BLOCK_Y)
		{
			if (!playersEnabled[i])
			{
				// New player entered
				countdownMs = COUNTDOWN_START_MS;
				SoundPlay(SoundStart, 1.0);
			}
			playersEnabled[i] = true;
		}
	}

	if (countdownMs >= 0)
	{
		const int countdownMsNext = countdownMs - Milliseconds;
		// Play a beep every second
		if ((countdownMs / 1000) > (countdownMsNext / 1000))
		{
			SoundPlay(SoundBeep, 1.0);
		}
		// Start game if counted down to zero
		if (countdownMsNext <= 0)
		{
			TitleScreenEnd();
			ToGame();
			return;
		}
		countdownMs = countdownMsNext;
	}

	Animation *a = Start ? &TitleAnim : &GameOverAnim;
	AnimationUpdate(a, Milliseconds);

	HighScoreDisplayUpdate(&HSD, Milliseconds);
}
Exemple #8
0
static int BodyPartSelection(int x, int index, struct PlayerData *data,
			     int cmd, int *property, int *selection)
{
	int i;
	int y;

	if (cmd & (CMD_BUTTON1 | CMD_BUTTON2))
	{
		SoundPlay(&gSoundDevice, SND_POWERGUN);
		return 0;
	} else if (cmd & (CMD_LEFT | CMD_UP)) {
		if (*selection > 0) {
			(*selection)--;
			*property = IndexToShade(*selection);
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
		else if (*selection == 0)
		{
			(*selection) = PLAYER_BODY_COUNT - 1;
			*property = IndexToShade(*selection);
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
	} else if (cmd & (CMD_RIGHT | CMD_DOWN)) {
		if (*selection < PLAYER_BODY_COUNT - 1) {
			(*selection)++;
			*property = IndexToShade(*selection);
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
		else if (*selection == PLAYER_BODY_COUNT - 1)
		{
			(*selection) = 0;
			*property = IndexToShade(*selection);
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
	}

	y = CenterY((PLAYER_BODY_COUNT * CDogsTextHeight()));

	SetPlayer(index, data);
	for (i = 0; i < PLAYER_BODY_COUNT; i++)
		DisplayMenuItem(x, y + i * CDogsTextHeight(), shadeNames[i],
				i == *selection);

	return 1;
}
static bool ObstacleDetection()
{
    static int false_count = 0;
    static bool prev_detection = false;

    //_closest_waypoint = GetClosestWaypoint();
    int closest_waypoint = _path_dk.getClosestWaypoint();
    std::cout << "closest_waypoint : " << closest_waypoint << std::endl;
    DisplayDetectionRange(closest_waypoint + 1);
    int vscan_result = vscanDetection(closest_waypoint);

    if (prev_detection == false) {
        if (vscan_result != -1) {
            DisplayObstacleWaypoint(vscan_result);
            std::cout << "obstacle waypoint : " << vscan_result << std::endl << std::endl;
            prev_detection = true;
            _obstacle_waypoint = vscan_result;
            SoundPlay();
            false_count = 0;
            return true;
        } else {
            prev_detection = false;
            return false;
        }
    } else { //prev_detection = true
        if (vscan_result != -1) {
            DisplayObstacleWaypoint(vscan_result);
            std::cout << "obstacle waypoint : " << vscan_result << std::endl << std::endl;
            prev_detection = true;
            _obstacle_waypoint = vscan_result;
            false_count = 0;

            return true;
        } else {
            false_count++;
            std::cout << "false_count : "<<false_count << std::endl;
        }

        //fail-safe
        if (false_count == LOOP_RATE * 2) {
            _obstacle_waypoint = -1;
            false_count = 0;
            prev_detection = false;
            return false;
        } else {
            std::cout << "obstacle waypoint : " << _obstacle_waypoint << std::endl << std::endl;
            DisplayObstacleWaypoint(_obstacle_waypoint);
            prev_detection = true;

           return true;
        }
    }



}
Exemple #10
0
static int EffectPlaySound(void *NotUsed, int argc, char **argv, char **azColName) {
	if (argc) {
		if (argv[0]) {
			std::stringstream s;
			s << "sounds/" << argv[0];
			//console.insert(argv[0]);
			SoundPlay(s.str().c_str());
		}
	}
	return 0;
}
//--------------------------- Controls
 PyObject* LMF_SoundPlay  (PyObject *self, PyObject *args){
	int iSoundID;
	int bLoop;
	float fVol,fSpeed;
	if (!PyArg_ParseTuple(args, "iiff", &iSoundID, &bLoop, &fVol, &fSpeed)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	unsigned int iSound = SoundPlay(iSoundID,bLoop,fVol,fSpeed);
	return Py_BuildValue("i", iSound);
}
UINT32 PlayJA2Ambient( UINT32 usNum, UINT32 ubVolume, UINT32 ubLoops)
{
	SOUNDPARMS spParms;

	memset(&spParms, 0xff, sizeof(SOUNDPARMS));

	spParms.uiVolume = CalculateSoundEffectsVolume( ubVolume );
	spParms.uiLoop = ubLoops;
	spParms.uiPriority=GROUP_AMBIENT;

	return(SoundPlay(szAmbientEffects[usNum], &spParms));
}
Exemple #13
0
bool ScreenMissionSummary(CampaignOptions *c, struct MissionOptions *m)
{
	// Save password
	MissionSave ms;
	MissionSaveInit(&ms);
	ms.Campaign = c->Entry;
	// Don't make password for next level if there is none
	int passwordIndex = m->index + 1;
	if (passwordIndex == c->Entry.NumMissions)
	{
		passwordIndex--;
	}
	strcpy(ms.Password, MakePassword(passwordIndex, 0));
	ms.MissionsCompleted = m->index + 1;
	AutosaveAddMission(&gAutosave, &ms, ms.Campaign.BuiltinIndex);
	AutosaveSave(&gAutosave, GetConfigFilePath(AUTOSAVE_FILE));

	// Calculate bonus scores
	// Bonuses only apply if at least one player has lived
	if (AreAnySurvived())
	{
		int bonus = 0;
		// Objective bonuses
		for (int i = 0; i < (int)m->missionData->Objectives.size; i++)
		{
			const struct Objective *o = CArrayGet(&m->Objectives, i);
			const MissionObjective *mo = CArrayGet(&m->missionData->Objectives, i);
			if (o->done == mo->Count && o->done > mo->Required)
			{
				// Perfect
				bonus += PERFECT_BONUS;
			}
		}
		bonus += GetAccessBonus(m);
		bonus += GetTimeBonus(m, NULL);

		for (int i = 0; i < (int)gPlayerDatas.size; i++)
		{
			PlayerData *p = CArrayGet(&gPlayerDatas, i);
			ApplyBonuses(p, bonus);
		}
	}
	GameLoopWaitForAnyKeyOrButtonData wData;
	GameLoopData gData = GameLoopDataNew(
		&wData, GameLoopWaitForAnyKeyOrButtonFunc,
		m, MissionSummaryDraw);
	GameLoop(&gData);
	if (wData.IsOK)
	{
		SoundPlay(&gSoundDevice, StrSound("mg"));
	}
	return wData.IsOK;
}
Exemple #14
0
static int TemplateSelection(int loadFlag, int x, int index,
			     struct PlayerData *data, int cmd)
{
	int i;
	int y;
	static int selection[2] = { 0, 0 };

	if (cmd & CMD_BUTTON1)
	{
		if (loadFlag)
		{
			UseTemplate(index, data, &templates[selection[index]]);
		}
		else
		{
			SaveTemplate(data, &templates[selection[index]]);
		}
		SoundPlay(&gSoundDevice, rand() % SND_COUNT);
		return 0;
	}
	else if (cmd & CMD_BUTTON2)
	{
		SoundPlay(&gSoundDevice, rand() % SND_COUNT);
		return 0;
	} else if (cmd & (CMD_LEFT | CMD_UP)) {
		if (selection[index] > 0) {
			selection[index]--;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
		else if (selection[index] == 0)
		{
			selection[index] = MAX_TEMPLATE - 1;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
	} else if (cmd & (CMD_RIGHT | CMD_DOWN)) {
		if (selection[index] < MAX_TEMPLATE - 1) {
			selection[index]++;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
		else if (selection[index] == MAX_TEMPLATE - 1)
		{
			selection[index] = 0;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
	}

	y = CenterY((CDogsTextHeight() * MAX_TEMPLATE));

	if (!loadFlag) {
		CDogsTextStringAt(x, y - 4 - CDogsTextHeight(), "Save ");
		CDogsTextString(data->name);
		CDogsTextString("...");
	}

	for (i = 0; i < MAX_TEMPLATE; i++)
		DisplayMenuItem(x, y + i * CDogsTextHeight(),
				templates[i].name, i == selection[index]);

	return 1;
}
Exemple #15
0
static int MainMenu(int x, int index, int cmd)
{
	int i;
	int y;
	static int selection[2] = { MODE_DONE, MODE_DONE };

	if (cmd & (CMD_BUTTON1 | CMD_BUTTON2))
	{
		SoundPlay(&gSoundDevice, SND_BANG);
		return selection[index];
	} else if (cmd & (CMD_LEFT | CMD_UP)) {
		if (selection[index] > MODE_SELECTNAME) {
			selection[index]--;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
		else if (selection[index] == MODE_SELECTNAME)
		{
			selection[index] = MODE_DONE;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
	} else if (cmd & (CMD_RIGHT | CMD_DOWN)) {
		if (selection[index] < MODE_DONE) {
			selection[index]++;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
		else if (selection[index] == MODE_DONE)
		{
			selection[index] = MODE_SELECTNAME;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
	}

	y = CenterY((CDogsTextHeight() * MENU_COUNT));

	for (i = 1; i < MENU_COUNT; i++)
		DisplayMenuItem(x, y + i * CDogsTextHeight(), mainMenu[i],
				selection[index] == i);

	return MODE_MAIN;
}
Exemple #16
0
bool ScreenCampaignIntro(CampaignSetting *c)
{
	GameLoopWaitForAnyKeyOrButtonData wData;
	GameLoopData gData = GameLoopDataNew(
		&wData, GameLoopWaitForAnyKeyOrButtonFunc,
		c, CampaignIntroDraw);
	GameLoop(&gData);
	if (wData.IsOK)
	{
		SoundPlay(&gSoundDevice, StrSound("mg"));
	}
	return wData.IsOK;
}
Exemple #17
0
void MenuChangeIndex(menu_t *menu, int cmd)
{
	int leftRightMoves = MenuTypeLeftRightMoves(menu->type);
	if (Up(cmd) || (leftRightMoves && Left(cmd)))
	{
		do
		{
			menu->u.normal.index--;
			if (menu->u.normal.index < 0)
			{
				menu->u.normal.index = menu->u.normal.numSubMenus - 1;
			}
		} while (menu->u.normal.subMenus[menu->u.normal.index].type ==
			MENU_TYPE_SEPARATOR);
		SoundPlay(&gSoundDevice, SND_DOOR);
	}
	else if (Down(cmd) || (leftRightMoves && Right(cmd)))
	{
		do
		{
			menu->u.normal.index++;
			if (menu->u.normal.index >= menu->u.normal.numSubMenus)
			{
				menu->u.normal.index = 0;
			}
		} while (menu->u.normal.subMenus[menu->u.normal.index].type ==
			MENU_TYPE_SEPARATOR);
		SoundPlay(&gSoundDevice, SND_DOOR);
	}
	menu->u.normal.scroll =
		CLAMP(menu->u.normal.scroll,
			MAX(0, menu->u.normal.index - 11),
			MIN(menu->u.normal.numSubMenus - 1, menu->u.normal.index + 11));
	if (menu->u.normal.index < menu->u.normal.scroll)
	{
		menu->u.normal.scroll = menu->u.normal.index;
	}
}
Exemple #18
0
UINT32 PlayJA2Sample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan )
{
  SOUNDPARMS spParms;

	memset(&spParms, 0xff, sizeof(SOUNDPARMS));

	spParms.uiSpeed = usRate;
	spParms.uiVolume = CalculateSoundEffectsVolume( ubVolume );
	spParms.uiLoop = ubLoops;
	spParms.uiPan = uiPan;
	spParms.uiPriority=GROUP_PLAYER;

	return(SoundPlay(szSoundEffects[usNum], &spParms));
}
Exemple #19
0
void MenuPlaySound(MenuSound s)
{
	switch (s)
	{
	case MENU_SOUND_ENTER:
		SoundPlay(&gSoundDevice, StrSound("mg"));
		break;
	case MENU_SOUND_BACK:
		SoundPlay(&gSoundDevice, StrSound("pickup"));
		break;
	case MENU_SOUND_SWITCH:
		SoundPlay(&gSoundDevice, StrSound("door"));
		break;
	case MENU_SOUND_START:
		SoundPlay(&gSoundDevice, StrSound("hahaha"));
		break;
	case MENU_SOUND_ERROR:
		SoundPlay(&gSoundDevice, SoundGetRandomScream(&gSoundDevice));
		break;
	default:
		break;
	}
}
Exemple #20
0
void MenuPlaySound(MenuSound s)
{
	switch (s)
	{
	case MENU_SOUND_ENTER:
		SoundPlay(&gSoundDevice, SND_MACHINEGUN);
		break;
	case MENU_SOUND_BACK:
		SoundPlay(&gSoundDevice, SND_PICKUP);
		break;
	case MENU_SOUND_SWITCH:
		SoundPlay(&gSoundDevice, SND_DOOR);
		break;
	case MENU_SOUND_START:
		SoundPlay(&gSoundDevice, SND_HAHAHA);
		break;
	case MENU_SOUND_ERROR:
		SoundPlay(&gSoundDevice, SND_KILL4);
		break;
	default:
		break;
	}
}
Exemple #21
0
enum ActionMenu StageMain(int *stageState, char *mapName)
{
    static int bgm = - 1;
    static char name[MAX_PATH];
    
    switch (*stageState) {
    case 0:
        map = ReadMap(mapName);
#if !MAP_EDIT_MODE
        GetBgmName(name, mapName);
        bgm = LoadSound(name);
#endif        
        *stageState = 1;
        break;

    case 1:
        {
            InitMap(map);
            CreateObject(map);
            DrawMain = StageDraw;
            LoopSound(bgm);
            *stageState = 2;
        }
        break;

    case 2:
            MoveMap(map);
            MoveEnemy(map);
            MoveItem(map);
            MoveBomb(map);
            MoveEnemy(map);
            MovePlayer(map);
            if (IsPlayerDie()) {
                SoundPlay(res.sound_die);
                life--;
                if (life < 0) {
                    FreeStage(map, stageState, bgm);
                    return MENU_GAMEOVER;
                }
                *stageState = 1;
            }
            if (IsPlayerClear()) {
                FreeStage(map, stageState, bgm);
                return MENU_CLEAR;
            }
            break;
    }
    return MENU_STAGE;
}
Exemple #22
0
static int PlayerListInput(int cmd, void *data)
{
	// Input: up/down scrolls list
	// CMD 1/2: exit
	PlayerList *pl = data;

	// Note: players can leave due to network disconnection
	// Update our lists
	CA_FOREACH(const int, playerUID, pl->playerUIDs)
		const PlayerData *p = PlayerDataGetByUID(*playerUID);
		if (p == NULL)
		{
			CArrayDelete(&pl->playerUIDs, _ca_index);
			_ca_index--;
		}
	CA_FOREACH_END()

	if (cmd == CMD_DOWN)
	{
		SoundPlay(&gSoundDevice, StrSound("door"));
		pl->scroll++;
	}
	else if (cmd == CMD_UP)
	{
		SoundPlay(&gSoundDevice, StrSound("door"));
		pl->scroll--;
	}
	else if (AnyButton(cmd))
	{
		SoundPlay(&gSoundDevice, StrSound("pickup"));
		return 1;
	}
	// Scroll wrap-around
	pl->scroll = CLAMP_OPPOSITE(pl->scroll, 0, PlayerListMaxScroll(pl));
	return 0;
}
Exemple #23
0
void GM_MainMenu::MouseClick (int button, int shift, int mousex, int mousey) {

	glictPos pos;
	pos.x = mousex;
	pos.y = mousey;
	desktop.TransformScreenCoords(&pos);
	if (shift==WIN_PRESS) {
	    desktop.CastEvent(GLICT_MOUSEDOWN, &pos, 0);
	}
	if (shift==WIN_RELEASE) {
	    if (desktop.CastEvent(GLICT_MOUSEUP, &pos, 0))
	        SoundPlay("sounds/mouse.wav");

	}

}
Exemple #24
0
static void
IconboxesEwinIconify(EWin * ewin)
{
   Container          *ct;

   ct = SelectIconboxForEwin(ewin);
   if (!ct)
      return;

   SoundPlay(SOUND_ICONIFY);

   if (EoIsShown(ewin) && ct->anim_mode && !ewin->state.showingdesk)
      IB_Animate(ct, 1, ewin);

   IconboxObjEwinAdd(ct, ewin);
}
Exemple #25
0
UINT32 PlayJA2SampleFromFile( STR8 szFileName, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan )
{

	// does the same thing as PlayJA2Sound, but one only has to pass the filename, not the index of the sound array

  SOUNDPARMS spParms;

	memset(&spParms, 0xff, sizeof(SOUNDPARMS));

	spParms.uiSpeed = usRate;
	spParms.uiVolume = CalculateSoundEffectsVolume( ubVolume );
	spParms.uiLoop = ubLoops;
	spParms.uiPan = uiPan;
	spParms.uiPriority=GROUP_PLAYER;

	return(SoundPlay(szFileName, &spParms));
}
Exemple #26
0
void StartEFFECT(EFFECT_VALUE EffectValue,int loop,int pan)
{
    if(!EffectInUse || !SndData[EffectValue].lpDSB) return;
    int flag = SndData[EffectValue].flags;
    if(loop) flag |= DS_LOOPING;
    if(SndData[EffectValue].channel != LOCAL_CHANNEL)
        SetVolume(SndData[EffectValue].lpDSB,soundVolumecurrent);
    else
        SetVolume(SndData[EffectValue].lpDSB,soundVolume);

    if(EngineNoise && EffectValue == EFF_DRIVING) SoundStop(SndData[EffectValue].channel);
    if (SoundVolumePanning)
        SoundPan(SndData[EffectValue].channel, -pan*8);
    //if (SndData[EffectValue].status & ESCAVE_SOUND&&EffectValue!=EFF_NOISE)
    //	std::cout<<"StartEFFECT:"<<SndData[EffectValue].fname<<" int:"<<(int)EffectValue<<std::endl;
    SoundPlay(SndData[EffectValue].lpDSB,SndData[EffectValue].channel,SndData[EffectValue].priority,SndData[EffectValue].cropos,flag);
}
Exemple #27
0
static void
IconboxesEwinDeIconify(EWin * ewin)
{
   Container          *ct;

   ct = SelectIconboxForEwin(ewin);
   if (!ct)
      return;

   SoundPlay(SOUND_DEICONIFY);

   if (ct->anim_mode && !ewin->state.showingdesk)
      IB_Animate(ct, 0, ewin);

   IconboxObjEwinDel(ct, ewin);
   ContainerRedraw(ct);
   EobjsRepaint();
}
//*****************************************************************************
//
// This handler is called whenever the "Home" button is released from the image
// viewer screen.  It resets the widget tree to ensure that the home screen is
// displayed.
//
//*****************************************************************************
static void
OnBtnImageToHome(tWidget *pWidget)
{
    //
    // This is a separate handler since we may want to do some tidy up on
    // exiting from the image viewer.  Currently we don't do anything
    // special but we may so...
    //

    //
    // Switch back to the home screen.
    //
    ShowUIScreen(HOME_SCREEN);

    //
    // Play the key click sound.
    //
    SoundPlay(g_pusKeyClick, g_ulKeyClickLen);
}
//*****************************************************************************
//
// Handles press notifications for the push button widgets.
//
//*****************************************************************************
void
OnFirmwareUpdate(tWidget *pWidget)
{
    //
    // Play the key click sound.
    //
    SoundPlay(g_pusKeyClick, sizeof(g_pusKeyClick) / 2);

    //
    // Change the button text to show that the update is starting
    //
    GrStringGet(STR_UPDATING, g_pcUpdateButton, UPDATE_BUTTON_MAX_SIZE);
    WidgetPaint((tWidget *)&g_sFirmwareUpdateBtn);

    //
    // Trigger a software update
    //
    g_bFirmwareUpdate = true;
}
Exemple #30
0
//*****************************************************************************
//
// Handles press notifications for the push button widgets.
//
//*****************************************************************************
void
OnFirmwareUpdate(tWidget *pWidget)
{
    //
    // Play the key click sound.
    //
    SoundPlay(g_pusKeyClick, sizeof(g_pusKeyClick) / 2);

    //
    // Change the button text to show that the update is starting
    //
    PushButtonTextSet(&g_sFirmwareUpdateBtn, "Updating...");
    WidgetPaint((tWidget *)&g_sFirmwareUpdateBtn);

    //
    // Trigger a software update
    //
    g_bFirmwareUpdate = true;
}