mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 22:33:43 -07:00
Lay the groundwork for aiming assistance. Remove some old junk as well.
This commit is contained in:
parent
03c6446600
commit
66d17f60e9
3 changed files with 47 additions and 31 deletions
|
@ -846,6 +846,8 @@ void accessible_stick_warning(AccessibleActor* actor) {
|
|||
policy.n = 1;
|
||||
policy.ydist = 200;
|
||||
policy.pitch = 1.1;
|
||||
policy.aimAssist.isProvider = true;
|
||||
|
||||
ActorAccessibility_AddSupportedActor(ACTOR_OBJ_SWITCH, policy);
|
||||
ActorAccessibility_InitPolicy(&policy, "Ocarina Spots", NULL, NA_SE_EV_DIAMOND_SWITCH);
|
||||
policy.n = 30;
|
||||
|
|
|
@ -143,6 +143,9 @@ void ActorAccessibility_Shutdown() {
|
|||
policy->initUserData = NULL;
|
||||
policy->cleanupUserData = NULL;
|
||||
policy->pitchModifier = 0.1;
|
||||
policy->aimAssist.isProvider = false;
|
||||
policy->aimAssist.sfx = NA_SE_SY_HITPOINT_ALARM;
|
||||
policy->aimAssist.tolerance = 0.0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -181,10 +184,13 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
|
|||
accessibleActor.currentPitch = accessibleActor.policy.pitch;
|
||||
accessibleActor.baseVolume = accessibleActor.policy.volume;
|
||||
accessibleActor.currentVolume = accessibleActor.policy.volume;
|
||||
accessibleActor.currentReverb = 0;
|
||||
accessibleActor.sceneIndex = 0;
|
||||
for (int i = 0; i < NUM_MANAGED_SOUND_SLOTS; i++)
|
||||
accessibleActor.managedSoundSlots[i] = false;
|
||||
accessibleActor.aimAssist.framesSinceAimAssist = 0;
|
||||
accessibleActor.aimAssist.frequency = 10;
|
||||
accessibleActor.aimAssist.pitch = 1.0;
|
||||
|
||||
aa->trackedActors[actor] = accessibleActor.instanceID;
|
||||
aa->accessibleActorList[accessibleActor.instanceID] = accessibleActor;
|
||||
AccessibleActor& savedActor = aa->accessibleActorList[accessibleActor.instanceID];
|
||||
|
@ -224,10 +230,6 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
|
|||
return ActorAccessibility_DBToLinear(db);
|
||||
|
||||
}
|
||||
|
||||
void ActorAccessibility_PlaySpecialSound(AccessibleActor* actor, s16 sfxId) {
|
||||
Audio_PlaySoundGeneral(sfxId, &actor->projectedPos, 4, &actor->currentPitch, &actor->currentVolume, &actor->currentReverb);
|
||||
}
|
||||
const char* ActorAccessibility_MapSfxToExternalAudio(s16 sfxId);
|
||||
void ActorAccessibility_PlaySound(void* handle, int slot, s16 sfxId, bool looping)
|
||||
{
|
||||
|
@ -397,6 +399,18 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
|
|||
}
|
||||
if (actor->isDrawn == 0 && actor->actor->id != 406 && actor->actor->id != 302)
|
||||
return;
|
||||
if (actor->policy.aimAssist.isProvider && player->stateFlags1 & PLAYER_STATE1_FIRST_PERSON && (player->stateFlags1 & PLAYER_STATE1_BOOMERANG_IN_HAND || player->stateFlags1 & PLAYER_STATE1_ITEM_IN_HAND))
|
||||
{
|
||||
ActorAccessibility_SetSoundPitch(actor, 9, actor->aimAssist.pitch);
|
||||
actor->aimAssist.framesSinceAimAssist++;
|
||||
ActorAccessibility_ProvideAimAssistForActor(actor);
|
||||
//The above will have taken care of setting the appropriate frequency and pitch, so we'll take care of the audio here based on those results.
|
||||
if (actor->aimAssist.framesSinceAimAssist >= actor->aimAssist.frequency) {
|
||||
|
||||
actor->aimAssist.framesSinceAimAssist = 0;
|
||||
ActorAccessibility_PlaySoundForActor(actor, 9, actor->policy.aimAssist.sfx, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (actor->policy.callback != NULL)
|
||||
actor->policy.callback(actor);
|
||||
|
@ -473,18 +487,19 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
|
|||
actor.basePitch = 1.0;
|
||||
actor.baseVolume = 1.0;
|
||||
actor.currentPitch = 1.0;
|
||||
actor.currentReverb = 1.0;
|
||||
actor.currentVolume = 1.0;
|
||||
actor.frameCount = 0;
|
||||
actor.id = (s16)type;
|
||||
actor.instanceID = ActorAccessibility_GetNextID();
|
||||
actor.isDrawn = 1;
|
||||
// actor.variety = variety;
|
||||
actor.play = NULL;
|
||||
actor.world = where;
|
||||
actor.sceneIndex = 0;
|
||||
for (int i = 0; i < NUM_MANAGED_SOUND_SLOTS; i++)
|
||||
actor.managedSoundSlots[i] = 0;
|
||||
actor.aimAssist.framesSinceAimAssist = 0;
|
||||
actor.aimAssist.frequency = 10;
|
||||
actor.aimAssist.pitch = 1.0;
|
||||
|
||||
actor.policy = *policy;
|
||||
VAList_t* l = (VAList_t*)list;
|
||||
|
@ -560,6 +575,12 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
|
|||
SpeechSynthesizer::Instance->Speak(ss.str().c_str(), GetLanguageCode());
|
||||
|
||||
}
|
||||
//Aim cue support.
|
||||
void ActorAccessibility_ProvideAimAssistForActor(AccessibleActor* actor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//External audio engine stuff.
|
||||
bool ActorAccessibility_InitAudio() {
|
||||
try {
|
||||
|
|
|
@ -35,7 +35,13 @@ typedef struct {
|
|||
bool runsAlways; // If set, then the distance policy is ignored.
|
||||
ActorAccessibilityUserDataInit initUserData;
|
||||
ActorAccessibilityUserDataCleanup cleanupUserData;
|
||||
//u8 param;
|
||||
//Aim assist settings.
|
||||
struct {
|
||||
bool isProvider;//determines whether or not this actor supports aim assist.
|
||||
s16 sfx; // The sound to play when this actor provides aim assist. Uses sound slot 9.
|
||||
f32 tolerance; // How close to the center of the actor does Link have to aim for aim assist to consider
|
||||
// it lined up.
|
||||
}aimAssist;
|
||||
|
||||
} ActorAccessibilityPolicy;
|
||||
|
||||
|
@ -65,12 +71,15 @@ struct AccessibleActor {
|
|||
f32 basePitch;
|
||||
|
||||
f32 currentPitch;
|
||||
s8 currentReverb;
|
||||
s16 sceneIndex;//If this actor represents a scene transition, then this will contain the destination scene index. Zero otherwise.
|
||||
|
||||
s16 variety;
|
||||
|
||||
bool managedSoundSlots[NUM_MANAGED_SOUND_SLOTS];//These have their attenuation and panning parameters updated every frame automatically.
|
||||
struct {
|
||||
s16 framesSinceAimAssist; // Allows rate-based vertical aim assist. Incremented every frame for aim assist
|
||||
// actors. Manually reset by aim assist provider.
|
||||
f32 pitch; // Used to report whether Link is aiming higher or lower than the actor.
|
||||
u8 frequency; // How often the sound will be played. Lower frequencies indicate that Link's vertical aim is
|
||||
// closer to the actor. } aimAssist;
|
||||
} aimAssist;
|
||||
|
||||
// Add more state as needed.
|
||||
ActorAccessibilityPolicy policy; // A copy, so it can be customized on a per-actor basis if needed.
|
||||
|
@ -80,7 +89,6 @@ struct AccessibleActor {
|
|||
void ActorAccessibility_Init();
|
||||
void ActorAccessibility_InitActors();
|
||||
void ActorAccessibility_Shutdown();
|
||||
|
||||
void ActorAccessibility_InitPolicy(ActorAccessibilityPolicy* policy, const char* englishName,
|
||||
ActorAccessibilityCallback callback, s16 sfx);
|
||||
|
||||
|
@ -90,7 +98,6 @@ void ActorAccessibility_AddSupportedActor(s16 type, ActorAccessibilityPolicy pol
|
|||
|
||||
void ActorAccessibility_RunAccessibilityForActor(PlayState* play, AccessibleActor* actor);
|
||||
void ActorAccessibility_RunAccessibilityForAllActors(PlayState* play);
|
||||
void ActorAccessibility_PlaySpecialSound(AccessibleActor* actor, s16 sfxId);
|
||||
/*
|
||||
*Play sounds (usually from the game) using the external sound engine. This is probably not the function you want to call most of the time (see below).
|
||||
* handle: pointer to an arbitrary object. This object can be anything as it's only used as a classifier, but it's recommended that you use an AccessibleActor* as your handle whenever possible. Using AccessibleActor* as the handle gives you automatic cleanup when the actor is killed.
|
||||
|
@ -153,21 +160,6 @@ typedef enum {
|
|||
|
||||
} VIRTUAL_ACTOR_TABLE;
|
||||
|
||||
typedef enum {
|
||||
AREA_KOKIRI = 2000,
|
||||
AREA_HYRULE_FIELD,
|
||||
AREA_HYRULE_CASTLE,
|
||||
AREA_ToT,
|
||||
AREA_ZORA,
|
||||
AREA_VILLAGE,
|
||||
AREA_GORON,
|
||||
AREA_DM,
|
||||
AREA_GRAVEYARD,
|
||||
AREA_LAKE,
|
||||
AREA_GERUDO,
|
||||
AREA_OASIS,
|
||||
|
||||
} AREA_MARKER_TABLE;
|
||||
|
||||
#define EVERYWHERE -32768 // Denotes a virtual actor that is global/ omnipresent.
|
||||
|
||||
|
@ -180,7 +172,8 @@ void ActorAccessibility_InterpretCurrentScene(PlayState* play);
|
|||
void ActorAccessibility_PolyToVirtualActor(PlayState* play, CollisionPoly* poly, VIRTUAL_ACTOR_TABLE va, VirtualActorList* destination);
|
||||
//Report which room of a dungeon the player is in.
|
||||
void ActorAccessibility_AnnounceRoomNumber(PlayState* play);
|
||||
//
|
||||
//Aim cue support.
|
||||
void ActorAccessibility_ProvideAimAssistForActor(AccessibleActor* actor);
|
||||
// External audio engine stuff.
|
||||
// Initialize the accessible audio engine.
|
||||
bool ActorAccessibility_InitAudio();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue