| 1 | cycrow | 1 | // LcdCustomScreen.cpp: implementation of the CLcdCustomScreen class.
 | 
        
           |  |  | 2 | //
 | 
        
           |  |  | 3 | //////////////////////////////////////////////////////////////////////
 | 
        
           |  |  | 4 |   | 
        
           |  |  | 5 | #include "stdafx.h"
 | 
        
           |  |  | 6 | #include "LcdCustomScreen.h"
 | 
        
           |  |  | 7 |   | 
        
           |  |  | 8 | //////////////////////////////////////////////////////////////////////
 | 
        
           |  |  | 9 | // Construction/Destruction
 | 
        
           |  |  | 10 | //////////////////////////////////////////////////////////////////////
 | 
        
           |  |  | 11 |   | 
        
           |  |  | 12 | CLcdCustomScreen::CLcdCustomScreen( CEzLcd *lcd )
 | 
        
           |  |  | 13 | {
 | 
        
           |  |  | 14 | 	m_pLcd = lcd;
 | 
        
           |  |  | 15 | 	m_iArraySize = 10;
 | 
        
           |  |  | 16 | 	m_pHandles = (HANDLE *)malloc(sizeof(HANDLE) * m_iArraySize);
 | 
        
           |  |  | 17 | 	m_iCycles = 10;
 | 
        
           |  |  | 18 | 	m_bDebug = false;
 | 
        
           |  |  | 19 | 	m_pMoveObject = m_pEndMoveObject = NULL;
 | 
        
           |  |  | 20 | 	m_pText = m_pEndText = NULL;
 | 
        
           |  |  | 21 | }
 | 
        
           |  |  | 22 |   | 
        
           |  |  | 23 | CLcdCustomScreen::~CLcdCustomScreen()
 | 
        
           |  |  | 24 | {
 | 
        
           |  |  | 25 | 	Reset ();
 | 
        
           |  |  | 26 | 	free ( m_pHandles );
 | 
        
           |  |  | 27 | }
 | 
        
           |  |  | 28 |   | 
        
           |  |  | 29 | void CLcdCustomScreen::IncreaseArraySize ()
 | 
        
           |  |  | 30 | {
 | 
        
           |  |  | 31 | 	m_iArraySize += 5;
 | 
        
           |  |  | 32 | 	m_pHandles = (HANDLE *)realloc(m_pHandles, sizeof(HANDLE) * m_iArraySize);
 | 
        
           |  |  | 33 | }
 | 
        
           |  |  | 34 |   | 
        
           |  |  | 35 | CyString CLcdCustomScreen::ParseFilename(CyString &filename, CyString &dir)
 | 
        
           |  |  | 36 | {
 | 
        
           |  |  | 37 | 	CyString f = filename;
 | 
        
           |  |  | 38 |   | 
        
           |  |  | 39 | 	f = f.FindReplace("$progdir", m_sProgDir);
 | 
        
           |  |  | 40 | 	f = f.FindReplace("$gamedir", m_sGameDir);
 | 
        
           |  |  | 41 |   | 
        
           |  |  | 42 | 	// relative filename
 | 
        
           |  |  | 43 | 	if ( !f.IsIn(":") )
 | 
        
           |  |  | 44 | 		f = dir + "/" + f;
 | 
        
           |  |  | 45 |   | 
        
           |  |  | 46 | 	f = f.FindReplace("/", "\\");
 | 
        
           |  |  | 47 | 	f = f.FindReplace("\\\\", "\\");
 | 
        
           |  |  | 48 | 	return f;
 | 
        
           |  |  | 49 | }
 | 
        
           |  |  | 50 | bool CLcdCustomScreen::LoadScript ( CyString sDir, CyString sProgDir, const char *filename )
 | 
        
           |  |  | 51 | {
 | 
        
           |  |  | 52 | 	m_lDebugLog.Clear();
 | 
        
           |  |  | 53 | 	m_lVaribles.Clear();
 | 
        
           |  |  | 54 |   | 
        
           |  |  | 55 | 	int iCurrentPos = 0;
 | 
        
           |  |  | 56 |   | 
        
           |  |  | 57 | 	m_iStartPage = m_pLcd->AddNewPage () - 1;
 | 
        
           |  |  | 58 |     m_pLcd->ModifyControlsOnPage( m_iStartPage );
 | 
        
           |  |  | 59 |   | 
        
           |  |  | 60 | 	int iLastX, iLastY;
 | 
        
           |  |  | 61 |   | 
        
           |  |  | 62 | 	m_bDebug = false;
 | 
        
           |  |  | 63 | 	CyString fname = filename;
 | 
        
           |  |  | 64 | 	fname = fname.FindReplace("$progdir", sProgDir);
 | 
        
           |  |  | 65 |   | 
        
           |  |  | 66 | 	// relative path
 | 
        
           |  |  | 67 | 	if ( !fname.IsIn(":") )
 | 
        
           |  |  | 68 | 		fname = sDir + "/" + filename;
 | 
        
           |  |  | 69 | 	fname = fname.FindReplace("\\", "/"); // make sure we're using the correct slash
 | 
        
           |  |  | 70 | 	fname = fname.FindReplace("//", "/"); // remove any double slashes
 | 
        
           |  |  | 71 | 	CyString dir = fname.GetToken("/", 1, -1);
 | 
        
           |  |  | 72 |   | 
        
           |  |  | 73 | 	m_sScriptDir = dir;
 | 
        
           |  |  | 74 | 	m_sProgDir = sProgDir;
 | 
        
           |  |  | 75 | 	m_sGameDir = sDir;
 | 
        
           |  |  | 76 |   | 
        
           |  |  | 77 | 	FILE *id = fopen ( fname.c_str(), "r" );
 | 
        
           |  |  | 78 | 	if ( id )
 | 
        
           |  |  | 79 | 	{
 | 
        
           |  |  | 80 | 		int iLine = 0;
 | 
        
           |  |  | 81 | 		while ( !feof(id) )
 | 
        
           |  |  | 82 | 		{
 | 
        
           |  |  | 83 | 			CyString line;
 | 
        
           |  |  | 84 | 			line = line.GetEndOfLine ( id, &iLine, false );
 | 
        
           |  |  | 85 | 			if ( (line.Left (2) == "//") || (line.Empty()) )
 | 
        
           |  |  | 86 | 				continue;
 | 
        
           |  |  | 87 | 			CyString arg = line.GetToken ( 1, ' ' ).ToLower();
 | 
        
           |  |  | 88 | 			if ( arg == "displayfor:" )
 | 
        
           |  |  | 89 | 			{
 | 
        
           |  |  | 90 | 				m_iCycles = line.GetToken ( 2, ' ' ).ToInt();
 | 
        
           |  |  | 91 | 				if ( (!m_iCycles) || (m_iCycles < 0) )
 | 
        
           |  |  | 92 | 					m_lDebugLog.PushBack ( CyString((long)iLine) + (CyString(": Invalid argument for \"DisplayFor\" (") + line.GetToken ( 2, ' ' )) + ")", false );
 | 
        
           |  |  | 93 | 			}
 | 
        
           |  |  | 94 | 			else if ( arg == "debug" )
 | 
        
           |  |  | 95 | 				m_bDebug = true;
 | 
        
           |  |  | 96 | 			else if ( arg == "varible:" )
 | 
        
           |  |  | 97 | 			{
 | 
        
           |  |  | 98 | 				if ( line.NumToken ( ' ' ) < 2 )
 | 
        
           |  |  | 99 | 					m_lDebugLog.PushBack ( CyString((long)iLine) + CyString(": Missing Argument for \"Varible\""), false );
 | 
        
           |  |  | 100 | 				else
 | 
        
           |  |  | 101 | 					m_lVaribles.PushBack ( line.GetToken ( 2, ' ' ) );
 | 
        
           |  |  | 102 | 			}
 | 
        
           |  |  | 103 | 			else if ( arg == "icon:" )
 | 
        
           |  |  | 104 | 			{
 | 
        
           |  |  | 105 | 				if ( line.NumToken ( ' ' ) < 6 )
 | 
        
           |  |  | 106 | 					m_lDebugLog.PushBack ( CyString((long)iLine) + CyString(": Missing Arguments for \"Icon\""), false );
 | 
        
           |  |  | 107 | 				else
 | 
        
           |  |  | 108 | 				{
 | 
        
           |  |  | 109 | 					CyString sIcon = line.GetToken ( 6, -1, ' ' );
 | 
        
           |  |  | 110 | 					int iSizeX = line.GetToken ( 4, ' ' ).ToInt();
 | 
        
           |  |  | 111 | 					int iSizeY = line.GetToken ( 5, ' ' ).ToInt();
 | 
        
           |  |  | 112 | 					HICON hIcon = static_cast<HICON>(LoadImage(0, (LPCTSTR)ParseFilename(sIcon, dir).c_str(), IMAGE_ICON, iSizeX, iSizeY, LR_LOADFROMFILE));
 | 
        
           |  |  | 113 | 					if ( FAILED (hIcon) )
 | 
        
           |  |  | 114 | 						m_lDebugLog.PushBack ( CyString((long)iLine) + CyString(": Unable to open icon file: ") + sIcon, false );
 | 
        
           |  |  | 115 | 					else
 | 
        
           |  |  | 116 | 					{
 | 
        
           |  |  | 117 | 						m_pHandles[iCurrentPos] = m_pLcd->AddIcon(hIcon, iSizeX, iSizeY);
 | 
        
           |  |  | 118 | 						int iX = line.GetToken ( 2, ' ' ).ToInt ();
 | 
        
           |  |  | 119 | 						int iY = line.GetToken ( 3, ' ' ).ToInt ();
 | 
        
           |  |  | 120 | 						m_pLcd->SetOrigin ( m_pHandles[iCurrentPos], iX, iY );
 | 
        
           |  |  | 121 | 						iLastX = iX;
 | 
        
           |  |  | 122 | 						iLastY = iY;
 | 
        
           |  |  | 123 | 						iCurrentPos++;
 | 
        
           |  |  | 124 | 					}
 | 
        
           |  |  | 125 | 				}
 | 
        
           |  |  | 126 | 			}
 | 
        
           |  |  | 127 | 			else if ( (arg == "move:") || (arg == "moverepeat:") )
 | 
        
           |  |  | 128 | 			{
 | 
        
           |  |  | 129 | 				if ( line.NumToken ( ' ' ) < 4 )
 | 
        
           |  |  | 130 | 					m_lDebugLog.PushBack ( CyString((long)iLine) + CyString(": Missing Argument for \"Move\""), false );
 | 
        
           |  |  | 131 | 				else if ( !iCurrentPos )
 | 
        
           |  |  | 132 | 					m_lDebugLog.PushBack ( CyString((long)iLine) + CyString(": No object before move command"), false );
 | 
        
           |  |  | 133 | 				else
 | 
        
           |  |  | 134 | 				{
 | 
        
           |  |  | 135 | 					SMoveObject *o = new SMoveObject;
 | 
        
           |  |  | 136 | 					o->hObject = m_pHandles[iCurrentPos - 1];
 | 
        
           |  |  | 137 | 					if ( arg == "moverepeat:" )
 | 
        
           |  |  | 138 | 						o->bRepeat = true;
 | 
        
           |  |  | 139 | 					else
 | 
        
           |  |  | 140 | 						o->bRepeat = false;
 | 
        
           |  |  | 141 | 					o->iStartX = iLastX;
 | 
        
           |  |  | 142 | 					o->iStartY = iLastY;
 | 
        
           |  |  | 143 | 					if ( line.GetToken ( 2, ' ' ) == "-" )
 | 
        
           |  |  | 144 | 						o->iEndX = o->iStartX;
 | 
        
           |  |  | 145 | 					else
 | 
        
           |  |  | 146 | 						o->iEndX = line.GetToken ( 2, ' ' ).ToInt();
 | 
        
           |  |  | 147 | 					if ( line.GetToken ( 3, ' ' ) == "-" )
 | 
        
           |  |  | 148 | 						o->iEndY = o->iStartY;
 | 
        
           |  |  | 149 | 					else
 | 
        
           |  |  | 150 | 						o->iEndY = line.GetToken ( 3, ' ' ).ToInt();
 | 
        
           |  |  | 151 | 					o->iTimeRemaining = o->iTotalTime = line.GetToken ( 4, ' ' ).ToInt();
 | 
        
           |  |  | 152 | 					AddMoveObject ( o );
 | 
        
           |  |  | 153 | 				}
 | 
        
           |  |  | 154 | 			}
 | 
        
           |  |  | 155 | 			else if ( ((arg.Left(9) == "textsmall") || (arg.Left(10) == "textmedium") || (arg.Left(9) == "textlarge")) && (arg.Right(1) == ":") )
 | 
        
           |  |  | 156 | 			{
 | 
        
           |  |  | 157 | 				if ( line.NumToken ( ' ' ) < 6 )
 | 
        
           |  |  | 158 | 					m_lDebugLog.PushBack ( CyString((long)iLine) + CyString(": Missing Argument for \"Text\""), false );
 | 
        
           |  |  | 159 | 				else
 | 
        
           |  |  | 160 | 				{
 | 
        
           |  |  | 161 | 					CyString align = line.GetToken ( 5, ' ' ).ToLower();
 | 
        
           |  |  | 162 | 					int iAlign = DT_CENTER;
 | 
        
           |  |  | 163 | 					if ( align == "center" )
 | 
        
           |  |  | 164 | 						iAlign = DT_CENTER;
 | 
        
           |  |  | 165 | 					else if ( align == "left" )
 | 
        
           |  |  | 166 | 						iAlign = DT_LEFT;
 | 
        
           |  |  | 167 | 					else if ( align == "right" )
 | 
        
           |  |  | 168 | 						iAlign = DT_RIGHT;
 | 
        
           |  |  | 169 | 					else
 | 
        
           |  |  | 170 | 						m_lDebugLog.PushBack ( CyString((long)iLine) + CyString(": Invalid alignment setting \"") + align + "\"", false );
 | 
        
           |  |  | 171 |   | 
        
           |  |  | 172 | 					LGTextSize iSize = LG_SMALL;
 | 
        
           |  |  | 173 | 					if ( arg.Left(10) == "textmedium" )
 | 
        
           |  |  | 174 | 						iSize = LG_MEDIUM;
 | 
        
           |  |  | 175 | 					else if ( arg.Left(9) == "textsmall" )
 | 
        
           |  |  | 176 | 						iSize = LG_SMALL;
 | 
        
           |  |  | 177 | 					else if ( arg.Left(9) == "textlarge" )
 | 
        
           |  |  | 178 | 						iSize = LG_BIG;
 | 
        
           |  |  | 179 |   | 
        
           |  |  | 180 | 					bool scroll = false;
 | 
        
           |  |  | 181 | 					if ( arg.Right (7) == "Scroll:" )
 | 
        
           |  |  | 182 | 						scroll = true;
 | 
        
           |  |  | 183 |   | 
        
           |  |  | 184 | 					int len = line.GetToken ( 4, ' ' ).ToInt();
 | 
        
           |  |  | 185 | 					int x = line.GetToken ( 2, ' ' ).ToInt ();
 | 
        
           |  |  | 186 | 					int y = line.GetToken ( 3, ' ' ).ToInt ();
 | 
        
           |  |  | 187 | 					CyString str = line.GetToken ( 6, -1, ' ' );
 | 
        
           |  |  | 188 | 					m_pHandles[iCurrentPos] = m_pLcd->AddText ( (scroll) ? LG_SCROLLING_TEXT : LG_STATIC_TEXT, iSize, iAlign, len );
 | 
        
           |  |  | 189 | 					m_pLcd->SetOrigin ( m_pHandles[iCurrentPos], x, y );
 | 
        
           |  |  | 190 | 					m_pLcd->SetText ( m_pHandles[iCurrentPos], (LPCTSTR)str.c_str() );
 | 
        
           |  |  | 191 |   | 
        
           |  |  | 192 | 					SText *text = new SText;
 | 
        
           |  |  | 193 | 					text->hObject = m_pHandles[iCurrentPos];
 | 
        
           |  |  | 194 | 					text->sText = str;
 | 
        
           |  |  | 195 | 					AddText ( text );
 | 
        
           |  |  | 196 | 					iCurrentPos++;
 | 
        
           |  |  | 197 | 				}
 | 
        
           |  |  | 198 | 			}
 | 
        
           |  |  | 199 | 			else
 | 
        
           |  |  | 200 | 				m_lDebugLog.PushBack ( CyString((long)iLine) + CyString(": Invalid Command: ") + arg );
 | 
        
           |  |  | 201 |   | 
        
           |  |  | 202 | 			if ( iCurrentPos >= m_iArraySize )
 | 
        
           |  |  | 203 | 				IncreaseArraySize();
 | 
        
           |  |  | 204 | 		}
 | 
        
           |  |  | 205 |   | 
        
           |  |  | 206 | 		fclose ( id );
 | 
        
           |  |  | 207 | 	}
 | 
        
           |  |  | 208 |   | 
        
           |  |  | 209 | 	// debug
 | 
        
           |  |  | 210 | 	m_pLcd->AddNewPage ();
 | 
        
           |  |  | 211 |     m_pLcd->ModifyControlsOnPage(m_iStartPage + 1);
 | 
        
           |  |  | 212 | 	for ( int i = 0; i < 5; i++ )
 | 
        
           |  |  | 213 | 	{
 | 
        
           |  |  | 214 | 		m_hDebug[i] = m_pLcd->AddText ( LG_SCROLLING_TEXT, LG_SMALL, DT_LEFT, 160 );
 | 
        
           |  |  | 215 | 		m_pLcd->SetOrigin ( m_hDebug, 0, (i * 9) );
 | 
        
           |  |  | 216 | 	}
 | 
        
           |  |  | 217 |   | 
        
           |  |  | 218 | 	if ( m_bDebug )
 | 
        
           |  |  | 219 | 		m_iCycles = 100;
 | 
        
           |  |  | 220 |   | 
        
           |  |  | 221 | 	return true;
 | 
        
           |  |  | 222 | }
 | 
        
           |  |  | 223 |   | 
        
           |  |  | 224 | void CLcdCustomScreen::SetVarible ( CyString v, int pos )
 | 
        
           |  |  | 225 | {
 | 
        
           |  |  | 226 | 	if ( pos >= m_lVaribles.Count() )
 | 
        
           |  |  | 227 | 		return;
 | 
        
           |  |  | 228 |   | 
        
           |  |  | 229 | 	m_lVaribles.GetAt ( pos )->data = v;
 | 
        
           |  |  | 230 | }
 | 
        
           |  |  | 231 |   | 
        
           |  |  | 232 | void CLcdCustomScreen::Reset ()
 | 
        
           |  |  | 233 | {
 | 
        
           |  |  | 234 | 	m_pLcd->RemovePage ( m_iStartPage + 1 );
 | 
        
           |  |  | 235 | 	m_pLcd->RemovePage ( m_iStartPage );
 | 
        
           |  |  | 236 |   | 
        
           |  |  | 237 | 	m_lDebugLog.Clear();
 | 
        
           |  |  | 238 | 	m_lVaribles.Clear();
 | 
        
           |  |  | 239 |   | 
        
           |  |  | 240 | 	SMoveObject *o = m_pMoveObject;
 | 
        
           |  |  | 241 | 	while ( o )
 | 
        
           |  |  | 242 | 	{
 | 
        
           |  |  | 243 | 		SMoveObject *next = o->pNext;
 | 
        
           |  |  | 244 | 		delete o;
 | 
        
           |  |  | 245 | 		o = next;
 | 
        
           |  |  | 246 | 	}
 | 
        
           |  |  | 247 |   | 
        
           |  |  | 248 | 	SText *t = m_pText;
 | 
        
           |  |  | 249 | 	while ( t )
 | 
        
           |  |  | 250 | 	{
 | 
        
           |  |  | 251 | 		SText *next = t->pNext;
 | 
        
           |  |  | 252 | 		delete t;
 | 
        
           |  |  | 253 | 		t = next;
 | 
        
           |  |  | 254 | 	}
 | 
        
           |  |  | 255 | 	m_pMoveObject = m_pEndMoveObject = NULL;
 | 
        
           |  |  | 256 | 	m_pText = m_pEndText = NULL;
 | 
        
           |  |  | 257 | }
 | 
        
           |  |  | 258 |   | 
        
           |  |  | 259 | void CLcdCustomScreen::AddMoveObject ( SMoveObject *o )
 | 
        
           |  |  | 260 | {
 | 
        
           |  |  | 261 | 	o->pNext = NULL;
 | 
        
           |  |  | 262 | 	if ( !m_pEndMoveObject )
 | 
        
           |  |  | 263 | 		m_pMoveObject = m_pEndMoveObject = o;
 | 
        
           |  |  | 264 | 	else
 | 
        
           |  |  | 265 | 	{
 | 
        
           |  |  | 266 | 		m_pEndMoveObject->pNext = o;
 | 
        
           |  |  | 267 | 		m_pEndMoveObject = o;
 | 
        
           |  |  | 268 | 	}
 | 
        
           |  |  | 269 | }
 | 
        
           |  |  | 270 |   | 
        
           |  |  | 271 | void CLcdCustomScreen::AddText ( SText *t )
 | 
        
           |  |  | 272 | {
 | 
        
           |  |  | 273 | 	t->pNext = NULL;
 | 
        
           |  |  | 274 | 	if ( !m_pEndText )
 | 
        
           |  |  | 275 | 		m_pText = m_pEndText = t;
 | 
        
           |  |  | 276 | 	else
 | 
        
           |  |  | 277 | 	{
 | 
        
           |  |  | 278 | 		m_pEndText->pNext = t;
 | 
        
           |  |  | 279 | 		m_pEndText = t;
 | 
        
           |  |  | 280 | 	}
 | 
        
           |  |  | 281 | }
 | 
        
           |  |  | 282 |   | 
        
           |  |  | 283 | bool CLcdCustomScreen::Display ()
 | 
        
           |  |  | 284 | {
 | 
        
           |  |  | 285 | 	--m_iCycles;
 | 
        
           |  |  | 286 |   | 
        
           |  |  | 287 | 	if ( m_bDebug )
 | 
        
           |  |  | 288 | 	{
 | 
        
           |  |  | 289 | 		m_pLcd->ShowPage ( m_iStartPage + 1 );
 | 
        
           |  |  | 290 | 	    m_pLcd->ModifyControlsOnPage ( m_iStartPage + 1 );
 | 
        
           |  |  | 291 | 		SStringList *str = m_lDebugLog.Head();
 | 
        
           |  |  | 292 | 		for ( int i = 0; i < 5; i++ )
 | 
        
           |  |  | 293 | 		{
 | 
        
           |  |  | 294 | 			if ( !str )
 | 
        
           |  |  | 295 | 				break;
 | 
        
           |  |  | 296 | 			m_pLcd->SetText ( m_hDebug[i], (LPCTSTR)str->str.c_str() );
 | 
        
           |  |  | 297 | 			str = str->next;
 | 
        
           |  |  | 298 | 		}
 | 
        
           |  |  | 299 |   | 
        
           |  |  | 300 | 		if ( !m_lDebugLog.Head() )
 | 
        
           |  |  | 301 | 			m_pLcd->SetText ( m_hDebug[0], _T("No errors found!") );
 | 
        
           |  |  | 302 | 	}
 | 
        
           |  |  | 303 | 	else
 | 
        
           |  |  | 304 | 	{
 | 
        
           |  |  | 305 | 		m_pLcd->ShowPage ( m_iStartPage );
 | 
        
           |  |  | 306 | 	    m_pLcd->ModifyControlsOnPage ( m_iStartPage );
 | 
        
           |  |  | 307 |   | 
        
           |  |  | 308 | 		for ( SText *text = m_pText; text; text = text->pNext )
 | 
        
           |  |  | 309 | 		{
 | 
        
           |  |  | 310 |   | 
        
           |  |  | 311 | 			CyString newtext = text->sText;
 | 
        
           |  |  | 312 | 			for ( SStringList *v = m_lVaribles.Head(); v; v = v->next )
 | 
        
           |  |  | 313 | 				newtext.FindReplace ( CyString("$") + v->str, v->data );
 | 
        
           |  |  | 314 | 			m_pLcd->SetText ( text->hObject, (LPCTSTR)newtext.c_str() );
 | 
        
           |  |  | 315 | 		}
 | 
        
           |  |  | 316 |   | 
        
           |  |  | 317 | 		// now do moving objects
 | 
        
           |  |  | 318 | 		for ( SMoveObject *o = m_pMoveObject; o; o = o->pNext )
 | 
        
           |  |  | 319 | 		{
 | 
        
           |  |  | 320 | 			if ( o->iTimeRemaining > 0 )
 | 
        
           |  |  | 321 | 				o->iTimeRemaining--;
 | 
        
           |  |  | 322 | 			else if ( o->bRepeat )
 | 
        
           |  |  | 323 | 				o->iTimeRemaining = o->iTotalTime;
 | 
        
           |  |  | 324 |   | 
        
           |  |  | 325 | 			float t = (o->iTotalTime - o->iTimeRemaining)  / (float)o->iTotalTime;
 | 
        
           |  |  | 326 | 			float u = 1 - t;
 | 
        
           |  |  | 327 |   | 
        
           |  |  | 328 | 			int iX, iY;
 | 
        
           |  |  | 329 | 			if ( o->iStartX == o->iEndX ) iX = o->iStartX;
 | 
        
           |  |  | 330 | 			else						  iX = (int)((double)((1 - t) * o->iStartX) + (t * o->iEndX));
 | 
        
           |  |  | 331 |   | 
        
           |  |  | 332 | 			if ( o->iStartY == o->iEndY ) iY = o->iStartY;
 | 
        
           |  |  | 333 | 			else						  iY = (int)((double)((1 - t) * o->iStartY) + (t * o->iEndY));
 | 
        
           |  |  | 334 |   | 
        
           |  |  | 335 | 			m_pLcd->SetOrigin ( o->hObject, iX, iY );
 | 
        
           |  |  | 336 | 		}
 | 
        
           |  |  | 337 | 	}
 | 
        
           |  |  | 338 |   | 
        
           |  |  | 339 | 	if ( m_iCycles > 0 )
 | 
        
           |  |  | 340 | 		return true;
 | 
        
           |  |  | 341 | 	return false;
 | 
        
           |  |  | 342 | }
 |