Skip to content

Commit

Permalink
CRUISE: Disable a bit more efficiently some code in Op_Random() and O…
Browse files Browse the repository at this point in the history
…p_PlayFx()
  • Loading branch information
Strangerke committed Jun 6, 2014
1 parent 09e3ddf commit b830b84
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions engines/cruise/function.cpp
Expand Up @@ -196,13 +196,22 @@ int16 Op_Random() {

int16 Op_PlayFX() {
int volume = popVar();

#if 0
int speed = popVar();
/*int channelNum = */popVar();
int channelNum = popVar();
#else
popVar();
popVar();
#endif

int sampleNum = popVar();

if ((sampleNum >= 0) && (sampleNum < NUM_FILE_ENTRIES) && (filesDatabase[sampleNum].subData.ptr)) {
#if 0
if (speed == -1)
speed = filesDatabase[sampleNum].subData.transparency;
#endif

_vm->sound().playSound(filesDatabase[sampleNum].subData.ptr,
filesDatabase[sampleNum].width, volume);
Expand All @@ -213,13 +222,23 @@ int16 Op_PlayFX() {

int16 Op_LoopFX() {
int volume = popVar();

#if 0
int speed = popVar();
/*int channelNum = */popVar();
int channelNum = popVar();
#else
popVar();
popVar();
#endif

int sampleNum = popVar();

if ((sampleNum >= 0) && (sampleNum < NUM_FILE_ENTRIES) && (filesDatabase[sampleNum].subData.ptr)) {

#if 0
if (speed == -1)
speed = filesDatabase[sampleNum].subData.transparency;
#endif

_vm->sound().playSound(filesDatabase[sampleNum].subData.ptr,
filesDatabase[sampleNum].width, volume);
Expand Down Expand Up @@ -552,15 +571,13 @@ int16 Op_LoadFrame() {
}

int16 Op_LoadAbs() {
int slot;
char name[36] = "";
char *ptr;
int result = 0;

ptr = (char *) popPtr();
slot = popVar();
char *ptr = (char *) popPtr();
int slot = popVar();

if ((slot >= 0) && (slot < NUM_FILE_ENTRIES)) {
char name[36] = "";
Common::strlcpy(name, ptr, sizeof(name));
strToUpper(name);

Expand Down Expand Up @@ -1360,12 +1377,11 @@ int16 Op_RestoreSong() {
}

int16 Op_SongSize() {
int size, oldSize;

int oldSize;
if (_vm->sound().songLoaded()) {
oldSize = _vm->sound().numOrders();

size = popVar();
int size = popVar();
if ((size >= 1) && (size < 128))
_vm->sound().setNumOrders(size);
} else
Expand Down Expand Up @@ -1495,8 +1511,6 @@ int16 Op_Itoa() {
int nbp = popVar();
int param[160];
char txt[40];
char format[30];
char nbf[20];

for (int i = nbp - 1; i >= 0; i--)
param[i] = popVar();
Expand All @@ -1507,6 +1521,8 @@ int16 Op_Itoa() {
if (!nbp)
sprintf(txt, "%d", val);
else {
char format[30];
char nbf[20];
strcpy(format, "%");
sprintf(nbf, "%d", param[0]);
strcat(format, nbf);
Expand Down

0 comments on commit b830b84

Please sign in to comment.