- fix bug #2798680 (load & save message display interfere with gameplay)

This commit is contained in:
mtabachenko 2009-05-30 20:06:44 +00:00
parent 92ded778aa
commit a5ea4e0cc8
2 changed files with 10 additions and 8 deletions

View File

@ -26,6 +26,7 @@
#include "mem.h"
#include <string.h> //mem funcs
#include <stdarg.h> //va_start, etc
#include <time.h>
#include "debug.h"
#include "softrender.h"
@ -53,7 +54,7 @@ OSDCLASS::OSDCLASS(u8 core)
{
lineText[i] = new char[1024];
memset(lineText[i], 0, 1024);
lineTimer[i] = OSD_TIMER_SIZE;
lineTimer[i] = 0;
lineColor[i] = lineText_color;
}
@ -148,11 +149,11 @@ bool OSDCLASS::checkTimers()
{
if (lastLineText == 0) return false;
time_t tmp_time = time(NULL);
for (int i=0; i < lastLineText; i++)
{
if (lineTimer[i] > 0) lineTimer[i]--;
if (lineTimer[i] == 0)
if (tmp_time > (lineTimer[i] + OSD_TIMER_SECS) )
{
if (i < lastLineText)
{
@ -163,6 +164,7 @@ bool OSDCLASS::checkTimers()
lineColor[j] = lineColor[j+1];
}
}
lineTimer[lastLineText] = 0;
lastLineText--;
if (lastLineText == 0) return false;
}
@ -235,7 +237,7 @@ void OSDCLASS::addLine(const char *fmt, ...)
#endif
va_end(list);
lineColor[lastLineText] = lineText_color;
lineTimer[lastLineText] = OSD_TIMER_SIZE;
lineTimer[lastLineText] = time(NULL);
needUpdate = true;
lastLineText++;

View File

@ -25,10 +25,11 @@
#define __GPU_OSD_
#include <stdlib.h>
#include <time.h>
#include "types.h"
#define OSD_MAX_LINES 4
#define OSD_TIMER_SIZE 5000
#define OSD_TIMER_SECS 2
class OSDCLASS
{
@ -44,12 +45,11 @@ private:
u32 lineText_color;
u8 lastLineText;
char *lineText[OSD_MAX_LINES+1];
u16 lineTimer[OSD_MAX_LINES+1];
time_t lineTimer[OSD_MAX_LINES+1];
u32 lineColor[OSD_MAX_LINES+1];
bool needUpdate;
//void printChar(u16 x, u16 y, u8 c);
bool checkTimers();
public:
char name[7]; // for debuging