void AnimationTimerProc(HWND hwnd, UINT timer) { Bool need_redraw = False; static DWORD last_animate_time = 0; DWORD dt, now; PingTimerProc(hwnd, 0, 0, 0); if (!(GameGetState() == GAME_PLAY || GameGetState() == GAME_SELECT)) return; if (last_animate_time == 0) { last_animate_time = timeGetTime(); return; } config.quickstart = FALSE; now = timeGetTime(); dt = now - last_animate_time; last_animate_time = now; timeLastFrame = dt; /* Send event to modules */ ModuleEvent(EVENT_ANIMATE, dt); /* Send event to non-module child windows */ if (config.animate) { Lagbox_Animate(dt); } /* Animate the first-person view elements */ if (config.animate && GetGameDataValid()) { // Avoid short-circuiting OR need_redraw |= ObjectsMove(dt); need_redraw |= ProjectilesMove(dt); need_redraw |= AnimateObjects(dt); need_redraw |= AnimateRoom(¤t_room, dt); need_redraw |= AnimateProjectiles(dt); need_redraw |= AnimatePlayerOverlays(dt); need_redraw |= AnimateBackgroundOverlays(dt); AnimateDescription(dt); need_redraw |= AnimateEffects(dt); if (need_redraw) RedrawAll(); } if (GetGameDataValid()) RedrawForce(); return; }
/* * GraphicsAreaResize: Set view variable to reflect size of window. * Use when window is resized, and on startup. */ void GraphicsAreaResize(int xsize, int ysize) { int new_xsize, new_ysize; /* Need signed #s */ Bool must_redraw = False; int max_width, max_height; int stretchfactor = config.large_area ? 2 : 1; int iHeightAvailableForMapAndStats; max_width = stretchfactor * MAXX; max_height = stretchfactor * MAXY; new_xsize = min(xsize - INVENTORY_MIN_WIDTH, max_width); new_ysize = ysize - TEXT_AREA_MIN_HEIGHT - BOTTOM_BORDER - GetTextInputHeight() - TOP_BORDER - EDGETREAT_HEIGHT * 2; if (config.toolbar) new_ysize -= TOOLBAR_BUTTON_HEIGHT - MIN_TOP_TOOLBAR; else new_ysize -= MIN_TOP_NOTOOLBAR; new_ysize = min(new_ysize, max_height); /* Make sizes divisible by 4. Must be even for draw3d, and when * stretchfactor = 2, need divisible by 4 so that room fits exactly in view */ new_xsize &= ~3; new_ysize &= ~3; if (new_xsize < 0) new_xsize = 0; if (new_ysize < 0) new_ysize = 0; /* Move grid area to appropriate place */ view.x = LEFT_BORDER + HIGHLIGHT_THICKNESS + EDGETREAT_WIDTH; view.y = HIGHLIGHT_THICKNESS; if (config.toolbar) view.y += TOOLBAR_Y + TOOLBAR_BUTTON_HEIGHT + MIN_TOP_TOOLBAR; else view.y += TOP_BORDER + MIN_TOP_NOTOOLBAR + EDGETREAT_HEIGHT; if (new_xsize != view.cx || new_ysize != view.cy) must_redraw = True; view.cx = new_xsize; view.cy = new_ysize; D3DRenderResizeDisplay(view.x, view.y, view.cx, view.cy); // areaMiniMap added by ajw. areaMiniMap.x = view.x + view.cx + LEFT_BORDER + 2 * HIGHLIGHT_THICKNESS + MAPTREAT_WIDTH; areaMiniMap.cx = min( xsize - areaMiniMap.x - 2 * HIGHLIGHT_THICKNESS - EDGETREAT_WIDTH - MAPTREAT_WIDTH, MINIMAP_MAX_WIDTH ); areaMiniMap.y = 2 * TOP_BORDER + USERAREA_HEIGHT + EDGETREAT_HEIGHT + (MAPTREAT_HEIGHT * 2) - 1; iHeightAvailableForMapAndStats = ysize - areaMiniMap.y - 2 * HIGHLIGHT_THICKNESS - EDGETREAT_HEIGHT; areaMiniMap.cy = (int)( iHeightAvailableForMapAndStats * PROPORTION_MINIMAP ) - HIGHLIGHT_THICKNESS - MAPTREAT_HEIGHT; areaMiniMap.cy = min( areaMiniMap.cy, MINIMAP_MAX_HEIGHT ); areaMiniMap.cy -= (TOOLBAR_BUTTON_HEIGHT + TOOLBAR_SEPARATOR_WIDTH) * 2; areaMiniMap.y += (TOOLBAR_BUTTON_HEIGHT + TOOLBAR_SEPARATOR_WIDTH) * 2; MapMiniSizeChanged(&areaMiniMap); // Tell view edge treatment elements to reposition themselves. ViewElementsReposition( &view ); if (must_redraw) { RedrawAll(); RedrawForce(); } }