blob: ffd59d01c0293e3e16c2dbabe19db25b56bf8a39 [file] [log] [blame]
Jason Sams0f505e52009-10-13 17:18:35 -07001#pragma version(1)
2#pragma stateVertex(PV)
3#pragma stateFragment(PFTexLinear)
4#pragma stateStore(PSIcons)
5
6#define PI 3.14159f
7
Jason Sams41b61c82009-10-15 15:40:54 -07008int g_SpecialHWWar;
Jason Sams0f505e52009-10-13 17:18:35 -07009
10// Attraction to center values from page edge to page center.
11float g_AttractionTable[9];
Jason Sams0f505e52009-10-13 17:18:35 -070012float g_PhysicsTableSize;
13
14float g_PosPage;
15float g_PosVelocity;
16float g_LastPositionX;
17int g_LastTouchDown;
18float g_DT;
19int g_LastTime;
20int g_PosMax;
21float g_Zoom;
22float g_OldPosPage;
23float g_OldPosVelocity;
24float g_OldZoom;
Jason Samsc1c521e2009-10-19 14:45:45 -070025float g_MoveToTotalTime;
26float g_MoveToTime;
27float g_MoveToOldPos;
28
Jason Sams0f505e52009-10-13 17:18:35 -070029
30// Drawing constants, should be parameters ======
31#define VIEW_ANGLE 1.28700222f
32
33int g_DrawLastFrame;
34int lastFrame(int draw) {
35 // We draw one extra frame to work around the last frame post bug.
36 // We also need to track if we drew the last frame to deal with large DT
37 // in the physics.
38 int ret = g_DrawLastFrame | draw;
39 g_DrawLastFrame = draw;
40 return ret; // should return draw instead.
41}
42
43void updateReadback() {
44 if ((g_OldPosPage != g_PosPage) ||
45 (g_OldPosVelocity != g_PosVelocity) ||
46 (g_OldZoom != g_Zoom)) {
47
48 g_OldPosPage = g_PosPage;
49 g_OldPosVelocity = g_PosVelocity;
50 g_OldZoom = g_Zoom;
51
52 int i[3];
53 i[0] = g_PosPage * (1 << 16);
54 i[1] = g_PosVelocity * (1 << 16);
55 i[2] = g_OldZoom * (1 << 16);
56 sendToClient(&i[0], 1, 12, 1);
57 }
58}
59
Jason Sams41b61c82009-10-15 15:40:54 -070060void setColor(float r, float g, float b, float a) {
61 if (g_SpecialHWWar) {
62 color(0, 0, 0, 0.001f);
63 } else {
64 color(r, g, b, a);
65 }
66}
Jason Sams0f505e52009-10-13 17:18:35 -070067
68void init() {
69 g_AttractionTable[0] = 6.5f;
70 g_AttractionTable[1] = 6.5f;
71 g_AttractionTable[2] = 7.0f;
72 g_AttractionTable[3] = 6.0f;
73 g_AttractionTable[4] = -6.0f;
74 g_AttractionTable[5] = -7.0f;
75 g_AttractionTable[6] = -6.5f;
76 g_AttractionTable[7] = -6.5f;
77 g_AttractionTable[8] = -6.5f; // dup 7 to avoid a clamp later
Jason Sams0f505e52009-10-13 17:18:35 -070078 g_PhysicsTableSize = 7;
79
80 g_PosVelocity = 0;
81 g_PosPage = 0;
82 g_LastTouchDown = 0;
83 g_LastPositionX = 0;
84 g_Zoom = 0;
Jason Sams41b61c82009-10-15 15:40:54 -070085 g_SpecialHWWar = 1;
Jason Samsc1c521e2009-10-19 14:45:45 -070086 g_MoveToTime = 0;
87 g_MoveToOldPos = 0;
Mike Cleron7d5d7462009-10-20 14:06:00 -070088 g_MoveToTotalTime = 0.2f; // Duration of scrolling 1 line
Jason Sams41b61c82009-10-15 15:40:54 -070089}
90
91void resetHWWar() {
92 g_SpecialHWWar = 1;
Jason Sams0f505e52009-10-13 17:18:35 -070093}
94
95void move() {
96 if (g_LastTouchDown) {
97 float dx = -(state->newPositionX - g_LastPositionX);
98 g_PosVelocity = 0;
99 g_PosPage += dx * 4;
100
101 float pmin = -0.25f;
102 float pmax = g_PosMax + 0.25f;
103 g_PosPage = clampf(g_PosPage, pmin, pmax);
104 }
105 g_LastTouchDown = state->newTouchDown;
106 g_LastPositionX = state->newPositionX;
Jason Samsc1c521e2009-10-19 14:45:45 -0700107 g_MoveToTime = 0;
Jason Sams0f505e52009-10-13 17:18:35 -0700108 //debugF("Move P", g_PosPage);
109}
110
Jason Samsc1c521e2009-10-19 14:45:45 -0700111void moveTo() {
112 g_MoveToTime = g_MoveToTotalTime;
113 g_PosVelocity = 0;
114 g_MoveToOldPos = g_PosPage;
Mike Cleron7d5d7462009-10-20 14:06:00 -0700115
116 // debugF("======= moveTo", state->targetPos);
Jason Samsc1c521e2009-10-19 14:45:45 -0700117}
118
Jason Sams0f505e52009-10-13 17:18:35 -0700119void fling() {
120 g_LastTouchDown = 0;
Jason Sams37e7c2b2009-10-19 12:55:43 -0700121 g_PosVelocity = -state->flingVelocity * 4;
Jason Sams0f505e52009-10-13 17:18:35 -0700122 float av = fabsf(g_PosVelocity);
123 float minVel = 3.5f;
124
125 minVel *= 1.f - (fabsf(fracf(g_PosPage + 0.5f) - 0.5f) * 0.45f);
126
127 if (av < minVel && av > 0.2f) {
128 if (g_PosVelocity > 0) {
129 g_PosVelocity = minVel;
130 } else {
131 g_PosVelocity = -minVel;
132 }
133 }
134
135 if (g_PosPage <= 0) {
136 g_PosVelocity = maxf(0, g_PosVelocity);
137 }
138 if (g_PosPage > g_PosMax) {
139 g_PosVelocity = minf(0, g_PosVelocity);
140 }
141}
142
Jason Sams0f505e52009-10-13 17:18:35 -0700143float
144modf(float x, float y)
145{
146 return x-(y*floorf(x/y));
147}
148
Mike Cleron7d5d7462009-10-20 14:06:00 -0700149
150/*
151 * Interpolates values in the range 0..1 to a curve that eases in
152 * and out.
153 */
154float
155getInterpolation(float input) {
156 return (cosf((input + 1) * PI) / 2.0f) + 0.5f;
157}
158
159
Jason Sams0f505e52009-10-13 17:18:35 -0700160void updatePos() {
161 if (g_LastTouchDown) {
162 return;
163 }
164
165 int outOfRange = 0;
166 float tablePosNorm = fracf(g_PosPage + 0.5f);
167 float tablePosF = tablePosNorm * g_PhysicsTableSize;
168 int tablePosI = tablePosF;
169 float tablePosFrac = tablePosF - tablePosI;
170 float accel = lerpf(g_AttractionTable[tablePosI],
171 g_AttractionTable[tablePosI + 1],
172 tablePosFrac) * g_DT;
Jason Samsb52dfa02009-10-14 20:16:14 -0700173 float friction = 4.f * g_DT;
Jason Sams0f505e52009-10-13 17:18:35 -0700174
Jason Samsc1c521e2009-10-19 14:45:45 -0700175 if (g_MoveToTime) {
Mike Cleron7d5d7462009-10-20 14:06:00 -0700176
177 /*
Jason Samsc1c521e2009-10-19 14:45:45 -0700178 float a = 2.f * (state->targetPos - g_MoveToOldPos) /
179 (g_MoveToTotalTime * g_MoveToTotalTime);
180 if (g_MoveToTime > (g_MoveToTotalTime * 0.5f)) {
181 // slowing
182 g_PosPage = state->targetPos - 0.5f * a * (g_MoveToTime * g_MoveToTime);
183 } else {
184 // accelerating.
185 float t = g_MoveToTotalTime - g_MoveToTime;
186 g_PosPage = g_MoveToOldPos + 0.5f * a * (t * t);
187 }
Mike Cleron7d5d7462009-10-20 14:06:00 -0700188 */
189
190 // New position is old posiition + (total distance) * (interpolated time)
191 g_PosPage = g_MoveToOldPos + (state->targetPos - g_MoveToOldPos) * getInterpolation((g_MoveToTotalTime - g_MoveToTime) / g_MoveToTotalTime);
192
Jason Samsc1c521e2009-10-19 14:45:45 -0700193 g_MoveToTime -= g_DT;
194 if (g_MoveToTime <= 0) {
195 g_MoveToTime = 0;
196 g_PosPage = state->targetPos;
197 }
198 return;
199 }
200
Jason Sams0f505e52009-10-13 17:18:35 -0700201 if (g_PosPage < -0.5f) {
202 accel = g_AttractionTable[0] * g_DT;
Jason Sams0f505e52009-10-13 17:18:35 -0700203 outOfRange = 1;
204 }
205 if ((g_PosPage - g_PosMax) > 0.5f) {
206 accel = g_AttractionTable[(int)g_PhysicsTableSize] * g_DT;
Jason Sams0f505e52009-10-13 17:18:35 -0700207 outOfRange = 1;
208 }
209
210 // If our velocity is low OR acceleration is opposing it, apply it.
Jason Samsb52dfa02009-10-14 20:16:14 -0700211 if (fabsf(g_PosVelocity) < 1.0f || (g_PosVelocity * accel) < 0 || outOfRange) {
Jason Sams0f505e52009-10-13 17:18:35 -0700212 g_PosVelocity += accel;
213 }
214
215 if ((friction > fabsf(g_PosVelocity)) &&
216 (friction > fabsf(accel)) &&
217 !outOfRange) {
218 // Special get back to center and overcome friction physics.
219 float t = tablePosNorm - 0.5f;
220 if (fabsf(t) < (friction * g_DT)) {
221 // really close, just snap
222 g_PosPage = roundf(g_PosPage);
223 g_PosVelocity = 0;
224 } else {
225 if (t > 0) {
226 g_PosVelocity = -friction;
227 } else {
228 g_PosVelocity = friction;
229 }
230 }
231 } else {
232 // Normal physics
233 if (g_PosVelocity > 0) {
234 g_PosVelocity -= friction;
235 g_PosVelocity = maxf(g_PosVelocity, 0);
236 } else {
237 g_PosVelocity += friction;
238 g_PosVelocity = minf(g_PosVelocity, 0);
239 }
240 }
241 g_PosPage += g_PosVelocity * g_DT;
242
243 // Check for out of boundry conditions.
244 if (g_PosPage < 0 && g_PosVelocity < 0) {
245 g_PosPage = maxf(g_PosPage, -0.49);
246 float damp = 1.0 + (g_PosPage * 4);
247 damp = clampf(damp, 0.f, 0.9f);
248 g_PosVelocity *= damp;
249 }
250 if (g_PosPage > g_PosMax && g_PosVelocity > 0) {
251 g_PosPage = minf(g_PosPage, g_PosMax + 0.49);
252 float damp = 1.0 - ((g_PosPage - g_PosMax) * 4);
253 damp = clampf(damp, 0.f, 0.9f);
254 g_PosVelocity *= damp;
255 }
256}
257
Jason Sams09c6fc02009-10-16 17:23:23 -0700258int positionStrip(float row, float column, int isTop, float p)
Jason Sams0f505e52009-10-13 17:18:35 -0700259{
260 float mat1[16];
Jason Sams0f505e52009-10-13 17:18:35 -0700261 float x = 0.5f * (column - 1.5f);
Jason Sams0f505e52009-10-13 17:18:35 -0700262 float scale = 72.f * 3 / getWidth();
Jason Sams0f505e52009-10-13 17:18:35 -0700263
264 if (isTop) {
265 matrixLoadTranslate(mat1, x, 0.8f, 0.f);
266 matrixScale(mat1, scale, scale, 1.f);
267 } else {
268 matrixLoadTranslate(mat1, x, -0.9f, 0.f);
269 matrixScale(mat1, scale, -scale, 1.f);
270 }
Jason Sams461073b2009-10-20 12:06:28 -0700271 matrixTranslate(mat1, 0, p * 2, 0.f);
272 matrixRotate(mat1, -p * 50, 1, 0, 0);
Jason Sams0f505e52009-10-13 17:18:35 -0700273 vpLoadModelMatrix(mat1);
274
Jason Samsb52dfa02009-10-14 20:16:14 -0700275 float soff = -(row * 1.4);
Jason Sams0f505e52009-10-13 17:18:35 -0700276 if (isTop) {
277 matrixLoadScale(mat1, 1.f, -0.85f, 1.f);
Jason Samsb52dfa02009-10-14 20:16:14 -0700278 matrixTranslate(mat1, 0, soff - 0.97f, 0);
Jason Sams0f505e52009-10-13 17:18:35 -0700279 } else {
280 matrixLoadScale(mat1, 1.f, 0.85f, 1.f);
Jason Samsb52dfa02009-10-14 20:16:14 -0700281 matrixTranslate(mat1, 0, soff - 0.45f, 0);
Jason Sams0f505e52009-10-13 17:18:35 -0700282 }
283 vpLoadTextureMatrix(mat1);
Jason Samsb52dfa02009-10-14 20:16:14 -0700284 return -soff * 10.f;
Jason Sams0f505e52009-10-13 17:18:35 -0700285}
286
287void
288draw_home_button()
289{
Jason Sams41b61c82009-10-15 15:40:54 -0700290 setColor(1.0f, 1.0f, 1.0f, 1.0f);
Joe Onoratod63458b2009-10-15 21:19:09 -0700291 bindTexture(NAMED_PFTexLinear, 0, state->homeButtonId);
Jason Sams96b49d82009-10-20 14:28:53 -0700292 float x = (SCREEN_WIDTH_PX - params->homeButtonTextureWidth) / 2;
293 float y = (g_Zoom - 1.f) * params->homeButtonTextureHeight;
Jason Sams0f505e52009-10-13 17:18:35 -0700294
Jason Sams96b49d82009-10-20 14:28:53 -0700295 y -= 36; // move the house to the edge of the screen as it doesn't fill the texture.
296 drawSpriteScreenspace(x, y, 0, params->homeButtonTextureWidth, params->homeButtonTextureHeight);
Jason Sams0f505e52009-10-13 17:18:35 -0700297}
298
Jason Sams09c6fc02009-10-16 17:23:23 -0700299void drawFrontGrid(float rowOffset, float p)
Jason Sams0f505e52009-10-13 17:18:35 -0700300{
301 float h = getHeight();
302 float w = getWidth();
303
304 int intRowOffset = rowOffset;
305 float rowFrac = rowOffset - intRowOffset;
306 float colWidth = getWidth() / 4;
307 float rowHeight = colWidth + 25.f;
308 float yoff = h - ((h - (rowHeight * 4.f)) / 2);
309
310 yoff -= 110;
311
312 int row, col;
313 int iconNum = intRowOffset * 4;
314 float ymax = yoff;
315 float ymin = yoff - (3 * rowHeight) - 70;
316
317 for (row = 0; row < 5; row++) {
318 float y = yoff - ((-rowFrac + row) * rowHeight);
319
320 for (col=0; col < 4; col++) {
321 if (iconNum >= state->iconCount) {
322 return;
323 }
324
325 if (iconNum >= 0) {
326 float x = colWidth * col - ((128 - colWidth) / 2);
327
328 if ((y >= ymin) && (y <= ymax)) {
Jason Sams41b61c82009-10-15 15:40:54 -0700329 setColor(1.f, 1.f, 1.f, 1.f);
Joe Onorato742d7fc2009-10-15 19:48:16 -0700330
Jason Sams09c6fc02009-10-16 17:23:23 -0700331 if (state->selectedIconIndex == iconNum && !p) {
Joe Onorato742d7fc2009-10-15 19:48:16 -0700332 bindTexture(NAMED_PFTexLinear, 0, state->selectedIconTexture);
333 drawSpriteScreenspace(x, y, 0, 128, 128);
334 }
335
Jason Sams0f505e52009-10-13 17:18:35 -0700336 bindTexture(NAMED_PFTexLinear, 0, loadI32(ALLOC_ICON_IDS, iconNum));
Jason Sams09c6fc02009-10-16 17:23:23 -0700337 if (!p) {
338 drawSpriteScreenspace(x, y, 0, 128, 128);
339 } else {
340 float px = ((x + 64) - (getWidth() / 2)) / (getWidth() / 2);
341 float py = ((y + 64) - (getHeight() / 2)) / (getWidth() / 2);
342 float d = 64.f / (getWidth() / 2);
343 px *= p + 1;
344 py *= p + 1;
345 drawQuadTexCoords(px - d, py - d, -p, 0, 1,
346 px - d, py + d, -p, 0, 0,
347 px + d, py + d, -p, 1, 0,
348 px + d, py - d, -p, 1, 1);
349 }
Jason Sams0f505e52009-10-13 17:18:35 -0700350 }
351
352 float y2 = y - 44;
353 float a = 1.f;
354 if (y2 < ymin) {
355 a = 1.f - (ymin - y2) * 0.02f;
356 }
357 if (y > (ymax + 40)) {
358 a = 1.f - (y - (ymax + 40)) * 0.02f;
359 }
360 a = clampf(a, 0, 1);
Jason Sams09c6fc02009-10-16 17:23:23 -0700361 a *= maxf(0, 1.f - p * 5.f);
Jason Sams0f505e52009-10-13 17:18:35 -0700362
Jason Sams41b61c82009-10-15 15:40:54 -0700363 setColor(1, 1, 1, a);
Jason Sams0f505e52009-10-13 17:18:35 -0700364 bindTexture(NAMED_PFTexLinear, 0, loadI32(ALLOC_LABEL_IDS, iconNum));
365 drawSpriteScreenspace(x, y - 44, 0,
366 params->bubbleBitmapWidth, params->bubbleBitmapHeight);
367 }
368 iconNum++;
369 }
370 }
371}
372
Jason Sams09c6fc02009-10-16 17:23:23 -0700373void drawStrip(float row, float column, int isTop, int iconNum, float p)
Jason Samsb52dfa02009-10-14 20:16:14 -0700374{
375 if (iconNum < 0) return;
Jason Sams09c6fc02009-10-16 17:23:23 -0700376 int offset = positionStrip(row, column, isTop, p);
Jason Samsb52dfa02009-10-14 20:16:14 -0700377 bindTexture(NAMED_PFTexLinear, 0, loadI32(ALLOC_ICON_IDS, iconNum));
378 if (offset < -20) return;
379 offset = clamp(offset, 0, 199 - 20);
Jason Sams37e7c2b2009-10-19 12:55:43 -0700380 drawSimpleMeshRange(NAMED_SMMesh, offset * 6, 20 * 6);
Jason Samsb52dfa02009-10-14 20:16:14 -0700381}
382
Jason Sams461073b2009-10-20 12:06:28 -0700383void drawTop(float rowOffset, float p)
Jason Sams0f505e52009-10-13 17:18:35 -0700384{
Jason Sams0f505e52009-10-13 17:18:35 -0700385 int row, col;
386 int iconNum = 0;
387 for (row = 0; row < rowOffset; row++) {
388 for (col=0; col < 4; col++) {
389 if (iconNum >= state->iconCount) {
390 return;
391 }
Jason Sams461073b2009-10-20 12:06:28 -0700392 drawStrip(rowOffset - row, col, 1, iconNum, p);
Jason Sams0f505e52009-10-13 17:18:35 -0700393 iconNum++;
394 }
395 }
396}
397
Jason Sams09c6fc02009-10-16 17:23:23 -0700398void drawBottom(float rowOffset, float p)
Jason Sams0f505e52009-10-13 17:18:35 -0700399{
400 float pos = -1.f;
401 int intRowOffset = rowOffset;
402 pos -= rowOffset - intRowOffset;
403
404 int row, col;
405 int iconNum = (intRowOffset + 3) * 4;
406 while (1) {
407 for (col=0; col < 4; col++) {
408 if (iconNum >= state->iconCount) {
409 return;
410 }
411 if (pos > -1) {
Jason Sams09c6fc02009-10-16 17:23:23 -0700412 drawStrip(pos, col, 0, iconNum, p);
Jason Sams0f505e52009-10-13 17:18:35 -0700413 }
414 iconNum++;
415 }
416 pos += 1.f;
417 }
418}
419
420int
421main(int launchID)
422{
423 // Compute dt in seconds.
424 int newTime = uptimeMillis();
425 g_DT = (newTime - g_LastTime) / 1000.f;
426 g_LastTime = newTime;
Mike Cleron7d5d7462009-10-20 14:06:00 -0700427
Jason Sams0f505e52009-10-13 17:18:35 -0700428 if (!g_DrawLastFrame) {
429 // If we stopped rendering we cannot use DT.
430 // assume 30fps in this case.
431 g_DT = 0.033f;
432 }
Jason Samsb52dfa02009-10-14 20:16:14 -0700433 // physics may break if DT is large.
434 g_DT = minf(g_DT, 0.2f);
Jason Sams0f505e52009-10-13 17:18:35 -0700435
436 if (g_Zoom != state->zoomTarget) {
Jason Sams09c6fc02009-10-16 17:23:23 -0700437 float dz;
438 if (state->zoomTarget > 0.5f) {
439 dz = (1 - g_Zoom) * 0.2f;
440 } else {
441 dz = -g_DT - (1 - g_Zoom) * 0.2f;
442 }
443 if (dz && (fabsf(dz) < 0.02f)) {
Jason Sams0f505e52009-10-13 17:18:35 -0700444 if (dz > 0) {
Jason Sams09c6fc02009-10-16 17:23:23 -0700445 dz = 0.02f;
Jason Sams0f505e52009-10-13 17:18:35 -0700446 } else {
Jason Sams09c6fc02009-10-16 17:23:23 -0700447 dz = -0.02f;
Jason Sams0f505e52009-10-13 17:18:35 -0700448 }
449 }
450 if (fabsf(g_Zoom - state->zoomTarget) < fabsf(dz)) {
451 g_Zoom = state->zoomTarget;
452 } else {
453 g_Zoom += dz;
454 }
455 updateReadback();
456 }
457
458 // Set clear value to dim the background based on the zoom position.
Jason Sams41b61c82009-10-15 15:40:54 -0700459 if ((g_Zoom < 0.001f) && (state->zoomTarget < 0.001f) && !g_SpecialHWWar) {
Jason Sams0f505e52009-10-13 17:18:35 -0700460 pfClearColor(0.0f, 0.0f, 0.0f, 0.0f);
461 // When we're zoomed out and not tracking motion events, reset the pos to 0.
462 if (!g_LastTouchDown) {
463 g_PosPage = 0;
464 }
465 return lastFrame(0);
Jason Sams0f505e52009-10-13 17:18:35 -0700466 } else {
467 pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
468 }
469
470 // icons & labels
471 int iconCount = state->iconCount;
472 g_PosMax = ((iconCount + 3) / 4) - 4;
473 if (g_PosMax < 0) g_PosMax = 0;
474
475 updatePos(0.1f);
476 updateReadback();
477
478 //debugF(" draw g_PosPage", g_PosPage);
479
480 // Draw the icons ========================================
481
482 //bindProgramFragment(NAMED_PFColor);
483 //positionStrip(1, 0, 0);
Jason Sams37e7c2b2009-10-19 12:55:43 -0700484 //drawSimpleMesh(NAMED_SMMesh);
Jason Sams0f505e52009-10-13 17:18:35 -0700485
486 bindProgramFragment(NAMED_PFTexLinear);
487
488
Jason Sams461073b2009-10-20 12:06:28 -0700489 drawTop(g_PosPage, 1-g_Zoom);
Jason Sams09c6fc02009-10-16 17:23:23 -0700490 drawBottom(g_PosPage, 1-g_Zoom);
Jason Sams0f505e52009-10-13 17:18:35 -0700491
492 {
493 float mat1[16];
494 matrixLoadIdentity(mat1);
495 vpLoadModelMatrix(mat1);
496 vpLoadTextureMatrix(mat1);
497 }
Jason Sams09c6fc02009-10-16 17:23:23 -0700498 drawFrontGrid(g_PosPage, 1-g_Zoom);
Jason Samsb52dfa02009-10-14 20:16:14 -0700499 draw_home_button();
Jason Sams0f505e52009-10-13 17:18:35 -0700500
Jason Sams41b61c82009-10-15 15:40:54 -0700501
502 // This is a WAR to do a rendering pass without drawing during init to
503 // force the driver to preload and compile its shaders.
504 // Without this the first animation does not appear due to the time it
505 // takes to init the driver state.
506 if (g_SpecialHWWar) {
507 g_SpecialHWWar = 0;
508 return 1;
509 }
510
Jason Sams0f505e52009-10-13 17:18:35 -0700511 // Bug workaround where the last frame is not always displayed
512 // So we keep rendering until the bug is fixed.
Mike Cleron7d5d7462009-10-20 14:06:00 -0700513 return lastFrame((g_PosVelocity != 0) || fracf(g_PosPage) || g_Zoom != state->zoomTarget || (g_MoveToTime != 0));
Jason Sams0f505e52009-10-13 17:18:35 -0700514}
515