MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / iMuseCallback1

Function iMuseCallback1

TheForceEngine/TFE_DarkForces/gameMusic.cpp:327–368  ·  view source on GitHub ↗

Initial callback.

Source from the content-addressed store, hash-verified

325
326 // Initial callback.
327 void iMuseCallback1(char* marker)
328 {
329 if (!strncmp(marker, "to ", 3))
330 {
331 s32 punt = 0;
332 if (!strncmp(&marker[4], "slow", 4))
333 {
334 if (s_currentState <= s_oldState || s_currentState == MUS_STATE_FIGHT)
335 {
336 punt = 1;
337 }
338 }
339 else if ((s_currentState > s_oldState && s_currentState != MUS_STATE_FIGHT) || (s_currentState == s_oldState))
340 {
341 punt = 1;
342 }
343
344 if (!punt)
345 {
346 // Get the current measure and beat so we can return to it later.
347 ImPause();
348 s_savedMeasure = ImGetParam(s_oldSong, midiMeasure);
349 s_savedBeat = ImGetParam(s_oldSong, midiBeat);
350 ImResume();
351
352 // This is a transition, so update the trigger.
353 s_transChunk = marker[3] - 'A'; // "to A", "to B", etc.
354 ImJumpMidi(s_oldSong, 1 + s_transChunk, 1, 1, 0, 1);
355 ImSetTrigger(s_oldSong, 0, MUSIC_CALLBACK(iMuseCallback2));
356 }
357 else
358 {
359 // Reset the trigger.
360 GMUSIC_MSG("Punt!...");
361 ImSetTrigger(s_oldSong, 0, MUSIC_CALLBACK(iMuseCallback1));
362 }
363 }
364 else
365 {
366 GMUSIC_MSG("Callback1 got bogus marker...");
367 }
368 }
369
370 // Callback after transition.
371 void iMuseCallback2(char* marker)

Callers

nothing calls this directly

Calls 5

ImPauseFunction · 0.85
ImGetParamFunction · 0.85
ImResumeFunction · 0.85
ImJumpMidiFunction · 0.85
ImSetTriggerFunction · 0.85

Tested by

no test coverage detected