Commit 03b949f6 authored by Gerhard Stein's avatar Gerhard Stein

More Cleanups

parent b9556167
......@@ -110,7 +110,7 @@ word *CMap::getBackgroundData()
return m_Plane[0].getMapDataPtr();
}
bool CMap::findScrollHorizontalScrollBlocker(const int y)
bool CMap::findHorizontalScrollBlocker(const int y)
{
if(g_pBehaviorEngine->getEngine() != ENGINE_GALAXY)
return false;
......@@ -129,8 +129,8 @@ bool CMap::findScrollHorizontalScrollBlocker(const int y)
}
// searches the map's object layer for object OBJ.
// if it is found returns nonzero and places the
// coordinates of the first occurance of the object
// if it is found returns non-zero and places the
// coordinates of the first occurrence of the object
// in (xout,yout)
bool CMap::findObject(unsigned int obj, int *xout, int *yout)
{
......@@ -308,7 +308,7 @@ bool CMap::scrollDown(const bool force)
{
const int res_height = g_pVideoDriver->getGameResolution().h;
if( !force && findScrollHorizontalScrollBlocker((m_scrolly+res_height)<<STC) )
if( !force && findHorizontalScrollBlocker((m_scrolly+res_height)<<STC) )
return false;
if(m_scrolly < ((m_height-2)<<4) - res_height )
......@@ -334,7 +334,7 @@ bool CMap::scrollDown(const bool force)
bool CMap::scrollUp(const bool force)
{
if( !force && findScrollHorizontalScrollBlocker(m_scrolly<<STC) )
if( !force && findHorizontalScrollBlocker(m_scrolly<<STC) )
return false;
if( m_scrolly > 32 )
......
......@@ -68,7 +68,6 @@ public:
* As far known, this is only used in the Galaxy engine
* \param y The y coordinate (CSFed) of the row where to look for that blocker
*/
bool findScrollHorizontalScrollBlocker(const int y);
bool findObject(unsigned int obj, int *xout, int *yout);
bool findTile(unsigned int tile, int *xout, int *yout, int plane=1);
......@@ -115,6 +114,9 @@ public:
bool isSecret;
private:
bool findHorizontalScrollBlocker(const int y);
Uint8 m_scrollpix; // (0-7) for tracking when to draw a stripe
Uint16 m_mapx; // map X location shown at scrollbuffer row 0
......
......@@ -7,6 +7,7 @@
#include "hardware/Configurator.h"
#include "common/CSettings.h"
#include "CCameraSettings.h"
#include "sdl/input/CInput.h"
#include "sdl/CTimer.h"
#include "sdl/resolutionlist.h"
......
......@@ -9,7 +9,6 @@
#define CVIDEOSETTINGS_H_
#include "CBaseMenu.h"
#include "CCameraSettings.h"
#include "sdl/CVideoDriver.h"
#include <SDL.h>
#include <string>
......
......@@ -104,10 +104,10 @@ void CCamera::process(const bool force)
}
}
Uint16& scroll_x = mp_Map->m_scrollx;
Uint16& scroll_y = mp_Map->m_scrolly;
const Uint16 scroll_x = mp_Map->m_scrollx;
const Uint16 scroll_y = mp_Map->m_scrolly;
// delta_ is how much we need to scroll in order to get the camera stalled
// delta is how much we need to scroll in order to get the camera stalled
int delta_x = (getXPosition()>>STC)-scroll_x;
int delta_y = (getYPosition()>>STC)-scroll_y;
......@@ -152,7 +152,7 @@ void CCamera::process(const bool force)
}while(delta_y < up-speed && scroll_y > 32);
}
// This will always snap correctly to the edge
// This will always snap correctly to the edges
while(scroll_x < 32)
mp_Map->scrollRight(true);
while(scroll_x > mp_Map->m_maxscrollx)
......
......@@ -54,40 +54,43 @@ void CLindsey::process()
void CLindsey::getTouchedBy(CSpriteObject &theObject)
{
// When Keen touches the pincess give that hint
if(prepareToVanish)
return;
// When Keen touches the pincess give that hint
if( dynamic_cast<CPlayerLevel*>(&theObject) )
{
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
g_pSound->playSound(SOUND_GET_WETSUIT, PLAY_PAUSEALL);
std::string lindsey_text[3];
lindsey_text[0] = g_pBehaviorEngine->getString(answermap[0]);
Uint16 cur_level = mp_Map->getLevel();
if(cur_level > 5)
{
lindsey_text[1] = g_pBehaviorEngine->getString(answermap[1]);
lindsey_text[2] = g_pBehaviorEngine->getString(answermap[3]);
}
else
{
lindsey_text[1] = g_pBehaviorEngine->getString(answermap[2]);
lindsey_text[2] = g_pBehaviorEngine->getString(answermap[4]);
}
std::vector< SmartPointer<EventSendBitmapDialogMsg> > msgs;
msgs.push_back( new EventSendBitmapDialogMsg(g_pGfxEngine->getBitmap(108), lindsey_text[0], LEFT) );
msgs.push_back( new EventSendBitmapDialogMsg(g_pGfxEngine->getBitmap(108), lindsey_text[1], LEFT) );
msgs.push_back( new EventSendBitmapDialogMsg(*g_pGfxEngine->getBitmap("KEENTHUMBSUP"), lindsey_text[2], RIGHT) );
EventContainer.add( new EventSendBitmapDialogMessages(msgs) );
prepareToVanish = true;
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
g_pSound->playSound(SOUND_GET_WETSUIT, PLAY_PAUSEALL);
std::string lindsey_text[3];
lindsey_text[0] = g_pBehaviorEngine->getString(answermap[0]);
Uint16 cur_level = mp_Map->getLevel();
if(cur_level > 5)
{
lindsey_text[1] = g_pBehaviorEngine->getString(answermap[1]);
lindsey_text[2] = g_pBehaviorEngine->getString(answermap[3]);
}
else
{
lindsey_text[1] = g_pBehaviorEngine->getString(answermap[2]);
lindsey_text[2] = g_pBehaviorEngine->getString(answermap[4]);
}
std::vector< SmartPointer<EventSendBitmapDialogMsg> > msgs;
msgs.push_back( new EventSendBitmapDialogMsg(g_pGfxEngine->getBitmap(108), lindsey_text[0], LEFT) );
msgs.push_back( new EventSendBitmapDialogMsg(g_pGfxEngine->getBitmap(108), lindsey_text[1], LEFT) );
msgs.push_back( new EventSendBitmapDialogMsg(*g_pGfxEngine->getBitmap("KEENTHUMBSUP"), lindsey_text[2], RIGHT) );
EventContainer.add( new EventSendBitmapDialogMessages(msgs) );
prepareToVanish = true;
}
}
......
......@@ -252,14 +252,8 @@ void CVideoDriver::setScaleType(bool IsNormal)
// defines the scroll-buffer that is used for blitScrollSurface(). It's normally passed by a CMap Object
// it might have when a level-map is loaded.
void CVideoDriver::updateScrollBuffer(SmartPointer<CMap> &map) {
map->drawAll();
mp_VideoEngine->UpdateScrollBufX(map->m_scrollx);
mp_VideoEngine->UpdateScrollBufY(map->m_scrolly);
}
// TODO: Replace this by the upper function. Will be deprecated
void CVideoDriver::updateScrollBuffer(CMap &map) {
void CVideoDriver::updateScrollBuffer(CMap &map)
{
map.drawAll();
mp_VideoEngine->UpdateScrollBufX(map.m_scrollx);
mp_VideoEngine->UpdateScrollBufY(map.m_scrolly);
......@@ -324,7 +318,8 @@ void CVideoDriver::AddConsoleMsg(const char *the_msg) {
ConsoleExpireTimer = CONSOLE_EXPIRE_RATE;
}
void CVideoDriver::saveCameraBounds(st_camera_bounds &CameraBounds) {
void CVideoDriver::saveCameraBounds(st_camera_bounds &CameraBounds)
{
int &left = CameraBounds.left;
int &up = CameraBounds.up;
int &right = CameraBounds.right;
......
......@@ -45,8 +45,10 @@ public:
void drawConsoleMessages();
void blitScrollSurface();
void updateScrollBuffer(SmartPointer<CMap> &map);
void updateScrollBuffer(CMap &map);
void updateScrollBuffer(SmartPointer<CMap> &map)
{ updateScrollBuffer(*map.get()); }
void collectSurfaces();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment