mirror of
https://github.com/Jusctsch5/ironsphererpg.git
synced 2026-07-16 08:55:31 +00:00
T2RPG: Initial commit of ironsphererpg directory
Taking everything obtained from http://ironsphererpg2.webs.com/ and dumping it in a git repo
This commit is contained in:
parent
fe9e2d05d1
commit
a5143b67f7
1730 changed files with 186051 additions and 0 deletions
105
scripts/redbook.cs
Normal file
105
scripts/redbook.cs
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
//------------------------------------------------------------------------------
|
||||
function RedBookCallback(%type)
|
||||
{
|
||||
if(%type $= "PlayFinished")
|
||||
CDPlayer.playFinished();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function CDAudio::playFinished(%this)
|
||||
{
|
||||
if(%this.repeat == false)
|
||||
return;
|
||||
|
||||
%this.play();
|
||||
}
|
||||
|
||||
function CDAudio::play(%this)
|
||||
{
|
||||
%numTracks = %this.getTrackCount();
|
||||
if(%numTracks == 0)
|
||||
{
|
||||
error(redbookGetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
switch$(%this.playMode)
|
||||
{
|
||||
case "one_shot":
|
||||
%this.playTrack(%this.currentTrack);
|
||||
|
||||
case "continuous":
|
||||
%this.currentTrack++;
|
||||
if(%this.currentTrack >= %numTracks)
|
||||
%this.currentTrack = 0;
|
||||
%this.playTrack(%this.currentTrack);
|
||||
|
||||
case "random":
|
||||
%track = mFloor(getRandom() * (%numTracks + 1));
|
||||
if(%track >= %numTracks)
|
||||
%track = %numTracks - 1;
|
||||
%this.playTrack(%track);
|
||||
}
|
||||
}
|
||||
|
||||
function CDAudio::playTrack(%this, %track)
|
||||
{
|
||||
if(redbookPlay(%track) == false)
|
||||
{
|
||||
error(redbookGetLastError());
|
||||
%this.repeat = false;
|
||||
return;
|
||||
}
|
||||
%this.currentTrack = %track;
|
||||
}
|
||||
|
||||
function CDAudio::stop(%this)
|
||||
{
|
||||
redbookStop();
|
||||
}
|
||||
|
||||
function CDAudio::getTrackCount(%this)
|
||||
{
|
||||
return(redbookGetTrackCount());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
new ScriptObject(CDPlayer)
|
||||
{
|
||||
class = CDAudio;
|
||||
currentTrack = 0;
|
||||
playMode = "one_shot";
|
||||
repeat = true;
|
||||
};
|
||||
|
||||
if($pref::Audio::musicEnabled)
|
||||
{
|
||||
redbookOpen();
|
||||
redbookSetVolume($pref::Audio::musicVolume);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function clientCmdPlayCDTrack(%track)
|
||||
{
|
||||
if(%track $= "")
|
||||
{
|
||||
%numTracks = CDPlayer.getTrackCount();
|
||||
if(%numTracks == 0)
|
||||
{
|
||||
error(redbookGetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
%track = mFloor(getRandom() * (%numTracks + 1));
|
||||
if(%track >= %numTracks)
|
||||
%track = %numTracks - 1;
|
||||
}
|
||||
|
||||
CDPlayer.playTrack(%track);
|
||||
}
|
||||
|
||||
function clientCmdStopCD()
|
||||
{
|
||||
CDPlayer.stop();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue