forked from Ares-Developers/YRpp
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathMessageListClass.h
112 lines (83 loc) · 3.11 KB
/
MessageListClass.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
Use this to print a message on the screen!
*/
#pragma once
#include <wchar.h>
#include <ASMMacros.h>
#include <ColorScheme.h>
#include <TextLabelClass.h>
#include <CommandClass.h>
#include <Helpers/CompileTime.h>
// https://github.com/electronicarts/CnC_Remastered_Collection/blob/7d496e8a633a8bbf8a14b65f490b4d21fa32ca03/REDALERT/MSGLIST.H
class MessageListClass
{
public:
DEFINE_REFERENCE(MessageListClass, Instance, 0xA8BC60u)
explicit MessageListClass() noexcept
{ JMP_THIS(0x5D39D0); }
~MessageListClass() noexcept
{ JMP_THIS(0x5D3A40); }
void Init(int X, int Y, int MaxMsg, int MaxChars, int Height, int EditX, int EditY, int EnableOverflow, int OverflowStart, int OverflowEnd, int Width = 640)
{ JMP_THIS(0x5D3A60); }
TextLabelClass* AddMessage(const wchar_t* Name, int ID, const wchar_t* Message, int ColorSchemeIdx, TextPrintType Style, int Timeout, bool SinglePlayer)
{ JMP_THIS(0x5D3BA0); }
wchar_t* GetMessage(int ID) const
{ JMP_THIS(0x5D3F60); }
TextLabelClass* GetLabel(int ID) const
{ JMP_THIS(0x5D3F90); }
bool ConcatMessage(const wchar_t* Name, int ID, const wchar_t* Message, int Timeout)
{ JMP_THIS(0x5D3FC0); }
void SetEditFocus() const
{ JMP_THIS(0x5D41E0); }
bool HasEditFocus() const
{ JMP_THIS(0x5D41F0); }
TextLabelClass* AddEdit(int ColorSchemeIdx, TextPrintType Style, wchar_t* Message, char CursorCharacter = 0, int Width = 640)
{ JMP_THIS(0x5D4210); }
void RemoveEdit()
{ JMP_THIS(0x5D4390); }
wchar_t* GetEditBuffer() const
{ JMP_THIS(0x5D4400); }
void SetEditColor(int ColorSchemeIdx)
{ JMP_THIS(0x5D4410); }
int Manage()
{ JMP_THIS(0x5D4430); }
int Input(int& Input, int DefInput = 0)
{ JMP_THIS(0x5D4510); }
void Draw() const
{ JMP_THIS(0x5D49A0); }
int NumMessages() const
{ JMP_THIS(0x5D4AA0); }
void SetWidth(int width)
{ JMP_THIS(0x5D4AD0); }
int TrimMessage(wchar_t* dest, wchar_t* src, int min_chars, int max_chars, int scandir)
{ JMP_THIS(0x5D4B20); }
void ComputeY()
{ JMP_THIS(0x5D4BF0); }
// if pLabel is given, the message will be {$pLabel}:{$pMessage}
// else it will be just {$pMessage}
void PrintMessage(const wchar_t* pMessage, int durationFrames = 0x96, int nColorSchemeIndex = ColorScheme::White, bool bSilent = false)
{ this->AddMessage(nullptr, 0, pMessage, nColorSchemeIndex, static_cast<TextPrintType>(0x4046), durationFrames, bSilent); }
void PrintMessage(const wchar_t* pMessage, double durationMinutes, int nColorSchemeIndex = ColorScheme::White, bool bSilent = false)
{ this->AddMessage(nullptr, 0, pMessage, nColorSchemeIndex, static_cast<TextPrintType>(0x4046), static_cast<int>(durationMinutes * 900), bSilent); }
TextLabelClass* MessageList;
Point2D MessagePos;
int MaxMessageCount;
int MaxCharacters;
int Height;
bool EnableOverflow;
bool IsEdit;
bool AdjustEdit;
Point2D EditPos;
TextLabelClass* EditLabel;
wchar_t EditBuffer[162];
wchar_t OverflowBuffer[162];
DWORD EditCurrentPos;
DWORD EditInitialPos;
wchar_t CursorCharacter;
DWORD OverflowStart;
DWORD OverflowEnd;
int Width;
wchar_t MessageBuffers[14][162];
wchar_t BufferAvail[14];
};
static_assert(sizeof(MessageListClass) == 0x149C);