# HG changeset patch # User phoku@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1237990679 0 # Node ID ed1565a5a2a0f648d4a77ba0f1e1c575a91789e1 # Parent 7887f385486210af0a3ed98771fb0c5f6fea7f71 Fixed second camera in rio. Now multiple Camera.setLocation calls per frame are handled correctly. diff -r 7887f3854862 -r ed1565a5a2a0 clients/rio_de_hola/scripts/world.py --- a/clients/rio_de_hola/scripts/world.py Wed Mar 25 09:38:10 2009 +0000 +++ b/clients/rio_de_hola/scripts/world.py Wed Mar 25 14:17:59 2009 +0000 @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import fife, math, random import pychan import pychan.widgets as widgets @@ -145,8 +146,8 @@ self.initial_cam2_x = self.cameras['small'].getLocation().getExactLayerCoordinates().x self.cur_cam2_x = self.initial_cam2_x self.cam2_scrolling_right = True - self.cameras['small'].setEnabled(False) - + # We need to set the second cameras location + self.cameras['small'].setLocation(self.hero.agent.getLocation()) self.target_rotation = self.cameras['main'].getRotation() def save(self, filename): diff -r 7887f3854862 -r ed1565a5a2a0 engine/core/view/camera.cpp --- a/engine/core/view/camera.cpp Wed Mar 25 09:38:10 2009 +0000 +++ b/engine/core/view/camera.cpp Wed Mar 25 14:17:59 2009 +0000 @@ -145,7 +145,7 @@ if ((m_prev_origo == m_cur_origo) && (m_prev_origo == ScreenPoint(0,0,0))) { m_cur_origo = toScreenCoordinates(ExactModelCoordinate(0,0,0)); m_prev_origo = m_cur_origo; - } + } m_location = location; CellGrid* cg = NULL; @@ -160,7 +160,6 @@ updateMatrices(); - m_prev_origo = m_cur_origo; m_cur_origo = toScreenCoordinates(ExactModelCoordinate(0,0,0)); } @@ -473,7 +472,7 @@ } void Camera::render() { - ScreenPoint cammove = getLatestMovement(); + ScreenPoint cammove = m_prev_origo - m_cur_origo; Map* map = m_location.getMap(); if (!map) { diff -r 7887f3854862 -r ed1565a5a2a0 engine/core/view/camera.h --- a/engine/core/view/camera.h Wed Mar 25 09:38:10 2009 +0000 +++ b/engine/core/view/camera.h Wed Mar 25 14:17:59 2009 +0000 @@ -253,12 +253,6 @@ */ void refresh(); - /** Returns latest camera movement in screen coordinates (dx, dy) - */ - inline ScreenPoint getLatestMovement() { - return m_prev_origo - m_cur_origo; - } - /** Resets temporary values from last update round, like warped flag */ void resetUpdates();