Overlord sound player (#1239)

* Accept player RPC commands in overlord

* Remove the .projectile file

I use emacs for everything so I don't want it to only look at the goal code.

* Fill out most of the unique player structs

* Decompile most of ssound.c

* Silence some spam

* Comment out WaitSema instance

* Add a file with definitions for snd_ functions

Makes it compile without commenting them out.

Maybe it'd be nice to maintain the original API usage in overlord for
similarity and shim them to whatever API the player uses.

* Make SoundBank statically sized again.

Didn't realise this was used in an array. MSVC should be happy again.

Not sure what the actual size of these should be.

* Fix logic issue

* Finish RPC Loader

* More RPC_Player

* Play RPC command

* All the RPC commands added

* Call Music/Bank loaders

* audio: add almost all `.MUS` and `.SBK` files to build process

* Include TWEAKVAL in build output

* Load banks and music tweaks

* Comment out spam

* Sound struct unk -> is music

* Also test if empty1.sbk was found

For the sake of tests.

* Get rid of PC_DEBUG_SOUND_ENABLE

Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
This commit is contained in:
Ziemas 2022-03-22 23:53:36 +01:00 committed by GitHub
parent a0c7f072ce
commit 766b328c97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 1385 additions and 146 deletions

View File

@ -1 +0,0 @@
+/goal_src

View File

@ -69,6 +69,7 @@ set(RUNTIME_SOURCE
overlord/overlord.cpp
overlord/ramdisk.cpp
overlord/sbank.cpp
overlord/sndshim.cpp
overlord/soundcommon.cpp
overlord/srpc.cpp
overlord/ssound.cpp

View File

@ -12,6 +12,10 @@
#include <cstring>
#include <filesystem>
#include "fake_iso.h"
#include "game/overlord/sbank.h"
#include "game/overlord/sndshim.h"
#include "game/overlord/soundcommon.h"
#include "game/overlord/srpc.h"
#include "game/sce/iop.h"
#include "isocommon.h"
#include "overlord.h"
@ -49,6 +53,7 @@ static uint32_t FS_SyncRead();
static uint32_t FS_LoadSoundBank(char*, void*);
static uint32_t FS_LoadMusic(char*, void*);
static void FS_PollDrive();
static void LoadMusicTweaks();
void fake_iso_init_globals() {
// init file lists
@ -101,7 +106,7 @@ int FS_Init(u8* buffer) {
sFiles[i].location = i;
}
// TODO load tweak music.
LoadMusicTweaks();
return 0;
}
@ -296,18 +301,62 @@ uint32_t FS_SyncRead() {
*/
void FS_PollDrive() {}
// TODO FS_LoadMusic
uint32_t FS_LoadMusic(char* name, void* buffer) {
(void)name;
(void)buffer;
ASSERT(false);
s32* bank_handle = (s32*)buffer;
char namebuf[16];
strcpy(namebuf, name);
namebuf[8] = 0;
strcat(namebuf, ".mus");
auto file = FS_Find(namebuf);
if (!file)
return CMD_STATUS_FAILED_TO_OPEN;
*bank_handle = snd_BankLoadEx(get_file_path(file), 0, 0, 0);
snd_ResolveBankXREFS();
return 0;
}
// TODO FS_LoadSoundBank
uint32_t FS_LoadSoundBank(char* name, void* buffer) {
(void)name;
(void)buffer;
ASSERT(false);
SoundBank* bank = (SoundBank*)buffer;
char namebuf[16];
int offset = 10 * 2048;
if (bank->sound_count == 101) {
offset = 1 * 2048;
}
strcpy(namebuf, name);
namebuf[8] = 0;
strcat(namebuf, ".sbk");
auto file = FS_Find(namebuf);
if (!file) {
file = FS_Find("empty1.sbk");
if (!file) // Might have no files when running tests.
return 0;
}
auto fp = fopen(get_file_path(file), "rb");
fread(buffer, offset, 1, fp);
fclose(fp);
s32 handle = snd_BankLoadEx(get_file_path(file), offset, 0, 0);
snd_ResolveBankXREFS();
PrintBankInfo(bank);
bank->bank_handle = handle;
return 0;
}
void LoadMusicTweaks() {
char tweakname[16];
MakeISOName(tweakname, "TWEAKVAL.MUS");
auto file = FS_FindIN(tweakname);
if (file) {
auto fp = fopen(get_file_path(file), "rb");
fread(&gMusicTweakInfo, sizeof(gMusicTweakInfo), 1, fp);
fclose(fp);
} else {
gMusicTweakInfo.TweakCount = 0;
}
}

View File

@ -368,9 +368,25 @@ u32 ISOThread() {
// no buffers, try again.
SendMbx(iso_mbx, msg_from_mbx);
} else {
// todo - actual load here
auto* cmd = (SoundBankLoadCommand*)msg_from_mbx;
printf("Ignoring request to load sound bank %s\n", cmd->bank_name);
isofs->load_sound_bank(cmd->bank_name, cmd->bank);
FreeBuffer(buff);
ReturnMessage(msg_from_mbx);
}
} else {
// just try again...
SendMbx(iso_mbx, msg_from_mbx);
}
} else if (msg_from_mbx->cmd_id == LOAD_MUSIC) {
// if there's an in progress vag command, try again.
if (!in_progress_vag_command || !in_progress_vag_command->field_0x3c) {
auto buff = TryAllocateBuffer(BUFFER_PAGE_SIZE);
if (!buff) {
// no buffers, try again.
SendMbx(iso_mbx, msg_from_mbx);
} else {
auto* cmd = (MusicLoadCommand*)msg_from_mbx;
isofs->load_music(cmd->music_name, cmd->music_handle);
FreeBuffer(buff);
ReturnMessage(msg_from_mbx);
}

View File

@ -1,4 +1,5 @@
#include "iso_api.h"
#include "game/overlord/srpc.h"
#include "game/sce/iop.h"
#include "common/log/log.h"
#include "sbank.h"
@ -84,3 +85,24 @@ void LoadSoundBank(const char* bank_name, SoundBank* bank) {
SendMbx(iso_mbx, &cmd);
SleepThread(); // wait for finish.
}
void LoadMusic(const char* music_name, s32* bank) {
ASSERT(strlen(music_name) < 16);
MusicLoadCommand cmd;
cmd.cmd_id = LOAD_MUSIC;
cmd.messagebox_to_reply = 0;
cmd.thread_id = GetThreadId();
strcpy(cmd.music_name, music_name);
cmd.music_handle = bank;
SendMbx(iso_mbx, &cmd);
SleepThread();
for (int i = 0; i < gMusicTweakInfo.TweakCount; i++) {
if (!strcmp(gMusicTweakInfo.MusicTweak[i].MusicName, music_name)) {
gMusicTweak = gMusicTweakInfo.MusicTweak[i].VolumeAdjust;
return;
}
}
gMusicTweak = 0x80;
}

View File

@ -7,4 +7,5 @@ struct SoundBank;
s32 LoadISOFileToIOP(FileRecord* file, void* addr, uint32_t length);
s32 LoadISOFileToEE(FileRecord* file, uint32_t ee_addr, uint32_t length);
s32 LoadISOFileChunkToEE(FileRecord* file, uint32_t dest_addr, uint32_t length, uint32_t offset);
void LoadSoundBank(const char* bank_name, SoundBank* bank);
void LoadSoundBank(const char* bank_name, SoundBank* bank);
void LoadMusic(const char* music_name, s32* bank);

View File

@ -909,7 +909,7 @@ uint32_t FS_LoadSoundBank(char* name, void* buffer) {
}
snd_ResolveBankXREFS();
PrintBankInfo(buffer);
PrintBankInfo((SoundBank*)buffer);
_sector = 0;
// ??? todo this is probably a field of the buffer.
*(s32*)(((u8*)buffer) + 0x10) = load_status;

View File

@ -31,6 +31,7 @@ constexpr int LOAD_TO_IOP_CMD_ID = 0x101; // command to load to iop
constexpr int LOAD_TO_EE_OFFSET_CMD_ID = 0x102; // command to load file to ee with offset.
constexpr int LOAD_DGO_CMD_ID = 0x200; // command to load DGO
constexpr int LOAD_SOUND_BANK = 0x300; // Command to load a sound bank
constexpr int LOAD_MUSIC = 0x380; // Command to load music
constexpr int MAX_ISO_FILES = 350; // maximum files on FS
constexpr int MAX_OPEN_FILES = 16; // maximum number of open files at a time.
@ -125,6 +126,11 @@ struct SoundBankLoadCommand : public IsoMessage {
SoundBank* bank;
};
struct MusicLoadCommand : public IsoMessage {
char music_name[16];
s32* music_handle;
};
/*!
* DGO Load State Machine states.
*/

View File

@ -21,7 +21,7 @@ int start_overlord(int argc, const char* const* argv) {
InitBanks();
InitSound_Overlord();
InitRamdisk();
// RegisterVblankHandler(0, 0x20, VBlank_Handler, nullptr);
// RegisterVblankHandler(0, 0x20, VBlank_Handler, nullptr);
ThreadParam thread_param;
thread_param.attr = TH_C;
@ -35,16 +35,17 @@ int start_overlord(int argc, const char* const* argv) {
return 1;
}
// thread_param.attr = TH_C;
// thread_param.initPriority = 96;
// thread_param.stackSize = 0x800;
// thread_param.option = 0;
// thread_param.entry = Thread_Player;
// auto thread_player = CreateThread(&thread_param);
// if(thread_player <= 0) {
// return 1;
// }
//
thread_param.attr = TH_C;
thread_param.initPriority = 96;
thread_param.stackSize = 0x800;
thread_param.option = 0;
thread_param.entry = (void*)Thread_Player;
strcpy(thread_param.name, "Player"); // added
auto thread_player = CreateThread(&thread_param);
if (thread_player <= 0) {
return 1;
}
thread_param.attr = TH_C;
thread_param.initPriority = 99;
thread_param.stackSize = 0x1000;
@ -59,7 +60,7 @@ int start_overlord(int argc, const char* const* argv) {
InitISOFS(argv[1], argv[2]);
StartThread(thread_server, 0);
// StartThread(thread_player, 0);
StartThread(thread_player, 0);
StartThread(thread_loader, 0);
return 0;
}
@ -70,4 +71,4 @@ int start_overlord(int argc, const char* const* argv) {
void ExitIOP() {
while (true) {
}
}
}

View File

@ -1,5 +1,6 @@
#include <cstring>
#include "sbank.h"
#include "soundcommon.h"
constexpr int N_BANKS = 3;
SoundBank* gBanks[N_BANKS];
@ -16,8 +17,8 @@ void sbank_init_globals() {
void InitBanks() {
for (auto& gBank : gBanks) {
gBank->unk1 = 0;
gBank->unk2 = 0;
gBank->bank_handle = 0;
gBank->sound_count = 0;
strcpy(gBank->name, "<unused>");
}
}
@ -30,21 +31,47 @@ SoundBank* AllocateBank() {
return nullptr;
}
if (gBanks[idx]->unk1 == 0) {
if (gBanks[idx]->bank_handle == 0) {
break;
}
idx++;
}
// Funny hack: The loader will read this out of the destination buffer in order to determine how
// many sectors of sound name mapping it needs to read.
if (idx == 0) {
gBanks[0]->unk2 = 0x3fe; // ??
gBanks[0]->sound_count = 0x3fe;
} else {
gBanks[idx]->unk2 = 0x65; // ??
gBanks[idx]->sound_count = 0x65;
}
return gBanks[idx];
}
s32 LookupSoundIndex(const char* name, SoundBank** bank_out) {
int idx = 0;
while (true) {
if (idx > N_BANKS - 1) {
return -1;
}
auto& bank = gBanks[idx];
if (bank->bank_handle == 0) {
break;
}
for (int i = 0; i < bank->sound_count; i++) {
if (memcmp(bank->name, name, 16) == 0) {
*bank_out = bank;
return i;
}
}
idx++;
}
return -1;
}
// name should be a 16-byte "sound name"
SoundBank* LookupBank(const char* name) {
int idx = N_BANKS - 1;
@ -60,4 +87,12 @@ SoundBank* LookupBank(const char* name) {
}
idx--;
}
}
}
void ReloadBankInfo() {
for (auto& b : gBanks) {
if (b->bank_handle) {
ReadBankSoundInfo(b, b, 1);
}
}
}

View File

@ -2,15 +2,27 @@
#include "common/common_types.h"
struct SoundRecord {
char name[16];
u32 fallof_params;
};
struct SoundBank {
char name[16];
u32 unk1; // maybe status?
u32 unk2; // maybe size
u32 bank_handle;
u32 sound_count;
union {
SoundRecord sound[1];
// Needs to fit the biggest bank (common.sbk)
u8 buffer[10 * 2048];
};
};
void sbank_init_globals();
void InitBanks();
void ReloadBankInfo();
SoundBank* AllocateBank();
SoundBank* LookupBank(const char* name);
s32 LookupSoundIndex(const char* name, SoundBank** bank_out);
SoundBank* LookupBank(const char* name);

101
game/overlord/sndshim.cpp Normal file
View File

@ -0,0 +1,101 @@
#include "sndshim.h"
#include <cstdio>
void snd_StartSoundSystem() {
// printf("snd_StartSoundSystem\n");
}
void snd_StopSoundSystem() {
// printf("snd_StopSoundSystem\n");
}
void snd_RegisterIOPMemAllocator(AllocFun, FreeFun) {
// printf("snd_RegisterIOPMemAllocator\n");
}
void snd_LockVoiceAllocator(s32) {
// printf("snd_LockVoiceAllocator\n");
}
void snd_UnlockVoiceAllocator() {
// printf("snd_UnlockVoiceAllocator\n");
}
s32 snd_ExternVoiceVoiceAlloc(s32, s32) {
// printf("snd_ExternVoiceVoiceAlloc\n");
return 0;
}
u32 snd_SRAMMalloc(u32) {
// printf("snd_SRAMMalloc\n");
return 0;
}
void snd_SetMixerMode(s32, s32) {
// printf("snd_SetMixerMode\n");
}
void snd_SetGroupVoiceRange(s32, s32, s32) {
// printf("snd_SetGroupVoiceRange\n");
}
void snd_SetReverbDepth(s32, s32, s32) {
// printf("snd_SetReverbDepth\n");
}
void snd_SetReverbType(s32, s32) {
// printf("snd_SetReverbType\n");
}
void snd_SetPanTable(s16*) {
// printf("snd_SetPanTable\n");
}
void snd_SetPlayBackMode(s32) {
// printf("snd_SetPlayBackMode\n");
}
s32 snd_SoundIsStillPlaying(s32) {
// printf("snd_SoundIsStillPlaying\n");
return 0;
}
void snd_StopSound(s32) {
// printf("snd_StopSound\n");
}
void snd_SetSoundVolPan(s32, s32, s32) {
// printf("snd_SetSoundVolPan\n");
}
void snd_SetMasterVolume(s32, s32) {
// printf("snd_SetMasterVolume\n");
}
void snd_UnloadBank(s32) {
// printf("snd_UnloadBank\n");
}
void snd_ResolveBankXREFS() {
// printf("snd_ResolveBankXREFS\n");
}
void snd_ContinueAllSoundsInGroup(u8) {
// printf("snd_ContinueAllSoundsInGroup\n");
}
void snd_PauseAllSoundsInGroup(u8) {
// printf("snd_PauseAllSoundsInGroup\n");
}
void snd_SetMIDIRegister(s32, u8, u8) {
// printf("snd_SetMIDIRegister\n");
}
s32 snd_PlaySoundVolPanPMPB(s32, s32, s32, s32, s32, s32) {
// printf("snd_PlaySoundVolPanPMPB\n");
return 0;
}
void snd_SetSoundPitchModifier(s32, s32) {
// printf("snd_SetSoundPitchModifier\n");
}
void snd_SetSoundPitchBend(s32, s32) {
// printf("snd_SetSoundPitchBend\n");
}
void snd_PauseSound(s32) {
// printf("snd_PauseSound\n");
}
void snd_ContinueSound(s32) {
// printf("snd_ContinueSound\n");
}
void snd_AutoPitch(s32, s32, s32, s32) {
// printf("snd_AutoPitch\n");
}
void snd_AutoPitchBend(s32, s32, s32, s32) {
// printf("snd_AutoPitchBend\n");
}
s32 snd_BankLoadEx(const char*, s32, s32, s32) {
// printf("snd_BankLoadEx\n");
return 0;
}

40
game/overlord/sndshim.h Normal file
View File

@ -0,0 +1,40 @@
#ifndef SNDSHIM_H_
#define SNDSHIM_H_
#pragma once
#include "common/common_types.h"
typedef void* (*AllocFun)();
typedef void (*FreeFun)(void*);
void snd_StartSoundSystem();
void snd_StopSoundSystem();
void snd_RegisterIOPMemAllocator(AllocFun, FreeFun);
void snd_LockVoiceAllocator(s32);
void snd_UnlockVoiceAllocator();
s32 snd_ExternVoiceVoiceAlloc(s32, s32);
u32 snd_SRAMMalloc(u32);
void snd_SetMixerMode(s32, s32);
void snd_SetGroupVoiceRange(s32, s32, s32);
void snd_SetReverbDepth(s32, s32, s32);
void snd_SetReverbType(s32, s32);
void snd_SetPanTable(s16*);
void snd_SetPlayBackMode(s32);
s32 snd_SoundIsStillPlaying(s32);
void snd_StopSound(s32);
void snd_SetSoundVolPan(s32, s32, s32);
void snd_SetMasterVolume(s32, s32);
void snd_UnloadBank(s32);
void snd_ResolveBankXREFS();
void snd_ContinueAllSoundsInGroup(u8);
void snd_PauseAllSoundsInGroup(u8);
void snd_SetMIDIRegister(s32, u8, u8);
s32 snd_PlaySoundVolPanPMPB(s32, s32, s32, s32, s32, s32);
void snd_SetSoundPitchModifier(s32, s32);
void snd_SetSoundPitchBend(s32, s32);
void snd_PauseSound(s32);
void snd_ContinueSound(s32);
void snd_AutoPitch(s32, s32, s32, s32);
void snd_AutoPitchBend(s32, s32, s32, s32);
s32 snd_BankLoadEx(const char* filepath, s32 data_offset, s32 unk1, s32 unk2);
#endif // SNDSHIM_H_

View File

@ -1,7 +1,23 @@
#include "soundcommon.h"
#include <cstdio>
#include "common/util/Assert.h"
void PrintBankInfo(void* buffer) {
(void)buffer;
// TODO strcpy_toupper
// TODO atoi
// TODO ReadBankSoundNames
void ReadBankSoundInfo(SoundBank* bank, SoundBank* unk, s32 unk2) {
(void)bank;
(void)unk;
(void)unk2;
ASSERT(false);
}
void PrintBankInfo(SoundBank* bank) {
printf("Bank %s\n\n", bank->name);
for (int i = 0; i < bank->sound_count; i++) {
printf("%d : %16s : min %d max %d curve %d\n", i, bank->sound[i].name,
bank->sound[i].fallof_params & 0x3fff, (bank->sound[i].fallof_params >> 14) & 0x3fff,
bank->sound[i].fallof_params >> 28);
}
}

View File

@ -2,7 +2,10 @@
#ifndef JAK_V2_SOUNDCOMMON_H
#define JAK_V2_SOUNDCOMMON_H
#include "common/common_types.h"
#include "game/overlord/sbank.h"
void PrintBankInfo(void* buffer);
void PrintBankInfo(SoundBank* buffer);
void ReadBankSoundInfo(SoundBank* bank, SoundBank* unk, s32 unk2);
#endif // JAK_V2_SOUNDCOMMON_H

View File

@ -1,8 +1,10 @@
#include <cstring>
#include <cstdio>
#include "game/overlord/sndshim.h"
#include "srpc.h"
#include "game/sce/iop.h"
#include "game/common/loader_rpc_types.h"
#include "game/common/player_rpc_types.h"
#include "game/common/game_common_types.h"
#include "common/versions.h"
#include "sbank.h"
@ -13,9 +15,17 @@ using namespace iop;
MusicTweaks gMusicTweakInfo;
constexpr int SRPC_MESSAGE_SIZE = 0x50;
uint8_t gLoaderBuf[SRPC_MESSAGE_SIZE];
static uint8_t gLoaderBuf[SRPC_MESSAGE_SIZE];
static uint8_t gPlayerBuf[SRPC_MESSAGE_SIZE * 127];
int32_t gSoundEnable = 1;
u32 gInfoEE = 0; // EE address where we should send info on each frame.
static u32 gInfoEE = 0; // EE address where we should send info on each frame.
s16 gFlava;
static s32 gMusic;
s32 gMusicTweak = 0x80;
s32 gMusicPause = 0;
u32 gFreeMem = 0;
s32 gVAG_Id = 0; // TODO probably doesn't belong here.
// english, french, germain, spanish, italian, japanese, uk.
static const char* languages[] = {"ENG", "FRE", "GER", "SPA", "ITA", "JAP", "UKE"};
@ -24,12 +34,27 @@ const char* gLanguage = nullptr;
void srpc_init_globals() {
memset((void*)&gMusicTweakInfo, 0, sizeof(gMusicTweakInfo));
memset((void*)gLoaderBuf, 0, sizeof(gLoaderBuf));
memset((void*)gPlayerBuf, 0, sizeof(gPlayerBuf));
gSoundEnable = 1;
gInfoEE = 0;
gLanguage = languages[(int)Language::English];
}
// todo Thread_Player
void* RPC_Player(unsigned int fno, void* data, int size);
u32 Thread_Player() {
sceSifQueueData dq;
sceSifServeData serve;
// set up RPC
CpuDisableIntr();
sceSifInitRpc(0);
sceSifSetRpcQueue(&dq, GetThreadId());
sceSifRegisterRpc(&serve, PLAYER_RPC_ID, RPC_Player, gPlayerBuf, nullptr, nullptr, &dq);
CpuEnableIntr();
sceSifRpcLoop(&dq);
return 0;
}
void* RPC_Loader(unsigned int fno, void* data, int size);
@ -47,7 +72,266 @@ u32 Thread_Loader() {
return 0;
}
// todo RPC_Player
void* RPC_Player(unsigned int /*fno*/, void* data, int size) {
if (gSoundEnable) {
gFreeMem = QueryTotalFreeMemSize();
// if (!PollSema(gSema)) {
if (gMusic) {
if (!gMusicPause && !LookupSound(666)) {
Sound* music = AllocateSound();
if (music != nullptr) {
gMusicFade = 0;
gMusicFadeDir = 1;
SetMusicVol();
music->sound_handle = snd_PlaySoundVolPanPMPB(gMusic, 0, 0x400, -1, 0, 0);
music->id = 666;
music->is_music = 1;
}
}
}
//}
SetMusicVol();
Sound* music = LookupSound(666);
if (music != nullptr) {
snd_SetSoundVolPan(music->sound_handle, 0x7FFFFFFF, 0);
snd_SetMIDIRegister(music->sound_handle, 0, gFlava);
}
int n_messages = size / SRPC_MESSAGE_SIZE;
SoundRpcCommand* cmd = (SoundRpcCommand*)(data);
while (n_messages > 0) {
switch (cmd->command) {
case SoundCommand::PLAY: {
// spool- soundsn are vag sounds?
if (!memcmp(cmd->play.name, "spool-", 6)) {
char namebuf[8];
char langbuf[8];
auto name = cmd->play.name;
size_t len = strlen(name);
if (len < 9) {
memset(namebuf, 32, sizeof(namebuf));
memcpy(namebuf, name, len);
} else {
memcpy(namebuf, name, sizeof(namebuf));
}
for (int i = 0; i < 8; i++) {
if (namebuf[i] >= 0x61 && namebuf[i] < 0x7b) {
namebuf[i] -= 0x20;
}
}
// TODO vagfile = FindVAGFile(namebuf);
void* vagfile = nullptr;
memcpy(namebuf, "VAGWAD ", sizeof(namebuf));
strcpy(langbuf, gLanguage);
FileRecord* rec = isofs->find_in(namebuf);
if (vagfile != nullptr) {
if (cmd->play.parms.pitch_mod) { // ??? TODO Verify what is being checked here
// PlayVagStream(rec, vagfile, cmd->play.sound_id, cmd->play.parms.volume, 0,
// cmd->play.parms.trans);
} else {
// PlayVagStream(rec, vagfile, cmd->play.sound_id, cmd->play.parms.volume, 0, 0);
}
}
break;
}
SoundBank* bank = nullptr;
s32 index = LookupSoundIndex(cmd->play.name, &bank);
if (index < 0) {
break;
}
Sound* sound = LookupSound(cmd->play.sound_id);
if (sound) {
memcpy(&sound->params, &cmd->play.parms, sizeof(sound->params));
sound->bank_entry = &bank->sound[index];
sound->is_music = 0;
if ((sound->params.mask & 0x40) == 0) {
sound->params.fo_min = sound->bank_entry->fallof_params & 0x3fff;
}
if ((sound->params.mask & 0x80) == 0) {
sound->params.fo_max = (sound->bank_entry->fallof_params >> 14) & 0x3fff;
}
if ((sound->params.mask & 0x100) == 0) {
sound->params.fo_curve = sound->bank_entry->fallof_params >> 28;
}
UpdateVolume(sound);
snd_SetSoundPitchModifier(sound->sound_handle, cmd->play.parms.pitch_mod);
snd_SetSoundPitchBend(sound->sound_handle, cmd->play.parms.bend);
break;
}
sound = AllocateSound();
if (!sound) {
break;
}
memcpy(&sound->params, &cmd->play.parms, sizeof(sound->params));
sound->bank_entry = &bank->sound[index];
sound->is_music = 0;
sound->auto_time = 0;
if ((sound->params.mask & 0x40) == 0) {
sound->params.fo_min = sound->bank_entry->fallof_params & 0x3fff;
}
if ((sound->params.mask & 0x80) == 0) {
sound->params.fo_max = (sound->bank_entry->fallof_params >> 14) & 0x3fff;
}
if ((sound->params.mask & 0x100) == 0) {
sound->params.fo_curve = sound->bank_entry->fallof_params >> 28;
}
s32 vol = GetVolume(sound);
s32 pan = GetPan(sound);
s32 handle = snd_PlaySoundVolPanPMPB(bank->bank_handle, index, vol, pan,
sound->params.pitch_mod, sound->params.bend);
sound->sound_handle = handle;
if (sound->sound_handle) {
sound->id = index;
}
} break;
case SoundCommand::PAUSE_SOUND: {
Sound* sound = LookupSound(cmd->sound_id.sound_id);
if (sound != nullptr) {
snd_PauseSound(sound->sound_handle);
} else if (cmd->sound_id.sound_id == gVAG_Id) {
// TODO PauseVAGStream();
}
} break;
case SoundCommand::STOP_SOUND: {
Sound* sound = LookupSound(cmd->sound_id.sound_id);
if (sound != nullptr) {
snd_StopSound(sound->sound_handle);
} else if (cmd->sound_id.sound_id == gVAG_Id) {
// TODO StopVAGStream();
}
} break;
case SoundCommand::CONTINUE_SOUND: {
Sound* sound = LookupSound(cmd->sound_id.sound_id);
if (sound != nullptr) {
snd_ContinueSound(sound->sound_handle);
} else if (cmd->sound_id.sound_id == gVAG_Id) {
// TODO UNpauseVAGStream();
}
} break;
case SoundCommand::SET_PARAM: {
Sound* sound = LookupSound(cmd->sound_id.sound_id);
u32 mask = cmd->param.parms.mask;
if (sound != nullptr) {
if (mask & 1) {
if (mask & 0x20) {
sound->auto_time = cmd->param.auto_time;
sound->new_volume = cmd->param.parms.volume;
} else {
sound->params.volume = cmd->param.parms.volume;
}
}
if (mask & 0x20) {
sound->params.trans = cmd->param.parms.trans;
}
if (mask & 0x21) {
UpdateVolume(sound);
}
if (mask & 2) {
sound->params.pitch_mod = cmd->param.parms.pitch_mod;
if (mask & 0x10) {
snd_AutoPitch(sound->sound_handle, sound->params.pitch_mod, cmd->param.auto_time,
cmd->param.auto_time);
} else {
snd_SetSoundPitchModifier(sound->sound_handle, cmd->param.parms.pitch_mod);
}
}
if (mask & 4) {
sound->params.bend = cmd->param.parms.bend;
if (mask & 0x10) {
snd_AutoPitchBend(sound->sound_handle, sound->params.bend, cmd->param.auto_time,
cmd->param.auto_time);
} else {
snd_SetSoundPitchBend(sound->sound_handle, cmd->param.parms.bend);
}
}
} else if (cmd->sound_id.sound_id == gVAG_Id) {
// TODO SetVAGStreamVolume();
}
} break;
case SoundCommand::SET_MASTER_VOLUME: {
u32 group = cmd->master_volume.group.group;
for (int i = 0; i < 32; i++) {
if (((group >> i) & 1) != 0) {
if (i == 1) {
gMusicVol = cmd->master_volume.volume;
} else if (i == 2) {
// TODO SetDialogVolume(cmd->master_volume.volume);
} else {
snd_SetMasterVolume(i, cmd->master_volume.volume);
}
}
}
} break;
case SoundCommand::PAUSE_GROUP: {
snd_PauseAllSoundsInGroup(cmd->group.group);
if ((cmd->group.group & 4) != 0) {
// TODO PauseVAGStream(0,0);
}
if (cmd->group.group & 2) {
gMusicPause = 1;
}
} break;
case SoundCommand::STOP_GROUP: {
u8 group = cmd->group.group;
KillSoundsInGroup(group);
if ((group & 4) != 0) {
// TODO StopVAGStream(0,0);
}
} break;
case SoundCommand::CONTINUE_GROUP: {
snd_ContinueAllSoundsInGroup(cmd->group.group);
if (cmd->group.group & 4) {
// UnpauseVAGStream();
}
if (cmd->group.group & 2) {
gMusicPause = 0;
}
} break;
case SoundCommand::SET_FALLOFF_CURVE: {
SetCurve(cmd->fallof_curve.curve, cmd->fallof_curve.falloff, cmd->fallof_curve.ease);
} break;
case SoundCommand::SET_SOUND_FALLOFF: {
SoundBank* bank;
s32 idx = LookupSoundIndex(cmd->fallof.name, &bank);
if (idx >= 0) {
bank->sound[idx].fallof_params =
(cmd->fallof.curve << 28) | (cmd->fallof.max << 14) | cmd->fallof.min;
}
} break;
case SoundCommand::SET_FLAVA: {
gFlava = cmd->flava.flava;
} break;
case SoundCommand::SET_EAR_TRANS: {
SetEarTrans(&cmd->ear_trans.ear_trans, &cmd->ear_trans.cam_trans,
cmd->ear_trans.cam_angle);
} break;
case SoundCommand::SHUTDOWN: {
gSoundEnable = 0;
snd_StopSoundSystem();
// TODO ShutdownFilingSystem();
} break;
default: {
printf("Unhandled RPC Player command %d\n", (int)cmd->command);
ASSERT(false);
} break;
}
n_messages--;
cmd++;
}
}
return nullptr;
}
void* RPC_Loader(unsigned int /*fno*/, void* data, int size) {
int n_messages = size / SRPC_MESSAGE_SIZE;
@ -71,26 +355,60 @@ void* RPC_Loader(unsigned int /*fno*/, void* data, int size) {
}
}
} break;
case SoundCommand::UNLOAD_BANK:
printf("ignoring unload bank command!\n");
break;
case SoundCommand::UNLOAD_BANK: {
SoundBank* bank = LookupBank(cmd->load_bank.bank_name);
if (bank != nullptr) {
s32 id = bank->bank_handle;
bank->bank_handle = 0;
snd_UnloadBank(id);
snd_ResolveBankXREFS();
}
} break;
case SoundCommand::GET_IRX_VERSION: {
cmd->irx_version.major = IRX_VERSION_MAJOR;
cmd->irx_version.minor = IRX_VERSION_MINOR;
gInfoEE = cmd->irx_version.ee_addr;
return cmd;
} break;
case SoundCommand::RELOAD_INFO: {
ReloadBankInfo();
} break;
case SoundCommand::SET_LANGUAGE: {
gLanguage = languages[cmd->set_language.langauge_id];
printf("IOP language: %s\n", gLanguage); // added.
break;
}
case SoundCommand::LOAD_MUSIC:
printf("ignoring load music\n");
break;
case SoundCommand::UNLOAD_MUSIC:
printf("ignoring unload music\n");
break;
} break;
case SoundCommand::LOAD_MUSIC: {
// while (WaitSema(gSema))
// ;
if (gMusic) {
gMusicFadeDir = -1;
while (gMusicFade) {
DelayThread(1000);
}
snd_UnloadBank(gMusic);
snd_ResolveBankXREFS();
gMusic = 0;
}
LoadMusic(cmd->load_bank.bank_name, &gMusic);
// SignalSema(gSema);
} break;
case SoundCommand::LIST_SOUNDS: {
PrintActiveSounds();
} break;
case SoundCommand::UNLOAD_MUSIC: {
// while (WaitSema(gSema))
// ;
if (gMusic) {
gMusicFadeDir = -1;
while (gMusicFade) {
DelayThread(1000);
}
snd_UnloadBank(gMusic);
snd_ResolveBankXREFS();
gMusic = 0;
}
// SignalSema(gSema);
} break;
default:
printf("Unhandled RPC Loader command %d\n", (int)cmd->command);
ASSERT(false);
@ -101,3 +419,7 @@ void* RPC_Loader(unsigned int /*fno*/, void* data, int size) {
}
return nullptr;
}
s32 VBlank_Handler() {
return 1;
}

View File

@ -1,5 +1,6 @@
#pragma once
#include "ssound.h"
#include "common/common_types.h"
void srpc_init_globals();
@ -11,7 +12,7 @@ struct MusicTweaks {
struct {
char MusicName[12];
u32 VolumeAdjust;
s32 VolumeAdjust;
} MusicTweak[MUSIC_TWEAK_COUNT];
};
@ -56,6 +57,68 @@ struct SoundRpcSetLanguageCommand {
u32 langauge_id; // game_common_types.h, Language
};
struct SoundRpcPlayCommand {
u32 sound_id;
u32 pad[2];
char name[16];
SoundParams parms;
};
struct SoundRpcSetParamCommand {
u32 sound_id;
SoundParams parms;
s32 auto_time;
s32 auto_from;
};
struct SoundRpcSoundIdCommand {
u32 sound_id;
};
struct SoundRpcSetFlavaCommand {
u8 flava;
};
struct SoundRpcSetReverb {
u8 core;
s32 reverb;
u32 left;
u32 right;
};
struct SoundRpcSetEarTrans {
Vec3w ear_trans;
Vec3w cam_trans;
s32 cam_angle;
};
struct SoundRpcSetFPSCommand {
u8 fps;
};
struct SoundRpcSetFallof {
u8 pad[12];
char name[16];
s32 curve;
s32 min;
s32 max;
};
struct SoundRpcSetFallofCurve {
s32 curve;
s32 falloff;
s32 ease;
};
struct SoundRpcGroupCommand {
u8 group;
};
struct SoundRpcMasterVolCommand {
SoundRpcGroupCommand group;
s32 volume;
};
struct SoundRpcCommand {
u16 rsvd1;
SoundCommand command;
@ -63,9 +126,27 @@ struct SoundRpcCommand {
SoundRpcGetIrxVersion irx_version;
SoundRpcBankCommand load_bank;
SoundRpcSetLanguageCommand set_language;
SoundRpcPlayCommand play;
SoundRpcSoundIdCommand sound_id;
SoundRpcSetFPSCommand fps;
SoundRpcSetEarTrans ear_trans;
SoundRpcSetReverb reverb;
SoundRpcSetFallof fallof;
SoundRpcSetFallofCurve fallof_curve;
SoundRpcGroupCommand group;
SoundRpcSetFlavaCommand flava;
SoundRpcMasterVolCommand master_volume;
SoundRpcSetParamCommand param;
u8 max_size[0x4C]; // Temporary
};
};
extern MusicTweaks gMusicTweakInfo;
static_assert(sizeof(SoundRpcCommand) == 0x50);
u32 Thread_Loader();
extern MusicTweaks gMusicTweakInfo;
extern s32 gMusicTweak;
u32 Thread_Loader();
u32 Thread_Player();
s32 VBlank_Handler();

View File

@ -1,3 +1,491 @@
#include <cstdio>
#include <cstring>
#include "game/overlord/srpc.h"
#include "ssound.h"
#include "common/util/Assert.h"
#include "sndshim.h"
void InitSound_Overlord() {}
using namespace iop;
Sound gSounds[64];
Curve gCurve[8]; // TODO verify count
VolumePair gPanTable[361];
Vec3w gEarTrans;
Vec3w gCamTrans;
s32 gCamAngle;
s32 gMusicVol = 0x400;
s32 gMusicFade = 0;
s32 gMusicFadeDir = 0;
u32 gVoice;
u32 gStreamSRAM;
s32 gSema;
static u32 sLastTick;
static s32 sqrt_table[256] = {
0, 4096, 5793, 7094, 8192, 9159, 10033, 10837, 11585, 12288, 12953, 13585, 14189,
14768, 15326, 15864, 16384, 16888, 17378, 17854, 18318, 18770, 19212, 19644, 20066, 20480,
20886, 21283, 21674, 22058, 22435, 22806, 23170, 23530, 23884, 24232, 24576, 24915, 25249,
25580, 25905, 26227, 26545, 26859, 27170, 27477, 27780, 28081, 28378, 28672, 28963, 29251,
29537, 29819, 30099, 30377, 30652, 30924, 31194, 31462, 31727, 31991, 32252, 32511, 32768,
33023, 33276, 33527, 33776, 34024, 34270, 34514, 34756, 34996, 35235, 35472, 35708, 35942,
36175, 36406, 36636, 36864, 37091, 37316, 37540, 37763, 37985, 38205, 38424, 38642, 38858,
39073, 39287, 39500, 39712, 39923, 40132, 40341, 40548, 40755, 40960, 41164, 41368, 41570,
41771, 41972, 42171, 42369, 42567, 42763, 42959, 43154, 43348, 43541, 43733, 43925, 44115,
44305, 44494, 44682, 44869, 45056, 45242, 45427, 45611, 45795, 45977, 46160, 46341, 46522,
46702, 46881, 47059, 47237, 47415, 47591, 47767, 47942, 48117, 48291, 48465, 48637, 48809,
48981, 49152, 49322, 49492, 49661, 49830, 49998, 50166, 50332, 50499, 50665, 50830, 50995,
51159, 51323, 51486, 51649, 51811, 51972, 52134, 52294, 52454, 52614, 52773, 52932, 53090,
53248, 53405, 53562, 53719, 53874, 54030, 54185, 54340, 54494, 54647, 54801, 54954, 55106,
55258, 55410, 55561, 55712, 55862, 56012, 56162, 56311, 56459, 56608, 56756, 56903, 57051,
57198, 57344, 57490, 57636, 57781, 57926, 58071, 58215, 58359, 58503, 58646, 58789, 58931,
59073, 59215, 59357, 59498, 59639, 59779, 59919, 60059, 60199, 60338, 60477, 60615, 60753,
60891, 61029, 61166, 61303, 61440, 61576, 61712, 61848, 61984, 62119, 62254, 62388, 62523,
62657, 62790, 62924, 63057, 63190, 63323, 63455, 63587, 63719, 63850, 63982, 64113, 64243,
64374, 64504, 64634, 64763, 64893, 65022, 65151, 65279, 65408,
};
static s32 atan_table[257] = {
0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5,
5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10,
10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15,
15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20,
20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24,
25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29,
29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 33,
33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36,
36, 37, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 40,
40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 43,
43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, 45,
};
void CatalogSRAM() {}
static void* SndMemAlloc();
static void SndMemFree(void* ptr);
void InitSound_Overlord() {
for (auto& s : gSounds) {
s.id = 0;
}
SetCurve(1, 0, 0);
SetCurve(2, 0x1000, 0);
SetCurve(3, 0, 0x1000);
SetCurve(4, 0x800, 0);
SetCurve(5, 0x800, 0x800);
SetCurve(6, -0x1000, 0);
SetCurve(6, -0x800, 0);
snd_StartSoundSystem();
snd_RegisterIOPMemAllocator(SndMemAlloc, SndMemFree);
snd_LockVoiceAllocator(1);
u32 voice = snd_ExternVoiceVoiceAlloc(2, 0x7f);
snd_UnlockVoiceAllocator();
// The voice allocator returns a number in the range 0-47 where voices
// 0-23 are on SPU Core 0 and 24-47 are on core 2.
// For some reason we convert it to this format where 0-47 alternate core every step.
gVoice = voice / 24 + ((voice % 24) * 2);
// Allocate SPU RAM for our streams.
gStreamSRAM = snd_SRAMMalloc(0xc030);
snd_SetMixerMode(0, 0);
for (int i = 0; i < 8; i++) {
snd_SetGroupVoiceRange(i, 0x10, 0x2f);
}
snd_SetGroupVoiceRange(1, 0, 0xf);
snd_SetGroupVoiceRange(2, 0, 0xf);
snd_SetReverbDepth(3, 0, 0);
snd_SetReverbType(1, 0);
snd_SetReverbType(2, 0);
CatalogSRAM();
for (int i = 0; i < 91; i++) {
s16 opposing_front = static_cast<s16>(((i * 0x33ff) / 0x5a) + 0xc00);
s16 rear_right = static_cast<s16>(((i * -0x2800) / 0x5a) + 0x3400);
s16 rear_left = static_cast<s16>(((i * -0xbff) / 0x5a) + 0x3fff);
gPanTable[90 - i].left = 0x3FFF;
gPanTable[180 - i].left = opposing_front;
gPanTable[270 - i].left = rear_right;
gPanTable[360 - i].left = rear_left;
gPanTable[i].right = opposing_front;
gPanTable[90 + i].right = 0x3FFF;
gPanTable[180 + i].right = rear_left;
gPanTable[270 + i].right = rear_right;
}
snd_SetPanTable((s16*)gPanTable);
snd_SetPlayBackMode(2);
SemaParam sema;
sema.attr = 1;
sema.init_count = 1;
sema.max_count = 1;
sema.option = 0;
gSema = CreateSema(&sema);
if (gSema < 0) {
while (true)
;
}
}
Sound* LookupSound(s32 id) {
if (id == 0) {
return nullptr;
}
for (auto& s : gSounds) {
if (s.id == id) {
s32 sndid = snd_SoundIsStillPlaying(s.sound_handle);
s.sound_handle = sndid;
if (sndid == 0) {
s.id = 0;
return nullptr;
}
return &s;
}
}
return nullptr;
}
void CleanSounds() {
for (auto& s : gSounds) {
if (s.id != 0) {
s32 sndid = snd_SoundIsStillPlaying(s.sound_handle);
s.sound_handle = sndid;
if (sndid == 0) {
s.id = 0;
}
}
}
}
void KillSoundsInGroup(u8 group) {
for (auto& s : gSounds) {
if (s.id != 0) {
s32 sndid = snd_SoundIsStillPlaying(s.sound_handle);
s.sound_handle = sndid;
if (sndid == 0) {
s.id = 0;
} else if (s.params.group & group) {
snd_StopSound(s.sound_handle);
s.id = 0;
}
}
}
}
Sound* AllocateSound() {
for (auto& s : gSounds) {
if (s.id == 0) {
return &s;
}
}
CleanSounds();
for (auto& s : gSounds) {
if (s.id == 0) {
return &s;
}
}
return nullptr;
}
s32 CalculateFallofVolume(Vec3w* pos, s32 volume, s32 fo_curve, s32 fo_min, s32 fo_max) {
if (fo_curve == 0) {
return 0;
}
s32 xdiff = gEarTrans.x - pos->x;
s32 ydiff = gEarTrans.y - pos->y;
s32 zdiff = gEarTrans.z - pos->z;
if (xdiff < 0) {
xdiff = pos->x - gEarTrans.x;
}
if (ydiff < 0) {
ydiff = pos->y - gEarTrans.y;
}
if (zdiff < 0) {
zdiff = pos->z - gEarTrans.z;
}
s32 min = fo_min << 8;
s32 max = fo_max << 8;
if (max < xdiff) {
return 0;
}
if (max < ydiff) {
return 0;
}
if (max < zdiff) {
return 0;
}
while (max > 0x7FFF) {
max >>= 1;
min >>= 1;
xdiff >>= 1;
ydiff >>= 1;
zdiff >>= 1;
}
s32 distance = xdiff * xdiff + ydiff * ydiff + zdiff * zdiff;
if (distance != 0) {
s32 steps = 0;
while ((steps & 0xc0000000) == 0) {
distance <<= 2;
steps++;
}
distance = sqrt_table[distance >> 24] >> steps;
} else {
distance = 0;
}
if (distance <= min) {
return volume;
}
if (distance >= max) {
return 0;
}
s32 start = distance - min;
s32 end = max - min;
while (start > 0xFFFF) {
start >>= 1;
end >>= 1;
}
s32 v13 = (start << 16) / end;
if (v13 == 0x10000) {
return volume;
}
s32 factor = ((gCurve[fo_curve].unk4 << 16) + gCurve[fo_curve].unk3 * v13 +
gCurve[fo_curve].unk2 * ((v13 * 13) >> 16) +
gCurve[fo_curve].unk1 * (((((v13 * v13) >> 16) * v13) >> 16) >> 16)) >>
12;
if (factor > 0x10000) {
factor = 0x10000;
}
return factor; // TODO
}
s32 CalculateAngle(Vec3w* trans) {
s32 diffX = gCamTrans.x - trans->x;
s32 diffZ = gCamTrans.z - trans->z;
s32 lookupX = diffX;
s32 lookupZ = diffZ;
if (diffX < 0) {
lookupZ = trans->x - gCamTrans.x;
}
if (diffZ < 0) {
lookupZ = trans->z - gCamTrans.z;
}
if (diffX == 0 && diffZ == 0) {
return 0;
}
s32 angle;
if (lookupZ >= lookupX) {
angle = atan_table[(lookupX << 8) / lookupZ];
if (diffZ >= 0) {
if (diffX < 0) {
angle = 360 - angle;
}
} else if (diffX >= 0) {
angle = 180 - angle;
} else {
angle += 180;
}
} else {
angle = atan_table[(lookupZ << 8) / lookupX];
if (diffX >= 0) {
if (diffZ >= 0) {
angle = 90 - angle;
} else {
angle = angle + 90;
}
} else if (diffZ >= 0) {
angle = angle + 270;
} else {
angle = 270 - 90;
}
}
return (angle - gCamAngle + 720) % 360;
}
s32 GetVolume(Sound* sound) {
return CalculateFallofVolume(&sound->params.trans, sound->params.volume, sound->params.fo_curve,
sound->params.fo_min, sound->params.fo_max);
}
s32 GetPan(Sound* sound) {
return CalculateAngle(&sound->params.trans);
}
static void UpdateLocation(Sound* sound) {
if (sound->id == 0) {
return;
}
if ((sound->bank_entry->fallof_params >> 28) == 0) {
return;
}
s32 id = snd_SoundIsStillPlaying(sound->sound_handle);
if (id == 0) {
sound->id = 0;
return;
}
s32 volume = GetVolume(sound);
if (volume == 0) {
snd_StopSound(sound->sound_handle);
} else {
s32 pan = GetPan(sound);
snd_SetSoundVolPan(id, volume, pan);
}
}
static void UpdateAutoVol(Sound* sound, s32 ticks) {
if (ticks < sound->auto_time) {
s32 nvol = sound->new_volume;
if (nvol == -4) {
nvol = 0;
}
s32 step = (nvol - sound->params.volume) * ticks;
step /= sound->auto_time;
if (step >= 0) {
if (step == 0) {
step = 1;
}
sound->params.volume += step;
if (sound->new_volume < sound->params.volume) {
sound->params.volume = sound->new_volume;
}
} else {
sound->params.volume += step;
if (sound->new_volume > sound->params.volume) {
sound->params.volume = sound->new_volume;
}
}
sound->auto_time -= ticks;
return;
}
if (sound->new_volume == -4) {
snd_StopSound(sound->sound_handle);
sound->id = 0;
return;
}
sound->params.volume = sound->new_volume;
sound->auto_time = 0;
}
void UpdateVolume(Sound* sound) {
s32 id = snd_SoundIsStillPlaying(sound->sound_handle);
sound->sound_handle = id;
if (sound->sound_handle == 0) {
sound->id = 0;
} else {
s32 volume = GetVolume(sound);
snd_SetSoundVolPan(id, volume, -2);
}
}
void SetEarTrans(Vec3w* ear_trans, Vec3w* cam_trans, s32 cam_angle) {
s32 tick = 0; // snd_GetTick();
s32 delta = tick - sLastTick;
sLastTick = tick;
gEarTrans = *ear_trans;
gCamTrans = *cam_trans;
gCamAngle = cam_angle;
for (auto& s : gSounds) {
if (s.id != 0 && s.is_music == 0) {
if (s.auto_time != 0) {
UpdateAutoVol(&s, delta);
}
UpdateLocation(&s);
}
}
// TODO SetVAGVol();
}
void PrintActiveSounds() {
char string[64];
for (auto& s : gSounds) {
if (s.id != 0 && s.is_music == 0) {
u32 len = strlen(s.bank_entry->name);
if (len > 16) {
len = 16;
}
s32 volume = GetVolume(&s);
sprintf(string, " : Vol %d", volume);
memcpy(string, s.bank_entry->name, len);
printf("%s\n", string);
}
}
}
void SetCurve(s32 curve, s32 fallof, s32 ease) {
gCurve[curve].unk1 = ease << 1;
gCurve[curve].unk2 = fallof + ease * -3;
gCurve[curve].unk3 = (ease - fallof) + -0x1000;
gCurve[curve].unk4 = 0x1000;
}
void SetMusicVol() {
s32 volume = (gMusicVol * gMusicFade >> 0x10) * gMusicTweak >> 7;
snd_SetMasterVolume(1, volume);
snd_SetMasterVolume(2, volume);
}
// Do we even need/want these
// TODO void SetBufferMem() {}
// TODO void ReleaseBufferMem() {}
static void* SndMemAlloc() {
return nullptr;
}
static void SndMemFree(void* ptr) {}

