forked from diasurgical/devilution
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplrmsg.cpp
More file actions
218 lines (200 loc) · 4.05 KB
/
plrmsg.cpp
File metadata and controls
218 lines (200 loc) · 4.05 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
//HEADER_GOES_HERE
#include "../types.h"
int plrmsg_ticks; // weak
char plr_msg_slot; // weak
_plrmsg plr_msgs[8];
text_color text_color_from_player_num[2] = { COL_WHITE, COL_GOLD };
void __fastcall plrmsg_delay(int a1)
{
_plrmsg *pMsg; // eax
signed int v2; // ecx
if ( a1 )
{
plrmsg_ticks = -GetTickCount();
}
else
{
plrmsg_ticks += GetTickCount();
pMsg = plr_msgs;
v2 = 8;
do
{
pMsg->time += plrmsg_ticks;
++pMsg;
--v2;
}
while ( v2 );
}
}
// 69B7D0: using guessed type int plrmsg_ticks;
char *__fastcall ErrorPlrMsg(char *pszMsg)
{
_plrmsg *pMsg; // esi
char *v2; // edi
char *result; // eax
pMsg = &plr_msgs[(unsigned char)plr_msg_slot];
v2 = pszMsg;
plr_msg_slot = (plr_msg_slot + 1) & 7;
pMsg->player = 4;
pMsg->time = GetTickCount();
result = strncpy(pMsg->str, v2, 0x90u);
pMsg->str[143] = 0;
return result;
}
// 69B7D4: using guessed type char plr_msg_slot;
size_t EventPlrMsg(char *pszFmt, ...)
{
char *v1; // esi
va_list va; // [esp+Ch] [ebp+8h]
va_start(va, pszFmt);
v1 = (char *)&plr_msgs[(unsigned char)plr_msg_slot];
plr_msg_slot = (plr_msg_slot + 1) & 7;
v1[4] = 4;
*(_DWORD *)v1 = GetTickCount();
v1 += 5;
vsprintf(v1, pszFmt, va);
return strlen(v1);
}
// 69B7D4: using guessed type char plr_msg_slot;
void __fastcall SendPlrMsg(int pnum, const char *pszStr)
{
_plrmsg *pMsg; // esi
int v3; // ebx
const char *v4; // ebp
int v5; // edi
const char *v6; // ebx
pMsg = &plr_msgs[(unsigned char)plr_msg_slot];
v3 = pnum;
v4 = pszStr;
plr_msg_slot = (plr_msg_slot + 1) & 7;
pMsg->player = pnum;
pMsg->time = GetTickCount();
v5 = v3;
v6 = plr[v3]._pName;
strlen(v6); /* these are used in debug */
strlen(v4);
sprintf(pMsg->str, "%s (lvl %d): %s", v6, plr[v5]._pLevel, v4);
}
// 69B7D4: using guessed type char plr_msg_slot;
void __cdecl ClearPlrMsg()
{
_plrmsg *pMsg; // esi
DWORD v1; // eax
signed int v2; // ecx
pMsg = plr_msgs;
v1 = GetTickCount();
v2 = 8;
do
{
if ( (signed int)(v1 - pMsg->time) > 10000 )
pMsg->str[0] = 0;
++pMsg;
--v2;
}
while ( v2 );
}
void __cdecl InitPlrMsg()
{
memset(plr_msgs, 0, 0x4C0u);
plr_msg_slot = 0;
}
// 69B7D4: using guessed type char plr_msg_slot;
void __cdecl DrawPlrMsg()
{
int v0; // ebx
int v1; // ebp
int v2; // edi
char *v3; // esi
signed int v4; // [esp+Ch] [ebp-4h]
v0 = 74;
v1 = 230;
v2 = 620;
if ( chrflag || questlog )
{
if ( invflag || sbookflag )
return;
v0 = 394;
goto LABEL_9;
}
if ( invflag || sbookflag )
LABEL_9:
v2 = 300;
v3 = plr_msgs[0].str;
v4 = 8;
do
{
if ( *v3 )
PrintPlrMsg(v0, v1, v2, v3, *((unsigned char *)text_color_from_player_num + (unsigned char)*(v3 - 1)));
v3 += 152;
v1 += 35;
--v4;
}
while ( v4 );
}
// 4B8968: using guessed type int sbookflag;
// 69BD04: using guessed type int questlog;
void __fastcall PrintPlrMsg(int no, int x, int y, char *str, int just)
{
char *v5; // edi
int *v6; // edx
int v7; // esi
char *v8; // edx
int v9; // esi
unsigned int v10; // eax
unsigned char v11; // cl
unsigned char v12; // cl
int v13; // eax
unsigned char v14; // bl
int v15; // [esp+Ch] [ebp-Ch]
int *v16; // [esp+10h] [ebp-8h]
int v17; // [esp+14h] [ebp-4h]
char *stra; // [esp+24h] [ebp+Ch]
v17 = 0;
v5 = str;
v15 = no;
if ( *str )
{
v6 = &screen_y_times_768[x];
v16 = v6;
do
{
v7 = *v6;
v8 = v5;
v9 = v15 + v7;
v10 = 0;
stra = v5;
while ( 1 )
{
v11 = *v8;
if ( !*v8 )
break;
++v8;
v12 = fontframe[fontidx[v11]];
v10 += fontkern[v12] + 1;
if ( v12 )
{
if ( v10 >= y )
goto LABEL_13;
}
else
{
stra = v8;
}
}
stra = v8;
LABEL_13:
while ( v5 < stra )
{
v13 = (unsigned char)*v5++;
v14 = fontframe[fontidx[v13]];
if ( v14 )
CPrintString(v9, v14, just);
v9 += fontkern[v14] + 1;
}
v6 = v16 + 10;
++v17;
v16 += 10;
}
while ( v17 != 3 && *v5 );
}
}