From dffbd3125c9c4d0e83cd0918efe15655e94ecf68 Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Tue, 11 May 2021 19:32:59 -0700 Subject: [PATCH] Fix StoatSpriteEngine.ADVLogList_GetADVLogVoice This function has a different interface than the AnteaterADVEngine version. --- src/hll/AnteaterADVEngine.c | 9 +++++++++ src/hll/AnteaterADVEngine.h | 1 + src/hll/StoatSpriteEngine.c | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/hll/AnteaterADVEngine.c b/src/hll/AnteaterADVEngine.c index f86f171..3ca7392 100644 --- a/src/hll/AnteaterADVEngine.c +++ b/src/hll/AnteaterADVEngine.c @@ -171,6 +171,15 @@ int ADVLogList_GetADVLogVoice(int log_no, int voice_no) return logs[log_no].voices[voice_no]; } +int ADVLogList_GetADVLogVoiceLast(int log_no) +{ + check_log_nr(log_no); + unsigned nr_voices = logs[log_no].nr_voices; + if (!nr_voices) + return 0; + return logs[log_no].voices[nr_voices - 1]; +} + bool ADVLogList_Save(struct page **iarray) { // 0x64 <- 'A' diff --git a/src/hll/AnteaterADVEngine.h b/src/hll/AnteaterADVEngine.h index c099a0c..d65ad8a 100644 --- a/src/hll/AnteaterADVEngine.h +++ b/src/hll/AnteaterADVEngine.h @@ -34,6 +34,7 @@ int ADVLogList_GetNumofADVLogText(int nADVLog); void ADVLogList_GetADVLogText(int nADVLog, int nText, struct string **text); int ADVLogList_GetNumofADVLogVoice(int nADVLog); int ADVLogList_GetADVLogVoice(int nADVLog, int Index); +int ADVLogList_GetADVLogVoiceLast(int log_no); // for StoatSpriteEngine bool ADVLogList_Save(struct page **iarray); bool ADVLogList_Load(struct page **iarray); bool ADVSceneKeeper_AddADVScene(struct page **page); diff --git a/src/hll/StoatSpriteEngine.c b/src/hll/StoatSpriteEngine.c index adf3a41..cae58c5 100644 --- a/src/hll/StoatSpriteEngine.c +++ b/src/hll/StoatSpriteEngine.c @@ -933,6 +933,7 @@ HLL_LIBRARY(StoatSpriteEngine, HLL_EXPORT(ADVLogList_GetNumofADVLog, ADVLogList_GetNumofADVLog), HLL_EXPORT(ADVLogList_GetNumofADVLogText, ADVLogList_GetNumofADVLogText), HLL_EXPORT(ADVLogList_GetADVLogText, ADVLogList_GetADVLogText), - HLL_EXPORT(ADVLogList_GetADVLogVoice, ADVLogList_GetADVLogVoice), + // XXX: StoatSpriteEngine interface differs from AnteaterADVEngine here + HLL_EXPORT(ADVLogList_GetADVLogVoice, ADVLogList_GetADVLogVoiceLast), HLL_EXPORT(ADVLogList_Save, ADVLogList_Save), HLL_EXPORT(ADVLogList_Load, ADVLogList_Load));