Overhaul animation queues so the queue is stored as a single encoded string.

This commit is contained in:
2023-07-26 17:40:20 -04:00
parent 2dff145885
commit b459eedc82
10 changed files with 239 additions and 242 deletions

View File

@@ -377,30 +377,21 @@ void DrivenEngine::drv_get_tangibles_near(uint64_t tanid, double rx, double ry,
assert(hash1 == hash2);
}
void DrivenEngine::drv_get_animation_queue_hashes(uint32_t count, const int64_t *ids, uint64_t *hashes) {
if (visible_world_ == 0) {
void DrivenEngine::drv_get_animation_queues(uint32_t count, const int64_t *ids, uint32_t *lengths, const char **strings) {
anim_queues_.resize(count);
if (visible_world_ == nullptr) {
util::SharedStdString empty = std::make_shared<std::string>("");
for (int i = 0; i < int(count); i++) {
hashes[i] = 0;
anim_queues_[i] = empty;
}
} else {
visible_world_->get_animation_queue_hashes(count, ids, hashes);
visible_world_->get_encoded_animation_queues(count, ids, anim_queues_);
}
}
void DrivenEngine::drv_get_animation_queue(uint64_t tanid, uint32_t *count, AnimEntry **entries) {
uint32_t hash1 = eng::memhash();
anim_queue_result_.clear();
if ((visible_world_ != 0) && (tanid != 0)) {
visible_world_->get_animation_queue(tanid, &anim_queue_result_);
for (int i = 0; i < int(count); i++) {
lengths[i] = anim_queues_[i]->size();
strings[i] = anim_queues_[i]->c_str();
}
*count = anim_queue_result_.size();
if (count > 0) {
*entries = &(anim_queue_result_[0]);
} else {
*entries = nullptr;
}
uint32_t hash2 = eng::memhash();
assert(hash1 == hash2);
}
//////////////////////////////////////////////////////////////////////////////
@@ -532,13 +523,10 @@ static void drv_get_tangibles_near(EngineWrapper *w, uint64_t tanid, double rx,
return w->engine->drv_get_tangibles_near(tanid, rx, ry, rz, count, ids);
}
static void drv_get_animation_queue_hashes(EngineWrapper *w, uint32_t count, const int64_t *ids, uint64_t *hashes) {
return w->engine->drv_get_animation_queue_hashes(count, ids, hashes);
static void drv_get_animation_queues(EngineWrapper *w, uint32_t count, const int64_t *ids, uint32_t *lengths, const char **strings) {
return w->engine->drv_get_animation_queues(count, ids, lengths, strings);
}
static void drv_get_animation_queue(EngineWrapper *w, int64_t tanid, uint32_t *count, EngineWrapper::AnimEntry **entries) {
return w->engine->drv_get_animation_queue(tanid, count, entries);
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
@@ -935,9 +923,8 @@ static void init_engine_wrapper_helper(EngineWrapper *w) {
w->get_stop_driver = drv_get_stop_driver;
w->get_actor_id = drv_get_actor_id;
w->get_tangibles_near = drv_get_tangibles_near;
w->get_animation_queue_hashes = drv_get_animation_queue_hashes;
w->get_animation_queue = drv_get_animation_queue;
w->get_animation_queues = drv_get_animation_queues;
w->play_initialize = play_initialize;
w->play_clear_new_outgoing = play_clear_new_outgoing;
w->play_sent_outgoing = play_sent_outgoing;