texteff.c
changeset 1093 4fdc46eaf423
parent 1022 d5ec3467d2a4
child 1174 6a5e747f3ba6
equal deleted inserted replaced
1092:e3b4a131db7c 1093:4fdc46eaf423
    85 	_text_message_list[i].end_date = _date + duration;
    85 	_text_message_list[i].end_date = _date + duration;
    86 
    86 
    87 	_textmessage_dirty = true;
    87 	_textmessage_dirty = true;
    88 }
    88 }
    89 
    89 
    90 void InitTextMessage()
    90 void InitTextMessage(void)
    91 {
    91 {
    92 	int i;
    92 	int i;
    93 	for (i = 0; i < MAX_CHAT_MESSAGES; i++) {
    93 	for (i = 0; i < MAX_CHAT_MESSAGES; i++) {
    94 		_text_message_list[i].message[0] = '\0';
    94 		_text_message_list[i].message[0] = '\0';
    95 	}
    95 	}
    96 
    96 
    97 	_textmessage_width = _textmessage_box_max_width;
    97 	_textmessage_width = _textmessage_box_max_width;
    98 }
    98 }
    99 
    99 
   100 // Hide the textbox
   100 // Hide the textbox
   101 void UndrawTextMessage()
   101 void UndrawTextMessage(void)
   102 {
   102 {
   103 	if (_textmessage_visible) {
   103 	if (_textmessage_visible) {
   104 		// Sometimes we also need to hide the cursor
   104 		// Sometimes we also need to hide the cursor
   105 		//   This is because both textmessage and the cursor take a shot of the
   105 		//   This is because both textmessage and the cursor take a shot of the
   106 		//   screen before drawing.
   106 		//   screen before drawing.
   133 		_textmessage_dirty = true;
   133 		_textmessage_dirty = true;
   134 	}
   134 	}
   135 }
   135 }
   136 
   136 
   137 // Check if a message is expired every day
   137 // Check if a message is expired every day
   138 void TextMessageDailyLoop()
   138 void TextMessageDailyLoop(void)
   139 {
   139 {
   140 	int i = 0;
   140 	int i = 0;
   141 	while (i < MAX_CHAT_MESSAGES) {
   141 	while (i < MAX_CHAT_MESSAGES) {
   142 		if (_text_message_list[i].message[0] == '\0') break;
   142 		if (_text_message_list[i].message[0] == '\0') break;
   143 		if (_date > _text_message_list[i].end_date) {
   143 		if (_date > _text_message_list[i].end_date) {
   149 		i++;
   149 		i++;
   150 	}
   150 	}
   151 }
   151 }
   152 
   152 
   153 // Draw the textmessage-box
   153 // Draw the textmessage-box
   154 void DrawTextMessage()
   154 void DrawTextMessage(void)
   155 {
   155 {
   156 	int i, j;
   156 	int i, j;
   157 	bool has_message;
   157 	bool has_message;
   158 
   158 
   159 	if (!_textmessage_dirty)
   159 	if (!_textmessage_dirty)
   248 		te->bottom--;
   248 		te->bottom--;
   249 	}
   249 	}
   250 	MarkTextEffectAreaDirty(te);
   250 	MarkTextEffectAreaDirty(te);
   251 }
   251 }
   252 
   252 
   253 void MoveAllTextEffects()
   253 void MoveAllTextEffects(void)
   254 {
   254 {
   255 	TextEffect *te;
   255 	TextEffect *te;
   256 
   256 
   257 	for (te = _text_effect_list; te != endof(_text_effect_list); te++ ) {
   257 	for (te = _text_effect_list; te != endof(_text_effect_list); te++ ) {
   258 		if (te->string_id != 0xFFFF)
   258 		if (te->string_id != 0xFFFF)
   259 			MoveTextEffect(te);
   259 			MoveTextEffect(te);
   260 	}
   260 	}
   261 }
   261 }
   262 
   262 
   263 void InitTextEffects()
   263 void InitTextEffects(void)
   264 {
   264 {
   265 	TextEffect *te;
   265 	TextEffect *te;
   266 
   266 
   267 	for (te = _text_effect_list; te != endof(_text_effect_list); te++ ) {
   267 	for (te = _text_effect_list; te != endof(_text_effect_list); te++ ) {
   268 		te->string_id = 0xFFFF;
   268 		te->string_id = 0xFFFF;
   332 	}
   332 	}
   333 
   333 
   334 	return false;
   334 	return false;
   335 }
   335 }
   336 
   336 
   337 void AnimateAnimatedTiles()
   337 void AnimateAnimatedTiles(void)
   338 {
   338 {
   339 	TileIndex *ti;
   339 	TileIndex *ti;
   340 	uint tile;
   340 	uint tile;
   341 
   341 
   342 	for(ti=_animated_tile_list; ti!=endof(_animated_tile_list) && (tile=*ti) != 0; ti++) {
   342 	for(ti=_animated_tile_list; ti!=endof(_animated_tile_list) && (tile=*ti) != 0; ti++) {
   343 		AnimateTile(tile);
   343 		AnimateTile(tile);
   344 	}
   344 	}
   345 }
   345 }
   346 
   346 
   347 void InitializeAnimatedTiles()
   347 void InitializeAnimatedTiles(void)
   348 {
   348 {
   349 	memset(_animated_tile_list, 0, sizeof(_animated_tile_list));
   349 	memset(_animated_tile_list, 0, sizeof(_animated_tile_list));
   350 }
   350 }
   351 
   351 
   352 static void SaveLoad_ANIT()
   352 static void SaveLoad_ANIT(void)
   353 {
   353 {
   354 	SlArray(_animated_tile_list, lengthof(_animated_tile_list), SLE_UINT16);
   354 	SlArray(_animated_tile_list, lengthof(_animated_tile_list), SLE_UINT16);
   355 }
   355 }
   356 
   356 
   357 
   357