Code Editing Tutorials
Longer elevator sound

You'd like a longer elevator sound? Read on!

Step 1. Go to your source code directory and open the file WL_AGENT.C .
Step 2. Go to line 1068. You should now see this:
{
//
// use elevator
//
buttonheld[bt_use] = true;
tilemap[checkx][checky]++; // flip switch
if (*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) == ALTELEVATORTILE)
playstate = ex_secretlevel;
else
playstate = ex_completed;
SD_PlaySound (LEVELDONESND);
SD_WaitSoundDone();
}
else if (!buttonheld[bt_use] && doornum & 0x80)
{
buttonheld[bt_use] = true;
OperateDoor (doornum & ~0x80);
}
else
SD_PlaySound (DONOTHINGSND);
}

Step 3. Replace all the text in the elevator code(see above) with that
below(don't print it, copy it to your clipboard and extract it over the other text, or it will not work):

if (!buttonheld[bt_use] && doornum == ELEVATORTILE && elevatorok)
{
//
// use elevator
//
buttonheld[bt_use] = true;

tilemap[checkx][checky]++; // flip switch

if (*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) == ALTELEVATORTILE)

playstate = ex_secretlevel;

else

SD_StopSound();

SD_PlaySound(LEVELDONESND);

if (DigiMode != sds_Off)
{
long lasttimecount = TimeCount;

while(TimeCount < lasttimecount+150)

SD_Poll();

}
playstate = ex_completed;
}

else if (!buttonheld[bt_use] && doornum & 0x80)

{
buttonheld[bt_use] = true;
OperateDoor (doornum & ~0x80);
}
else
SD_PlaySound (DONOTHINGSND);
}

Step 4. Now the code looks like this:

if (!buttonheld[bt_use] && doornum == ELEVATORTILE && elevatorok)

{
//
// use elevator
//
buttonheld[bt_use] = true;

tilemap[checkx][checky]++; // flip switch

if (*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) == ALTELEVATORTILE)

playstate = ex_secretlevel;

else

SD_StopSound();

SD_PlaySound(LEVELDONESND);

if (DigiMode != sds_Off)

{
long lasttimecount = TimeCount;
while(TimeCount < lasttimecount+150)
SD_Poll();
}
playstate = ex_completed;
}
else if (!buttonheld[bt_use] && doornum & 0x80)
{
buttonheld[bt_use] = true;
OperateDoor (doornum & ~0x80);

}
else
SD_PlaySound (DONOTHINGSND);

}

Step 5. Save the file and Compile. Now you can use long elevator sounds(the Lost Episodes' elevator sound works fine!)

Get back to the Dome tutorials
Jump to the top