author | Darkvater |
Wed, 13 Dec 2006 22:38:45 +0000 | |
changeset 5332 | ffb2e98b961e |
parent 5026 | c8b7148798ac |
child 5375 | 44fe20777771 |
child 5623 | ef2a8a524a95 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1881
diff
changeset
|
4 |
#include "openttd.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2153
diff
changeset
|
5 |
#include "functions.h" |
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
6 |
#include "macros.h" |
1309
dab90d4cbf2d
(svn r1813) Declare functions implemented in strings.c in their own shiny new header (though i think some of these function don't belong into strings.c)
tron
parents:
1174
diff
changeset
|
7 |
#include "strings.h" |
0 | 8 |
#include "gfx.h" |
9 |
#include "viewport.h" |
|
10 |
#include "saveload.h" |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
11 |
#include "hal.h" |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
12 |
#include "console.h" |
1595
b1a8323c1024
(svn r2099) -Fix: no longer chat-messages hang when the game wraps around 2090
truelight
parents:
1569
diff
changeset
|
13 |
#include "string.h" |
2153
91e89aa8c299
(svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron
parents:
2062
diff
changeset
|
14 |
#include "variables.h" |
2218
abd47ef7d902
(svn r2736) -Codechange: De-mystified GfxDrawFillRect a bit, and used enums from table/sprites.h. You can now change the number of bits used for sprites and switches in the SpriteSetup enum and the rest should work automagically. Can be used to increase the number of active sprites to 2^19 in case there are no colortables (recolor sprites) in any newgrf. We should possibly move the the colortables to an own list, but how to detect them in a newgrf.
celestar
parents:
2186
diff
changeset
|
15 |
#include "table/sprites.h" |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
16 |
#include <stdarg.h> /* va_list */ |
4261
2ec8f5a9747b
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
2685
diff
changeset
|
17 |
#include "date.h" |
0 | 18 |
|
19 |
typedef struct TextEffect { |
|
20 |
StringID string_id; |
|
849
c6223dbdb202
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
835
diff
changeset
|
21 |
int32 x; |
c6223dbdb202
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
835
diff
changeset
|
22 |
int32 y; |
c6223dbdb202
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
835
diff
changeset
|
23 |
int32 right; |
c6223dbdb202
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
835
diff
changeset
|
24 |
int32 bottom; |
0 | 25 |
uint16 duration; |
26 |
uint32 params_1; |
|
27 |
uint32 params_2; |
|
28 |
} TextEffect; |
|
29 |
||
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
30 |
#define MAX_TEXTMESSAGE_LENGTH 150 |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
31 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
32 |
typedef struct TextMessage { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
33 |
char message[MAX_TEXTMESSAGE_LENGTH]; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
34 |
uint16 color; |
4363
3a3a2a3dda00
(svn r6078) -Fix: forgot one uint16 -> Date conversion. Tnx to #openttdcoop team for detecting and Rubidium for finding the cause.
truelight
parents:
4261
diff
changeset
|
35 |
Date end_date; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
36 |
} TextMessage; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
37 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
38 |
#define MAX_CHAT_MESSAGES 10 |
0 | 39 |
static TextEffect _text_effect_list[30]; |
4956
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
40 |
static TextMessage _textmsg_list[MAX_CHAT_MESSAGES]; |
0 | 41 |
TileIndex _animated_tile_list[256]; |
42 |
||
4956
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
43 |
static bool _textmessage_dirty = false; |
2548
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2470
diff
changeset
|
44 |
static bool _textmessage_visible = false; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
45 |
|
4956
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
46 |
/* The chatbox grows from the bottom so the coordinates are pixels from |
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
47 |
* the left and pixels from the bottom. The height is the maximum height */ |
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
48 |
static const Oblong _textmsg_box = {10, 30, 500, 150}; |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
49 |
static Pixel _textmessage_backup[150 * 500]; // (height * width) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
50 |
|
4958 | 51 |
extern void memcpy_pitch(void *dst, void *src, int w, int h, int srcpitch, int dstpitch); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
52 |
|
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
53 |
static inline uint GetTextMessageCount(void) |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
54 |
{ |
4959
828f9223446d
(svn r6958) -Fix (r6956): GCC warning (thx Tron) and a coding style forgotten in r6957
Darkvater
parents:
4958
diff
changeset
|
55 |
uint i; |
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
56 |
|
4959
828f9223446d
(svn r6958) -Fix (r6956): GCC warning (thx Tron) and a coding style forgotten in r6957
Darkvater
parents:
4958
diff
changeset
|
57 |
for (i = 0; i < MAX_CHAT_MESSAGES; i++) { |
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
58 |
if (_textmsg_list[i].message[0] == '\0') break; |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
59 |
} |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
60 |
|
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
61 |
return i; |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
62 |
} |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
63 |
|
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
64 |
/* Add a text message to the 'chat window' to be shown |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
65 |
* @param color The colour this message is to be shown in |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
66 |
* @param duration The duration of the chat message in game-days |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
67 |
* @param message message itself in printf() style */ |
1022
9ea8ee93d6a9
(svn r1523) -Fix: somehow mousewheel was disabled on windows using SDL; reenabled again
darkvater
parents:
849
diff
changeset
|
68 |
void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
69 |
{ |
2455 | 70 |
char buf[MAX_TEXTMESSAGE_LENGTH]; |
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
71 |
const char *bufp; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
72 |
va_list va; |
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
73 |
uint msg_count; |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
74 |
uint16 lines; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
75 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
76 |
va_start(va, message); |
2373
f06403621870
(svn r2899) -Fix: Several format string vulnerabilities and buffer overflows in the network code
tron
parents:
2295
diff
changeset
|
77 |
vsnprintf(buf, lengthof(buf), message, va); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
78 |
va_end(va); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
79 |
|
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
80 |
/* Force linebreaks for strings that are too long */ |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
81 |
lines = GB(FormatStringLinebreaks(buf, _textmsg_box.width - 8), 0, 16) + 1; |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
82 |
if (lines >= MAX_CHAT_MESSAGES) return; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
83 |
|
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
84 |
msg_count = GetTextMessageCount(); |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
85 |
/* We want to add more chat messages than there is free space for, remove 'old' */ |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
86 |
if (lines > MAX_CHAT_MESSAGES - msg_count) { |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
87 |
int i = lines - (MAX_CHAT_MESSAGES - msg_count); |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
88 |
memmove(&_textmsg_list[0], &_textmsg_list[i], sizeof(_textmsg_list[0]) * (msg_count - i)); |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
89 |
msg_count = MAX_CHAT_MESSAGES - lines; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
90 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
91 |
|
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
92 |
for (bufp = buf; lines != 0; lines--) { |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
93 |
TextMessage *tmsg = &_textmsg_list[msg_count++]; |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
94 |
ttd_strlcpy(tmsg->message, bufp, sizeof(tmsg->message)); |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
95 |
|
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
96 |
/* The default colour for a message is player colour. Replace this with |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
97 |
* white for any additional lines */ |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
98 |
tmsg->color = (bufp == buf && color & IS_PALETTE_COLOR) ? color : (0x1D - 15) | IS_PALETTE_COLOR; |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
99 |
tmsg->end_date = _date + duration; |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
100 |
|
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
101 |
bufp += strlen(bufp) + 1; // jump to 'next line' in the formatted string |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
102 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
103 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
104 |
_textmessage_dirty = true; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
105 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
106 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1022
diff
changeset
|
107 |
void InitTextMessage(void) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
108 |
{ |
2639 | 109 |
uint i; |
110 |
||
111 |
for (i = 0; i < MAX_CHAT_MESSAGES; i++) { |
|
4956
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
112 |
_textmsg_list[i].message[0] = '\0'; |
2639 | 113 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
114 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
115 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
116 |
// Hide the textbox |
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1022
diff
changeset
|
117 |
void UndrawTextMessage(void) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
118 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
119 |
if (_textmessage_visible) { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
120 |
// Sometimes we also need to hide the cursor |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
121 |
// This is because both textmessage and the cursor take a shot of the |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
122 |
// screen before drawing. |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
123 |
// Now the textmessage takes his shot and paints his data before the cursor |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
124 |
// does, so in the shot of the cursor is the screen-data of the textmessage |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
125 |
// included when the cursor hangs somewhere over the textmessage. To |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
126 |
// avoid wrong repaints, we undraw the cursor in that case, and everything |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
127 |
// looks nicely ;) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
128 |
// (and now hope this story above makes sense to you ;)) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
129 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
130 |
if (_cursor.visible) { |
4956
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
131 |
if (_cursor.draw_pos.x + _cursor.draw_size.x >= _textmsg_box.x && |
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
132 |
_cursor.draw_pos.x <= _textmsg_box.x + _textmsg_box.width && |
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
133 |
_cursor.draw_pos.y + _cursor.draw_size.y >= _screen.height - _textmsg_box.y - _textmsg_box.height && |
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
134 |
_cursor.draw_pos.y <= _screen.height - _textmsg_box.y) { |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
135 |
UndrawMouseCursor(); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
136 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
137 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
138 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
139 |
_textmessage_visible = false; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
140 |
// Put our 'shot' back to the screen |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
141 |
memcpy_pitch( |
4956
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
142 |
_screen.dst_ptr + _textmsg_box.x + (_screen.height - _textmsg_box.y - _textmsg_box.height) * _screen.pitch, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
143 |
_textmessage_backup, |
4956
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
144 |
_textmsg_box.width, _textmsg_box.height, _textmsg_box.width, _screen.pitch); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
145 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
146 |
// And make sure it is updated next time |
4956
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
147 |
_video_driver->make_dirty(_textmsg_box.x, _screen.height - _textmsg_box.y - _textmsg_box.height, _textmsg_box.width, _textmsg_box.height); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
148 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
149 |
_textmessage_dirty = true; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
150 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
151 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
152 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
153 |
// Check if a message is expired every day |
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1022
diff
changeset
|
154 |
void TextMessageDailyLoop(void) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
155 |
{ |
2639 | 156 |
uint i; |
157 |
||
1595
b1a8323c1024
(svn r2099) -Fix: no longer chat-messages hang when the game wraps around 2090
truelight
parents:
1569
diff
changeset
|
158 |
for (i = 0; i < MAX_CHAT_MESSAGES; i++) { |
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
159 |
TextMessage *tmsg = &_textmsg_list[i]; |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
160 |
if (tmsg->message[0] == '\0') continue; |
1595
b1a8323c1024
(svn r2099) -Fix: no longer chat-messages hang when the game wraps around 2090
truelight
parents:
1569
diff
changeset
|
161 |
|
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
162 |
/* Message has expired, remove from the list */ |
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
163 |
if (tmsg->end_date < _date) { |
1595
b1a8323c1024
(svn r2099) -Fix: no longer chat-messages hang when the game wraps around 2090
truelight
parents:
1569
diff
changeset
|
164 |
/* Move the remaining messages over the current message */ |
4957
8588d2e7f409
(svn r6956) -Feature: Increase the chatbuffer of chat messages. Messages longer than the allocated
Darkvater
parents:
4956
diff
changeset
|
165 |
if (i != MAX_CHAT_MESSAGES - 1) memmove(tmsg, tmsg + 1, sizeof(*tmsg) * (MAX_CHAT_MESSAGES - i - 1)); |
1595
b1a8323c1024
(svn r2099) -Fix: no longer chat-messages hang when the game wraps around 2090
truelight
parents:
1569
diff
changeset
|
166 |
|
b1a8323c1024
(svn r2099) -Fix: no longer chat-messages hang when the game wraps around 2090
truelight
parents:
1569
diff
changeset
|
167 |
/* Mark the last item as empty */ |
4956
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
168 |
_textmsg_list[MAX_CHAT_MESSAGES - 1].message[0] = '\0'; |
1595
b1a8323c1024
(svn r2099) -Fix: no longer chat-messages hang when the game wraps around 2090
truelight
parents:
1569
diff
changeset
|
169 |
_textmessage_dirty = true; |
b1a8323c1024
(svn r2099) -Fix: no longer chat-messages hang when the game wraps around 2090
truelight
parents:
1569
diff
changeset
|
170 |
|
b1a8323c1024
(svn r2099) -Fix: no longer chat-messages hang when the game wraps around 2090
truelight
parents:
1569
diff
changeset
|
171 |
/* Go one item back, because we moved the array 1 to the left */ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
172 |
i--; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
173 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
174 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
175 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
176 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
177 |
// Draw the textmessage-box |
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1022
diff
changeset
|
178 |
void DrawTextMessage(void) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
179 |
{ |
4960
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
180 |
uint y, count; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
181 |
|
2639 | 182 |
if (!_textmessage_dirty) return; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
183 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
184 |
// First undraw if needed |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
185 |
UndrawTextMessage(); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
186 |
|
4959
828f9223446d
(svn r6958) -Fix (r6956): GCC warning (thx Tron) and a coding style forgotten in r6957
Darkvater
parents:
4958
diff
changeset
|
187 |
if (_iconsole_mode == ICONSOLE_FULL) return; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
188 |
|
1595
b1a8323c1024
(svn r2099) -Fix: no longer chat-messages hang when the game wraps around 2090
truelight
parents:
1569
diff
changeset
|
189 |
/* Check if we have anything to draw at all */ |
4960
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
190 |
count = GetTextMessageCount(); |
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
191 |
if (count == 0) return; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
192 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
193 |
// Make a copy of the screen as it is before painting (for undraw) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
194 |
memcpy_pitch( |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
195 |
_textmessage_backup, |
4956
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
196 |
_screen.dst_ptr + _textmsg_box.x + (_screen.height - _textmsg_box.y - _textmsg_box.height) * _screen.pitch, |
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
197 |
_textmsg_box.width, _textmsg_box.height, _screen.pitch, _textmsg_box.width); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
198 |
|
4960
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
199 |
_cur_dpi = &_screen; // switch to _screen painting |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
200 |
|
4960
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
201 |
/* Paint a half-transparent box behind the text messages */ |
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
202 |
GfxFillRect( |
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
203 |
_textmsg_box.x, |
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
204 |
_screen.height - _textmsg_box.y - count * 13 - 2, |
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
205 |
_textmsg_box.x + _textmsg_box.width - 1, |
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
206 |
_screen.height - _textmsg_box.y - 2, |
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
207 |
0x322 | USE_COLORTABLE // black, but with some alpha for background |
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
208 |
); |
1595
b1a8323c1024
(svn r2099) -Fix: no longer chat-messages hang when the game wraps around 2090
truelight
parents:
1569
diff
changeset
|
209 |
|
4960
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
210 |
/* Paint the messages starting with the lowest at the bottom */ |
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
211 |
for (y = 13; count-- != 0; y += 13) { |
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
212 |
DoDrawString(_textmsg_list[count].message, _textmsg_box.x + 3, _screen.height - _textmsg_box.y - y + 1, _textmsg_list[count].color); |
cb06aa866acb
(svn r6959) -Codechange: Move GfxFillRect() out of the chat-message drawing loop since we already
Darkvater
parents:
4959
diff
changeset
|
213 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
214 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
215 |
// Make sure the data is updated next flush |
4956
76db5a2689fc
(svn r6955) -Codechange: Change some variable names for _textmessage_box, and replace 5 different
Darkvater
parents:
4912
diff
changeset
|
216 |
_video_driver->make_dirty(_textmsg_box.x, _screen.height - _textmsg_box.y - _textmsg_box.height, _textmsg_box.width, _textmsg_box.height); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
217 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
218 |
_textmessage_visible = true; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
219 |
_textmessage_dirty = false; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
220 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
221 |
|
0 | 222 |
static void MarkTextEffectAreaDirty(TextEffect *te) |
223 |
{ |
|
224 |
MarkAllViewportsDirty( |
|
225 |
te->x, |
|
226 |
te->y - 1, |
|
227 |
(te->right - te->x)*2 + te->x + 1, |
|
228 |
(te->bottom - (te->y - 1)) * 2 + (te->y - 1) + 1 |
|
229 |
); |
|
230 |
} |
|
231 |
||
232 |
void AddTextEffect(StringID msg, int x, int y, uint16 duration) |
|
233 |
{ |
|
234 |
TextEffect *te; |
|
235 |
int w; |
|
236 |
char buffer[100]; |
|
237 |
||
4958 | 238 |
if (_game_mode == GM_MENU) return; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
0
diff
changeset
|
239 |
|
2470 | 240 |
for (te = _text_effect_list; te->string_id != INVALID_STRING_ID; ) { |
2639 | 241 |
if (++te == endof(_text_effect_list)) return; |
0 | 242 |
} |
243 |
||
244 |
te->string_id = msg; |
|
245 |
te->duration = duration; |
|
246 |
te->y = y - 5; |
|
247 |
te->bottom = y + 5; |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
425
diff
changeset
|
248 |
te->params_1 = GetDParam(0); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
425
diff
changeset
|
249 |
te->params_2 = GetDParam(4); |
0 | 250 |
|
4912
d04b3f2bca70
(svn r6884) -Codechange: Add strict bounds checking in string formatting system.
Darkvater
parents:
4609
diff
changeset
|
251 |
GetString(buffer, msg, lastof(buffer)); |
4609
6c337b3fbf4b
(svn r6462) -Codechange: Have GetStringWidth() return width as well as the height bounding
Darkvater
parents:
4469
diff
changeset
|
252 |
w = GetStringBoundingBox(buffer).width; |
0 | 253 |
|
254 |
te->x = x - (w >> 1); |
|
255 |
te->right = x + (w >> 1) - 1; |
|
256 |
MarkTextEffectAreaDirty(te); |
|
257 |
} |
|
258 |
||
259 |
static void MoveTextEffect(TextEffect *te) |
|
260 |
{ |
|
261 |
if (te->duration < 8) { |
|
2470 | 262 |
te->string_id = INVALID_STRING_ID; |
0 | 263 |
} else { |
2549 | 264 |
te->duration -= 8; |
0 | 265 |
te->y--; |
266 |
te->bottom--; |
|
267 |
} |
|
268 |
MarkTextEffectAreaDirty(te); |
|
269 |
} |
|
270 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1022
diff
changeset
|
271 |
void MoveAllTextEffects(void) |
0 | 272 |
{ |
273 |
TextEffect *te; |
|
274 |
||
2549 | 275 |
for (te = _text_effect_list; te != endof(_text_effect_list); te++) { |
276 |
if (te->string_id != INVALID_STRING_ID) MoveTextEffect(te); |
|
0 | 277 |
} |
278 |
} |
|
279 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1022
diff
changeset
|
280 |
void InitTextEffects(void) |
0 | 281 |
{ |
282 |
TextEffect *te; |
|
283 |
||
2549 | 284 |
for (te = _text_effect_list; te != endof(_text_effect_list); te++) { |
2470 | 285 |
te->string_id = INVALID_STRING_ID; |
0 | 286 |
} |
287 |
} |
|
288 |
||
289 |
void DrawTextEffects(DrawPixelInfo *dpi) |
|
290 |
{ |
|
4469 | 291 |
const TextEffect* te; |
0 | 292 |
|
4469 | 293 |
switch (dpi->zoom) { |
294 |
case 0: |
|
295 |
for (te = _text_effect_list; te != endof(_text_effect_list); te++) { |
|
296 |
if (te->string_id != INVALID_STRING_ID && |
|
297 |
dpi->left <= te->right && |
|
298 |
dpi->top <= te->bottom && |
|
299 |
dpi->left + dpi->width > te->x && |
|
300 |
dpi->top + dpi->height > te->y) { |
|
5026
c8b7148798ac
(svn r7067) Remove the unused parameter params_3 from AddStringToDraw()
tron
parents:
4960
diff
changeset
|
301 |
AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2); |
4469 | 302 |
} |
303 |
} |
|
304 |
break; |
|
0 | 305 |
|
4469 | 306 |
case 1: |
307 |
for (te = _text_effect_list; te != endof(_text_effect_list); te++) { |
|
308 |
if (te->string_id != INVALID_STRING_ID && |
|
309 |
dpi->left <= te->right * 2 - te->x && |
|
310 |
dpi->top <= te->bottom * 2 - te->y && |
|
311 |
dpi->left + dpi->width > te->x && |
|
312 |
dpi->top + dpi->height > te->y) { |
|
5026
c8b7148798ac
(svn r7067) Remove the unused parameter params_3 from AddStringToDraw()
tron
parents:
4960
diff
changeset
|
313 |
AddStringToDraw(te->x, te->y, (StringID)(te->string_id-1), te->params_1, te->params_2); |
4469 | 314 |
} |
315 |
} |
|
316 |
break; |
|
0 | 317 |
} |
318 |
} |
|
319 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1891
diff
changeset
|
320 |
void DeleteAnimatedTile(TileIndex tile) |
0 | 321 |
{ |
2549 | 322 |
TileIndex* ti; |
0 | 323 |
|
2549 | 324 |
for (ti = _animated_tile_list; ti != endof(_animated_tile_list); ti++) { |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1891
diff
changeset
|
325 |
if (tile == *ti) { |
0 | 326 |
/* remove the hole */ |
2549 | 327 |
memmove(ti, ti + 1, endof(_animated_tile_list) - 1 - ti); |
0 | 328 |
/* and clear last item */ |
329 |
endof(_animated_tile_list)[-1] = 0; |
|
330 |
MarkTileDirtyByTile(tile); |
|
331 |
return; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
0
diff
changeset
|
332 |
} |
0 | 333 |
} |
334 |
} |
|
335 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1891
diff
changeset
|
336 |
bool AddAnimatedTile(TileIndex tile) |
0 | 337 |
{ |
2549 | 338 |
TileIndex* ti; |
0 | 339 |
|
2549 | 340 |
for (ti = _animated_tile_list; ti != endof(_animated_tile_list); ti++) { |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1891
diff
changeset
|
341 |
if (tile == *ti || *ti == 0) { |
0 | 342 |
*ti = tile; |
343 |
MarkTileDirtyByTile(tile); |
|
344 |
return true; |
|
345 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
0
diff
changeset
|
346 |
} |
0 | 347 |
|
348 |
return false; |
|
349 |
} |
|
350 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1022
diff
changeset
|
351 |
void AnimateAnimatedTiles(void) |
0 | 352 |
{ |
2549 | 353 |
const TileIndex* ti; |
0 | 354 |
|
2549 | 355 |
for (ti = _animated_tile_list; ti != endof(_animated_tile_list) && *ti != 0; ti++) { |
356 |
AnimateTile(*ti); |
|
0 | 357 |
} |
358 |
} |
|
359 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1022
diff
changeset
|
360 |
void InitializeAnimatedTiles(void) |
0 | 361 |
{ |
362 |
memset(_animated_tile_list, 0, sizeof(_animated_tile_list)); |
|
363 |
} |
|
364 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1022
diff
changeset
|
365 |
static void SaveLoad_ANIT(void) |
0 | 366 |
{ |
2685
00111d5ca47f
(svn r3227) -Codechange: [Savegame] removed 'minor' version, and renamed 'major' version to just: version.
truelight
parents:
2639
diff
changeset
|
367 |
// In pre version 6, we has 16bit per tile, now we have 32bit per tile, convert it ;) |
00111d5ca47f
(svn r3227) -Codechange: [Savegame] removed 'minor' version, and renamed 'major' version to just: version.
truelight
parents:
2639
diff
changeset
|
368 |
if (CheckSavegameVersion(6)) { |
1881
023a134a4b12
(svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents:
1595
diff
changeset
|
369 |
SlArray(_animated_tile_list, lengthof(_animated_tile_list), SLE_FILE_U16 | SLE_VAR_U32); |
2549 | 370 |
} else { |
1174
27e386195965
(svn r1676) Increase the size of TileIndex and TileIndexDiff to 32bits and adapt the save/load data and some other parts of the code to that change
tron
parents:
1093
diff
changeset
|
371 |
SlArray(_animated_tile_list, lengthof(_animated_tile_list), SLE_UINT32); |
2549 | 372 |
} |
0 | 373 |
} |
374 |
||
375 |
||
376 |
const ChunkHandler _animated_tile_chunk_handlers[] = { |
|
377 |
{ 'ANIT', SaveLoad_ANIT, SaveLoad_ANIT, CH_RIFF | CH_LAST}, |
|
378 |
}; |