View File

@ -1,8 +1,67 @@
#pragma once
#ifndef JAK_V2_SSOUND_H
#define JAK_V2_SSOUND_H
#include "game/sce/iop.h"
#include "sbank.h"
extern s32 gSema;
extern s32 gMusicFade;
extern s32 gMusicFadeDir;
extern s32 gMusicVol;
// FIXME where to put this
struct Vec3w {
s32 x;
s32 y;
s32 z;
};
struct SoundParams {
u16 mask;
s16 pitch_mod;
s16 bend;
s16 fo_min;
s16 fo_max;
s8 fo_curve;
s8 priority;
s32 volume;
Vec3w trans;
u8 group;
};
struct Sound {
s32 id;
s32 sound_handle;
s32 is_music;
s32 new_volume;
s32 auto_time;
SoundParams params;
SoundRecord* bank_entry;
};
struct Curve {
s32 unk1;
s32 unk2;
s32 unk3;
s32 unk4;
};
struct VolumePair {
s16 left;
s16 right;
};
void InitSound_Overlord();
void SetCurve(s32 curve, s32 fallof, s32 ease);
void SetEarTrans(Vec3w* ear_trans, Vec3w* cam_trans, s32 cam_angle);
void KillSoundsInGroup(u8 group);
void PrintActiveSounds();
void SetMusicVol();
Sound* LookupSound(s32 id);
Sound* AllocateSound();
void UpdateVolume(Sound* sound);
s32 GetVolume(Sound* sound);
s32 GetPan(Sound* sound);
#endif // JAK_V2_SSOUND_H

View File

@ -811,7 +811,6 @@
)
)
(when (not *lightning-frame-done*)
(#when PC_DEBUG_SOUND_ENABLE
(let ((gp-3 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> gp-3 command) (sound-command set-param))
(set! (-> gp-3 id) *thunder-id0*)
@ -864,7 +863,6 @@
(-> gp-5 id)
)
)
)
(set! *lightning-frame-done* #t)
(none)
)

View File

@ -2042,7 +2042,6 @@
)
:exit
(behavior ()
(#when PC_DEBUG_SOUND_ENABLE
(let ((v1-0 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> v1-0 command) (sound-command set-param))
(set! (-> v1-0 id) (-> self sound-id))
@ -2052,7 +2051,6 @@
(set! (-> v1-0 parms mask) (the-as uint 17))
(-> v1-0 id)
)
)
(none)
)
:trans

View File

@ -899,6 +899,8 @@
;; vif0 collide
;; swap sound
;; str play
(swap-sound-buffers (ear-trans) (camera-pos) (camera-angle))
(str-play-kick)
(level-update *level*) ;; also updates settings.
(mc-run)
(auto-save-check)

View File

@ -642,7 +642,6 @@
)
((< 0.0 (-> self control unknown-float141))
(set! (-> self control unknown-float141) 0.0)
(#when PC_DEBUG_SOUND_ENABLE
(let ((v1-64 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> v1-64 command) (sound-command set-param))
(set! (-> v1-64 id) (-> self control unknown-soundid00))
@ -652,7 +651,6 @@
(set! (-> v1-64 parms mask) (the-as uint 17))
(-> v1-64 id)
)
)
)
)
(let ((v1-67 (-> *time-of-day-context* current-shadow))

View File

@ -1058,7 +1058,6 @@
(spawn (-> obj part) (the-as vector (-> obj root-override root-prim prim-core)))
)
)
(#when PC_DEBUG_SOUND_ENABLE
(let ((s5-0 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> s5-0 command) (sound-command set-param))
(set! (-> s5-0 id) (-> obj sound-id))
@ -1076,7 +1075,6 @@
(set! (-> s5-0 parms mask) (the-as uint 32))
(-> s5-0 id)
)
)
0
(none)
)

View File

@ -5,9 +5,6 @@
;; name in dgo: gsound
;; dgos: GAME, ENGINE
;; use this constant to enable/disable the sound functions. debug purposes.
(defglobalconstant PC_DEBUG_SOUND_ENABLE #f)
;; The sound playback stuff is all on the IOP so we use IOP RPCs to control it.
;; Ther is a "player" that plays sound effects, and a "loader" that takes care of loading banks.
(define *sound-player-rpc* (new 'global 'rpc-buffer-pair (the uint (size-of sound-rpc-union)) (the-as uint 128) RPC-SOUND-PLAYER))
@ -44,10 +41,7 @@
(define *sound-iop-info* (new 'global 'sound-iop-info))
;; HACK
(#unless PC_DEBUG_SOUND_ENABLE
(set! (-> *sound-iop-info* strpos) -1)
)
(set! (-> *sound-iop-info* strpos) -1)
(defun str-is-playing? ()
"Return #t if an audio stream is playing"
@ -309,18 +303,15 @@
(defun sound-set-volume ((group uint) (volume float))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the sound-rpc-set-master-volume (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-master-volume))
(set! (-> cmd group) group)
(set! (-> cmd volume) (the int (* 10.24 volume)))
)
)
0
)
(defun sound-set-reverb ((arg0 int) (arg1 float) (arg2 float) (arg3 uint))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the-as sound-rpc-set-reverb (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-reverb))
(set! (-> cmd core) arg3)
@ -328,20 +319,16 @@
(set! (-> cmd left) (the-as uint (the int (* 32767.0 arg1))))
(set! (-> cmd right) (the-as uint (the int (* 32767.0 arg2))))
)
)
0
)
(defun sound-set-ear-trans ((ear-trans vector) (cam-trans vector) (cam-angle float))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the sound-rpc-set-ear-trans (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-ear-trans))
(sound-trans-convert (-> cmd ear-trans) ear-trans)
(sound-trans-convert (-> cmd cam-trans) cam-trans)
(set! (-> cmd cam-angle) (sound-angle-convert cam-angle))
)
)
0
)
@ -350,20 +337,20 @@
`(with-pp
(let ((proc (the process-drawable pp)))
(format 0 "get proc~%")
;(format 0 "get proc~%")
(when (= ,sound-trans #t)
(format 0 "trans #t~%")
;(format 0 "trans #t~%")
(if (and proc
(type-type? (-> proc type) process-drawable)
(nonzero? (-> proc root)))
(set! ,sound-trans (-> proc root trans))
(set! ,sound-trans (the vector #f))
)
(format 0 "trans is ~A~%" ,sound-trans)
;(format 0 "trans is ~A~%" ,sound-trans)
)
)
(format 0 "convert~%" ,sound-trans)
;(format 0 "convert~%" ,sound-trans)
(sound-trans-convert (-> ,cmd parms trans) ,sound-trans)
)
)
@ -371,7 +358,6 @@
(defun sound-play-by-name ((name sound-name) (id sound-id) (vol int) (pitch int) (bend int) (group int) (trans symbol))
"Play a sound called name with the specified params"
(#when PC_DEBUG_SOUND_ENABLE
(local-vars (sv-16 int))
(with-pp
(set! sv-16 group)
@ -404,14 +390,12 @@
)
)
)
)
id
)
(defun sound-play-by-spec ((spec sound-spec) (id sound-id) (sound-trans vector))
"Play a sound from the given spec"
(#when PC_DEBUG_SOUND_ENABLE
(when *sound-player-enable*
(let ((cmd (the sound-rpc-play (get-sound-buffer-entry))))
@ -431,92 +415,76 @@
(sound-trans-from-process cmd sound-trans)
)
)
)
id
)
(defun sound-pause ((id sound-id))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the sound-rpc-pause-sound (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command pause-sound))
(set! (-> cmd id) id)
)
)
0
)
(defun sound-stop ((id sound-id))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the sound-rpc-stop-sound (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command stop-sound))
(set! (-> cmd id) id)
)
)
0
)
(defun sound-continue ((id sound-id))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the sound-rpc-continue-sound (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command continue-sound))
(set! (-> cmd id) id)
)
)
0
)
(defun sound-group-pause ((group uint))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the sound-rpc-pause-group (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command pause-group))
(set! (-> cmd group) group)
)
)
0
)
(defun sound-group-stop ((group uint))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the sound-rpc-stop-group (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command stop-group))
(set! (-> cmd group) group)
)
)
0
)
(defun sound-group-continue ((group uint))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the sound-rpc-continue-group (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command continue-group))
(set! (-> cmd group) group)
)
)
0
)
(defun sound-set-falloff-curve ((curve int) (falloff float) (ease float))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the sound-rpc-set-falloff-curve (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-falloff-curve))
(set! (-> cmd curve) curve)
(set! (-> cmd falloff) (the int (* 4096.0 falloff)))
(set! (-> cmd ease) (the int (* 4096.0 ease)))
)
)
0
)
(defun sound-set-sound-falloff ((name sound-name) (falloff-min int) (falloff-max int) (curve int))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the sound-rpc-set-sound-falloff (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-sound-falloff))
(set! (-> cmd name) name)
@ -524,29 +492,24 @@
(set! (-> cmd max) falloff-max)
(set! (-> cmd curve) curve)
)
)
0
)
(defun sound-set-flava ((flava uint))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the sound-rpc-set-flava (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-flava))
(set! (-> cmd flava) flava)
)
)
0
)
(defun sound-set-fps ((arg0 uint))
(#when PC_DEBUG_SOUND_ENABLE
(let ((cmd (the-as sound-rpc-set-fps (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-fps))
(set! (-> cmd fps) arg0)
)
)
0
)
@ -749,7 +712,6 @@
(defmethod update-trans! ambient-sound ((obj ambient-sound) (sound-trans vector))
"Update the position of the thing playing the sound"
(#when PC_DEBUG_SOUND_ENABLE
(set! (-> obj trans quad) (-> sound-trans quad))
(when (nonzero? (-> obj playing-id))
(let ((cmd (the sound-rpc-set-param (get-sound-buffer-entry))))
@ -762,14 +724,12 @@
(-> cmd id)
)
)
)
0
)
(defmethod update-vol! ambient-sound ((obj ambient-sound) (arg0 int))
"Update the volume of the sound"
(#when PC_DEBUG_SOUND_ENABLE
(when (nonzero? (-> obj playing-id))
(let ((cmd (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-param))
@ -780,7 +740,6 @@
)
)
(set! (-> obj volume) (the int (* 10.24 (the float arg0))))
)
0
)

View File

@ -131,30 +131,34 @@
)
)
(define *all-str* '())
(defmacro copy-strs (&rest strs)
`(begin ,@(apply (lambda (x) `(copy-str ,x)) strs)))
(defun copy-str (name)
(let* ((path (string-append "iso_data/" *game-directory* "STR/" name ".STR"))
(out-file (string-append "out/iso/" name ".STR")))
(defstep :in path
:tool 'copy
:out `(,out-file))
(set! *all-str* (cons out-file *all-str*))))
(define *all-vis* '())
(defmacro copy-vis-files (&rest files)
`(begin ,@(apply (lambda (x) `(copy-vis-file ,x)) files)))
(defun copy-vis-file (name)
(let* ((path (string-append "iso_data/" *game-directory* "VIS/" name ".VIS"))
(out-name (string-append "out/iso/" name ".VIS")))
(defun copy-iso-file (name subdir ext)
(let* ((path (string-append "iso_data/" *game-directory* subdir name ext))
(out-name (string-append "out/iso/" name ext)))
(defstep :in path
:tool 'copy
:out `(,out-name))
(set! *all-vis* (cons out-name *all-vis*))))
out-name))
(define *all-str* '())
(defmacro copy-strs (&rest strs)
`(begin ,@(apply (lambda (x) `(set! *all-str* (cons (copy-iso-file ,x "STR/" ".STR") *all-str*))) strs)))
(define *all-vis* '())
(defmacro copy-vis-files (&rest files)
`(begin ,@(apply (lambda (x) `(set! *all-vis* (cons (copy-iso-file ,x "VIS/" ".VIS") *all-vis*))) files)))
;; Files not yet added in here:
;; - TESTTONE.SBK
(define *all-sbk* '())
(defmacro copy-sbk-files (&rest files)
`(begin ,@(apply (lambda (x) `(set! *all-sbk* (cons (copy-iso-file ,x "SBK/" ".SBK") *all-sbk*))) files)))
;; Files not yet added in here:
;; - DANGER.MUS
;; - TWEAKVAL.MUS
(define *all-mus* '())
(defmacro copy-mus-files (&rest files)
`(begin ,@(apply (lambda (x) `(set! *all-mus* (cons (copy-iso-file ,x "MUS/" ".MUS") *all-mus*))) files)))
(defmacro group (name &rest stuff)
`(defstep :in ""
@ -370,6 +374,8 @@
;; as we find objects that exist in multiple levels, put them here
(copy-sbk-files "COMMON" "EMPTY1" "EMPTY2")
(copy-gos
"sharkey-ag"
"orb-cache-top-ag"
@ -426,6 +432,8 @@
)
(copy-vis-files "BEA")
(copy-sbk-files "BEACH")
(copy-mus-files "BEACH")
(goal-src-sequence
"levels/beach/"
@ -497,6 +505,8 @@
"jun.gd")
(copy-vis-files "JUN")
(copy-sbk-files "JUNGLE")
(copy-mus-files "JUNGLE" "FISHGAME")
(goal-src-sequence
"levels/jungle/"
@ -565,6 +575,8 @@
;; the VIS file
(copy-vis-files "VI1")
(copy-sbk-files "VILLAGE1")
(copy-mus-files "VILLAGE1")
;; the code
(goal-src-sequence
@ -643,6 +655,8 @@
(cgo "JUB.DGO" "jub.gd")
(copy-vis-files "JUB")
(copy-sbk-files "JUNGLEB")
(copy-mus-files "JUNGLEB")
(goal-src-sequence
"levels/jungleb/"
@ -675,6 +689,8 @@
(cgo "MIS.DGO" "mis.gd")
(copy-vis-files "MIS")
(copy-sbk-files "MISTY")
(copy-mus-files "MISTY")
(goal-src-sequence
"levels/misty/"
@ -741,6 +757,8 @@
(cgo "SWA.DGO" "swa.gd")
(copy-vis-files "SWA")
(copy-sbk-files "SWAMP")
(copy-mus-files "SWAMP")
(goal-src-sequence
"levels/swamp/"
@ -783,6 +801,8 @@
(cgo "SUN.DGO" "sun.gd")
(copy-vis-files "SUN")
(copy-sbk-files "SUNKEN")
(copy-mus-files "SUNKEN")
(goal-src-sequence
"levels/sunken/"
@ -874,6 +894,8 @@
(cgo "SNO.DGO" "sno.gd")
(copy-vis-files "SNO")
(copy-sbk-files "SNOW")
(copy-mus-files "SNOW")
(goal-src-sequence
"levels/snow/"
@ -933,6 +955,8 @@
)
(copy-vis-files "FIC")
(copy-sbk-files "FIRECANY")
(copy-mus-files "FIRECANY")
(copy-textures 1119) ;; might be common/zoomer hud?? also in misty, lavatube, ogre and racerpkg
@ -966,6 +990,8 @@
(cgo "OGR.DGO" "ogr.gd")
(copy-vis-files "OGR")
(copy-sbk-files "OGRE")
(copy-mus-files "OGRE" "OGREBOSS")
(goal-src-sequence
"levels/ogre/"
@ -1005,6 +1031,8 @@
(cgo "VI2.DGO" "vi2.gd")
(copy-vis-files "VI2")
(copy-sbk-files "VILLAGE2")
(copy-mus-files "VILLAGE2")
(goal-src-sequence
"levels/village2/"
@ -1073,6 +1101,8 @@
(cgo "ROL.DGO" "rol.gd")
(copy-vis-files "ROL")
(copy-sbk-files "ROLLING")
(copy-mus-files "ROLLING")
(goal-src-sequence
"levels/rolling/"
@ -1111,6 +1141,8 @@
(cgo "VI3.DGO" "vi3.gd")
(copy-vis-files "VI3")
(copy-sbk-files "VILLAGE3")
(copy-mus-files "VILLAGE3")
;; the code
(goal-src-sequence
@ -1169,6 +1201,7 @@
"tra.gd")
(copy-vis-files "TRA")
(copy-sbk-files "TRAINING")
;; The code
(goal-src-sequence
@ -1196,6 +1229,8 @@
(cgo "MAI.DGO" "mai.gd")
(copy-vis-files "MAI")
(copy-sbk-files "MAINCAVE")
(copy-mus-files "MAINCAVE")
(goal-src-sequence
"levels/"
@ -1244,6 +1279,7 @@
(cgo "DAR.DGO" "dar.gd")
(copy-vis-files "DAR")
(copy-sbk-files "DARKCAVE")
(copy-textures 1306 1307 1305 1304 1352)
@ -1261,6 +1297,7 @@
(cgo "ROB.DGO" "rob.gd")
(copy-vis-files "ROB")
(copy-sbk-files "ROBOCAVE")
(goal-src-sequence
"levels/robocave/"
@ -1288,6 +1325,8 @@
(cgo "LAV.DGO" "lav.gd")
(copy-vis-files "LAV")
(copy-sbk-files "LAVATUBE")
(copy-mus-files "LAVATUBE")
(goal-src-sequence
"levels/lavatube/"
@ -1331,6 +1370,8 @@
(cgo "CIT.DGO" "cit.gd")
(copy-vis-files "CIT")
(copy-sbk-files "CITADEL")
(copy-mus-files "CITADEL")
(goal-src-sequence
"levels/citadel/"
@ -1393,6 +1434,8 @@
(cgo "FIN.DGO" "fin.gd")
(copy-vis-files "FIN")
(copy-sbk-files "FINALBOS")
(copy-mus-files "FINALBOS" "CREDITS")
(goal-src-sequence
"levels/finalboss/"
@ -1856,9 +1899,12 @@
(group-list "iso"
`("out/iso/0COMMON.TXT"
"out/iso/0SUBTIT.TXT"
"out/iso/TWEAKVAL.MUS"
,@(reverse *all-cgos*)
,@(reverse *all-vis*)
,@(reverse *all-str*))
,@(reverse *all-str*)
,@(reverse *all-sbk*)
,@(reverse *all-mus*))
)

View File

@ -271,7 +271,6 @@
)
)
(sound-play-by-name (static-sound-name "elev-loop") (-> self sound-id) 1024 0 0 1 #t)
(#when PC_DEBUG_SOUND_ENABLE
(let ((gp-1 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> gp-1 command) (sound-command set-param))
(set! (-> gp-1 id) (-> self sound-id))
@ -289,7 +288,6 @@
(set! (-> gp-1 parms mask) (the-as uint 32))
(-> gp-1 id)
)
)
(if (and (-> self grab-player?) (< 0.2 (-> self path-pos)))
(set! (-> self grab-player?) (not (process-release? *target*)))
)
@ -352,7 +350,6 @@
)
)
(sound-play-by-name (static-sound-name "elev-loop") (-> self sound-id) 1024 0 0 1 #t)
(#when PC_DEBUG_SOUND_ENABLE
(let ((gp-1 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> gp-1 command) (sound-command set-param))
(set! (-> gp-1 id) (-> self sound-id))
@ -370,7 +367,6 @@
(set! (-> gp-1 parms mask) (the-as uint 32))
(-> gp-1 id)
)
)
(if (and (-> self grab-player?) (< (-> self path-pos) 0.8))
(set! (-> self grab-player?) (not (process-release? *target*)))
)

View File

@ -238,7 +238,6 @@
(defmethod dummy-24 mother-spider-proj ((obj mother-spider-proj))
(with-pp
(spawn (-> obj part) (the-as vector (-> obj root-override root-prim prim-core)))
(#when PC_DEBUG_SOUND_ENABLE
(let ((s5-0 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> s5-0 command) (sound-command set-param))
(set! (-> s5-0 id) (-> obj sound-id))
@ -256,7 +255,6 @@
(set! (-> s5-0 parms mask) (the-as uint 32))
(-> s5-0 id)
)
)
(let ((f0-5 (* 5120.0 (+ 0.9 (* 0.1 (cos (* 873.81335 (the float (mod (-> *display* base-frame-counter) 75)))))))))
(find-ground-and-draw-shadow
(-> obj root-override trans)

View File

@ -756,7 +756,6 @@
)
)
(when (nonzero? (-> self sfx))
(#when PC_DEBUG_SOUND_ENABLE
(let ((gp-1 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> gp-1 command) (sound-command set-param))
(set! (-> gp-1 id) (the-as sound-id (-> self sfx)))
@ -774,7 +773,6 @@
(set! (-> gp-1 parms mask) (the-as uint 32))
(-> gp-1 id)
)
)
)
(quaternion*! (-> self root-override quat) (-> self root-override quat) (-> self tumble-quat))
(suspend)

View File

@ -946,7 +946,6 @@
(= (-> self racer boost-level) 0.0)
)
(when (nonzero? (-> self racer boost-sound-id))
(#when PC_DEBUG_SOUND_ENABLE
(let ((v1-241 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> v1-241 command) (sound-command set-param))
(set! (-> v1-241 id) (-> self racer boost-sound-id))
@ -956,7 +955,6 @@
(set! (-> v1-241 parms mask) (the-as uint 17))
(-> v1-241 id)
)
)
(set! (-> self racer boost-sound-id) (new 'static 'sound-id))
0
)

View File

@ -498,7 +498,6 @@
(if (-> obj launched?)
(spawn (-> obj part2) (the-as vector (-> obj root-override root-prim prim-core)))
)
(#when PC_DEBUG_SOUND_ENABLE
(let ((s5-0 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> s5-0 command) (sound-command set-param))
(set! (-> s5-0 id) (-> obj sound-id))
@ -516,7 +515,6 @@
(set! (-> s5-0 parms mask) (the-as uint 32))
(-> s5-0 id)
)
)
(none)
)
)