mirror of
https://github.com/zeldaret/ss
synced 2026-09-08 11:26:13 -04:00
move and use enums
This commit is contained in:
@@ -11,8 +11,6 @@
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
#include "sized_string.h"
|
||||
|
||||
extern "C" u8 fn_80382590(u8, const char*);
|
||||
|
||||
struct d_snd_mgr_unk_6_sinit {
|
||||
d_snd_mgr_unk_6_sinit() : field_0x00(0), field_0x04(0.0f) {}
|
||||
|
||||
@@ -45,7 +43,7 @@ dSoundSource_c::dSoundSource_c(u8 sourceType, dAcBase_c *player, const char *nam
|
||||
field_0x154(0),
|
||||
field_0x158(-1),
|
||||
field_0x15A(-1) {
|
||||
field_0x0FC = fn_80382590(sourceType, name);
|
||||
mSourceCategory = dSndSourceMgr_c::getSourceCategoryForSourceType(sourceType, name);
|
||||
// TODO: Offsetof
|
||||
nw4r::ut::List_Init(&field_0x110, 0xEC);
|
||||
nw4r::ut::List_Init(&field_0x120, 0x04);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_source.h"
|
||||
#include "d/snd/d_snd_source_enums.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
|
||||
#include <cmath>
|
||||
@@ -10,18 +11,17 @@
|
||||
extern "C" bool isInStage(const char *stageName);
|
||||
|
||||
void dSndSourceGroup_c::set(s32 sourceType, const char *name) {
|
||||
// TODO enums
|
||||
resetSoundSourceParam();
|
||||
bool assignedParam = false;
|
||||
|
||||
switch (mSourceCategory) {
|
||||
case 0: {
|
||||
case SND_SOURCE_CATEGORY_PLAYER: {
|
||||
assignedParam = true;
|
||||
mParam.field_0x10 = INFINITY;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
if (sourceType == 7) {
|
||||
case SND_SOURCE_CATEGORY_EQUIPMENT:
|
||||
if (sourceType == SND_SOURCE_ARROW) {
|
||||
assignedParam = true;
|
||||
mParam.field_0x00 = 1500.0f;
|
||||
mParam.field_0x10 = INFINITY;
|
||||
@@ -29,7 +29,7 @@ void dSndSourceGroup_c::set(s32 sourceType, const char *name) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!assignedParam && (sourceType == 44 || sourceType == 58)) {
|
||||
if (!assignedParam && (sourceType == SND_SOURCE_KENSEI || sourceType == SND_SOURCE_58)) {
|
||||
assignedParam = true;
|
||||
mParam.field_0x10 = INFINITY;
|
||||
}
|
||||
@@ -40,13 +40,13 @@ void dSndSourceGroup_c::set(s32 sourceType, const char *name) {
|
||||
|
||||
if (!assignedParam) {
|
||||
switch (sourceType) {
|
||||
case 51: {
|
||||
case SND_SOURCE_NPC_NRM: {
|
||||
mParam.field_0x00 = 300.0f;
|
||||
mParam.field_0x04 = 800.0;
|
||||
mParam.field_0x10 = 2200.0;
|
||||
break;
|
||||
}
|
||||
case 48: {
|
||||
case SND_SOURCE_NPC_48: {
|
||||
if (isInStage("F401")) {
|
||||
mParam.field_0x00 = 500.0f;
|
||||
mParam.field_0x04 = 4000.0;
|
||||
|
||||
@@ -2,10 +2,53 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_source.h"
|
||||
#include "d/snd/d_snd_source_enums.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
s32 dSndSourceMgr_c::getSourceCategoryForSourceType(s32 sourceType, const char *name) {
|
||||
// This might be a full-on switch statement but I don't want to write out
|
||||
// all the unknown entries yet and this matches anyway
|
||||
|
||||
if (sourceType >= SND_SOURCE_PLAYER && sourceType <= SND_SOURCE_PLAYER_HEAD) {
|
||||
return SND_SOURCE_CATEGORY_PLAYER;
|
||||
}
|
||||
|
||||
if (sourceType >= SND_SOURCE_NET && sourceType <= SND_SOURCE_HOOKSHOT) {
|
||||
return SND_SOURCE_CATEGORY_EQUIPMENT;
|
||||
}
|
||||
|
||||
if (sourceType >= SND_SOURCE_ENEMY_10 && sourceType <= SND_SOURCE_ENEMY_31) {
|
||||
return SND_SOURCE_CATEGORY_ENEMY;
|
||||
}
|
||||
|
||||
if (sourceType >= SND_SOURCE_OBJECT && sourceType <= SND_SOURCE_OBJECT_42) {
|
||||
return SND_SOURCE_CATEGORY_OBJECT;
|
||||
}
|
||||
|
||||
if (sourceType >= SND_SOURCE_NPC_43 && sourceType <= SND_SOURCE_NPC_DRAGON) {
|
||||
return SND_SOURCE_CATEGORY_NPC;
|
||||
}
|
||||
|
||||
if (sourceType == SND_SOURCE_TG_SOUND) {
|
||||
return SND_SOURCE_CATEGORY_TG_SOUND;
|
||||
}
|
||||
|
||||
if (sourceType >= SND_SOURCE_54 && sourceType <= SND_SOURCE_57) {
|
||||
return SND_SOURCE_CATEGORY_6;
|
||||
}
|
||||
|
||||
switch (sourceType) {
|
||||
case SND_SOURCE_58:
|
||||
return SND_SOURCE_CATEGORY_7;
|
||||
case SND_SOURCE_59:
|
||||
return SND_SOURCE_CATEGORY_9;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
SND_DISPOSER_DEFINE(dSndSourceMgr_c);
|
||||
|
||||
dSndSourceMgr_c::dSndSourceMgr_c()
|
||||
@@ -43,38 +86,37 @@ dSndSourceMgr_c::dSndSourceMgr_c()
|
||||
void dSndSourceMgr_c::registerSource(dSoundSource_c *source) {
|
||||
if (source != nullptr) {
|
||||
nw4r::ut::List_Append(&mAllSources, source);
|
||||
// TODO enums
|
||||
switch (source->getCategory()) {
|
||||
case 0: {
|
||||
if (source->getActorType() == 0 && mpPlayerSource == nullptr) {
|
||||
case SND_SOURCE_CATEGORY_PLAYER: {
|
||||
if (source->getActorType() == SND_SOURCE_PLAYER && mpPlayerSource == nullptr) {
|
||||
mpPlayerSource = source;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
if (source->getActorType() == 6) {
|
||||
case SND_SOURCE_CATEGORY_EQUIPMENT: {
|
||||
if (source->getActorType() == SND_SOURCE_BOOMERANG) {
|
||||
mpBoomerangSource = source;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
case SND_SOURCE_CATEGORY_ENEMY: {
|
||||
if (isCertainEnemyType(source)) {
|
||||
nw4r::ut::List_Append(&field_0x3848, source);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
case SND_SOURCE_CATEGORY_6: {
|
||||
nw4r::ut::List_Append(&field_0x3854, source);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
case SND_SOURCE_CATEGORY_OBJECT: {
|
||||
if (source->isName("TBoat") && mpTBoatSource == nullptr) {
|
||||
mpTBoatSource = source;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
if (source->getActorType() == 44) {
|
||||
case SND_SOURCE_CATEGORY_NPC: {
|
||||
if (source->getActorType() == SND_SOURCE_KENSEI) {
|
||||
mpKenseiSource = source;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "toBeSorted/actor_info.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_source_enums.h"
|
||||
#include "f/f_profile_name.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
Reference in New Issue
Block a user