2022-08-30 14:22:17 -07:00
|
|
|
#ifndef JMESSAGE_CONTROL_H
|
|
|
|
|
#define JMESSAGE_CONTROL_H
|
2021-03-28 22:49:05 +02:00
|
|
|
|
2022-06-29 13:19:09 -07:00
|
|
|
#include "JSystem/JMessage/processor.h"
|
2021-03-28 22:49:05 +02:00
|
|
|
|
2022-03-15 02:25:25 -07:00
|
|
|
namespace JMessage {
|
2024-04-12 00:10:30 -06:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup jsystem-jmessage
|
|
|
|
|
*
|
|
|
|
|
*/
|
2022-03-15 02:35:30 -07:00
|
|
|
struct TControl {
|
|
|
|
|
/* 802A7548 */ TControl();
|
2022-06-29 13:19:09 -07:00
|
|
|
/* 802A758C */ virtual ~TControl();
|
|
|
|
|
|
2022-03-15 02:35:30 -07:00
|
|
|
/* 802A75D4 */ void reset();
|
2023-02-19 09:40:57 -08:00
|
|
|
/* 802A7634 */ int update();
|
2022-03-15 02:35:30 -07:00
|
|
|
/* 802A76BC */ void render();
|
2025-06-13 05:33:33 -07:00
|
|
|
/* 802A77E8 */ int setMessageCode(u16 u16GroupID, u16 u16Index);
|
|
|
|
|
/* 802A78F4 */ int setMessageID(u32 uMsgID, u32 param_1, bool* pbValid);
|
|
|
|
|
/* 802A7A20 */ bool setMessageCode_inSequence_(const TProcessor* pProcessor, u16 u16GroupID, u16 u16Index);
|
2023-02-19 09:40:57 -08:00
|
|
|
|
|
|
|
|
bool isReady_update_() const { return pMessageText_begin_ != 0 && pSequenceProcessor_ != NULL; }
|
2025-06-13 05:33:33 -07:00
|
|
|
bool isReady_render_() const { return pMessageText_current_ != 0 && pRenderingProcessor_ != NULL; }
|
2023-02-19 09:40:57 -08:00
|
|
|
|
|
|
|
|
TProcessor* getProcessor() const {
|
2025-06-13 05:33:33 -07:00
|
|
|
if (pSequenceProcessor_ != NULL) {
|
|
|
|
|
return (TProcessor*)pSequenceProcessor_;
|
|
|
|
|
} else {
|
|
|
|
|
return (TProcessor*)pRenderingProcessor_;
|
|
|
|
|
}
|
2023-02-19 09:40:57 -08:00
|
|
|
}
|
|
|
|
|
|
2025-06-13 05:33:33 -07:00
|
|
|
int setMessageCode(u32 uCode) {
|
|
|
|
|
return setMessageCode(uCode >> 16, uCode);
|
2024-08-07 13:18:30 +03:00
|
|
|
}
|
|
|
|
|
|
2025-06-13 05:33:33 -07:00
|
|
|
int setMessageCode_inReset_(const TProcessor* pProcessor, u16 u16GroupID, u16 u16Index) {
|
|
|
|
|
JUT_ASSERT(138, pEntry_==0);
|
|
|
|
|
JUT_ASSERT(139, pszText_update_current_==0);
|
|
|
|
|
JUT_ASSERT(140, oStack_renderingProcessor_.empty());
|
|
|
|
|
|
|
|
|
|
if (!setMessageCode_inSequence_(pProcessor, u16GroupID, u16Index)) {
|
2023-02-19 09:40:57 -08:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isReady_update_()) {
|
2025-06-13 05:33:33 -07:00
|
|
|
pSequenceProcessor_->setBegin_messageEntryText(pResourceCache_, pEntry_, pMessageText_begin_);
|
2023-02-19 09:40:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char* getMessageText_begin() const { return pMessageText_begin_; }
|
|
|
|
|
void* getMessageEntry() const { return pEntry_; }
|
2025-06-13 05:33:33 -07:00
|
|
|
u32 getMessageCode() const { return (uMessageGroupID_ << 16) | uMessageID_; }
|
|
|
|
|
void setSequenceProcessor(TSequenceProcessor* pProcessor) { pSequenceProcessor_ = pProcessor; }
|
|
|
|
|
void setRenderingProcessor(TRenderingProcessor* pProcessor) { pRenderingProcessor_ = pProcessor; }
|
|
|
|
|
|
2024-01-03 05:37:15 +02:00
|
|
|
void resetResourceCache() {
|
|
|
|
|
if (pSequenceProcessor_ != NULL) {
|
|
|
|
|
pSequenceProcessor_->resetResourceCache();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pRenderingProcessor_ != NULL) {
|
|
|
|
|
pRenderingProcessor_->resetResourceCache();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pResourceCache_ = NULL;
|
|
|
|
|
}
|
2022-06-29 13:19:09 -07:00
|
|
|
|
2024-08-07 13:18:30 +03:00
|
|
|
void render_synchronize() {
|
|
|
|
|
if (isReady_render_()) {
|
2025-06-13 05:33:33 -07:00
|
|
|
pMessageText_current_ = pszText_update_current_;
|
2024-08-07 13:18:30 +03:00
|
|
|
oStack_renderingProcessor_ = pRenderingProcessor_->oStack_;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-29 13:19:09 -07:00
|
|
|
/* 0x04 */ TSequenceProcessor* pSequenceProcessor_;
|
|
|
|
|
/* 0x08 */ TRenderingProcessor* pRenderingProcessor_;
|
2025-06-13 05:33:33 -07:00
|
|
|
/* 0x0C */ u16 uMessageGroupID_;
|
|
|
|
|
/* 0x0E */ u16 uMessageID_;
|
2023-02-19 09:40:57 -08:00
|
|
|
/* 0x10 */ const TResource* pResourceCache_;
|
2022-06-29 13:19:09 -07:00
|
|
|
/* 0x14 */ void* pEntry_;
|
2023-02-19 09:40:57 -08:00
|
|
|
/* 0x18 */ const char* pMessageText_begin_;
|
|
|
|
|
/* 0x1C */ const char* pszText_update_current_;
|
2025-06-13 05:33:33 -07:00
|
|
|
/* 0x20 */ const char* pMessageText_current_;
|
2022-06-29 13:19:09 -07:00
|
|
|
/* 0x24 */ TProcessor::TStack_ oStack_renderingProcessor_;
|
2022-03-15 02:25:25 -07:00
|
|
|
};
|
2022-03-15 02:35:30 -07:00
|
|
|
}; // namespace JMessage
|
2022-03-15 02:25:25 -07:00
|
|
|
|
2022-08-30 14:22:17 -07:00
|
|
|
#endif /* JMESSAGE_CONTROL_H */
|