Skip to content

Commit

Permalink
Merge pull request #111 from alessandrofama/fix-room
Browse files Browse the repository at this point in the history
Fix AkRoom not detecting moving between rooms
  • Loading branch information
alessandrofama authored Nov 5, 2024
2 parents ff5bfc4 + 42ceeb7 commit cc8a7ae
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions addons/Wwise/native/src/scene/ak_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,6 @@ void AkEvent3D::set_is_environment_aware(bool is_environment_aware)

bool AkEvent3D::get_is_environment_aware() const { return is_environment_aware; }

void AkEvent3D::set_room_id(int room_id) { this->room_id = room_id; }
void AkEvent3D::set_room_id(uint64_t room_id) { this->room_id = room_id; }

int AkEvent3D::get_room_id() const { return room_id; }
uint64_t AkEvent3D::get_room_id() const { return room_id; }
10 changes: 5 additions & 5 deletions addons/Wwise/native/src/scene/ak_event.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#pragma once

#include "AK/SoundEngine/Common/AkTypes.h"
#include "core/wwise_cookie.h"
#include "core/ak_utils.h"
#include "core/utils.h"
#include "core/wwise_cookie.h"
#include "core/wwise_gdextension.h"
#include "scene/ak_environment_data.h"
#include <godot_cpp/classes/node2d.hpp>
#include <godot_cpp/classes/node3d.hpp>
#include <godot_cpp/classes/thread.hpp>
#include <godot_cpp/variant/dictionary.hpp>
#include "scene/ak_environment_data.h"

using namespace godot;

Expand Down Expand Up @@ -88,7 +88,7 @@ class AkEvent3D : public Node3D

void check_signal_connections();

int room_id = INVALID_ROOM_ID;
uint64_t room_id = INVALID_ROOM_ID;

public:
AkEnvironmentData* environment_data = nullptr;
Expand Down Expand Up @@ -124,6 +124,6 @@ class AkEvent3D : public Node3D
void set_is_environment_aware(bool is_environment_aware);
bool get_is_environment_aware() const;

void set_room_id(int room_id);
int get_room_id() const;
void set_room_id(uint64_t room_id);
uint64_t get_room_id() const;
};
4 changes: 2 additions & 2 deletions addons/Wwise/native/src/scene/ak_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ void AkListener3D::set_is_spatial(bool is_spatial) { this->is_spatial = is_spati

bool AkListener3D::get_is_spatial() const { return is_spatial; }

void AkListener3D::set_room_id(int room_id) { this->room_id = room_id; }
void AkListener3D::set_room_id(uint64_t room_id) { this->room_id = room_id; }

int AkListener3D::get_room_id() const { return room_id; }
uint64_t AkListener3D::get_room_id() const { return room_id; }
6 changes: 3 additions & 3 deletions addons/Wwise/native/src/scene/ak_listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AkListener3D : public Node3D

private:
bool is_spatial{};
int room_id = INVALID_ROOM_ID;
uint64_t room_id = INVALID_ROOM_ID;

public:
virtual void _enter_tree() override;
Expand All @@ -37,6 +37,6 @@ class AkListener3D : public Node3D
void set_is_spatial(bool is_spatial);
bool get_is_spatial() const;

void set_room_id(int room_id);
int get_room_id() const;
void set_room_id(uint64_t room_id);
uint64_t get_room_id() const;
};
8 changes: 4 additions & 4 deletions addons/Wwise/native/src/scene/ak_room.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ void AkRoom::_on_area_entered(const Area3D* area)
{
// If we have an AkListener3D or an AkEvent3D, keep track
// of the room it's entering.
AkListener3D* listener = static_cast<AkListener3D*>(parent);
AkEvent3D* event = static_cast<AkEvent3D*>(parent);
AkListener3D* listener = Object::cast_to<AkListener3D>(parent);
AkEvent3D* event = Object::cast_to<AkEvent3D>(parent);
if (listener)
{
listener->set_room_id(static_cast<AkGameObjectID>(this->get_instance_id()));
Expand Down Expand Up @@ -124,8 +124,8 @@ void AkRoom::_on_area_exited(const Area3D* area)
// to INVALID_ROOM_ID.
bool isGoingOutside = false;

AkListener3D* listener = static_cast<AkListener3D*>(parent);
AkEvent3D* event = static_cast<AkEvent3D*>(parent);
AkListener3D* listener = Object::cast_to<AkListener3D>(parent);
AkEvent3D* event = Object::cast_to<AkEvent3D>(parent);
if (listener)
{
isGoingOutside = listener->get_room_id() == static_cast<AkGameObjectID>(this->get_instance_id());
Expand Down

0 comments on commit cc8a7ae

Please sign in to comment.