Commit 14f590d8 authored by Gerhard Stein's avatar Gerhard Stein

Revert "fixed enemy and shot speeds relative to keen as far as I could"

This reverts commit 11238485, reversing
changes made to 95f862fd.

Conflicts:

	src/engine/galaxy/GraphicsIDs.cpp
parent 8ec7afa5
......@@ -130,7 +130,7 @@ bool CGameControl::init(char mode)
if(m_Episode >= 4)
mp_PlayGame = new galaxy::CPlayGameGalaxy( m_ExeFile, m_startLevel,
m_Numplayers, m_Difficulty,
mp_option);
mp_option, m_SavedGame);
else
{
if(m_startLevel == 0) m_startLevel = WORLD_MAP_LEVEL;
......
......@@ -503,6 +503,9 @@ void CMap::drawAnimatedTile(SDL_Surface *dst, Uint16 mx, Uint16 my, Uint16 tile)
void CMap::animateAllTiles()
{
if(!m_animation_enabled)
return;
// Let the animation timer tick!!
m_animtiletimer++;
......
......@@ -33,7 +33,6 @@ public:
bool mustEndGame() { return m_Endgame; }
bool mustStartGame() { return (m_NumPlayers > 0 and m_Difficulty > -1); }
bool getShowStory() { return (m_menu_type==STORY); }
bool mustBeClosed() { return m_mustclose; }
bool getBacktoDemo() { return m_demoback; }
......
......@@ -24,7 +24,8 @@ HealthPoints(1),
sprite(BLANKSPRITE),
mp_object(NULL),
mp_Map(pmap),
m_blinktime(0)
m_blinktime(0),
m_invincible(false)
{
bboxX1 = 0;
bboxX2 = 0;
......@@ -47,9 +48,7 @@ m_blinktime(0)
scrx = scry = 0;
dead = false;
onscreen = false;
hasbeenonscreen = false;
canbezapped = 0;
honorPriority = true;
touchPlayer = touchedBy = 0;
cansupportplayer = false;
......@@ -323,7 +322,7 @@ void CObject::moveLeft(int amount, bool force)
blockedu = false;
if(!performSlopedTileDown(x, y2, -amount))
performSlopedTileUp(x, y1+(2<<STC), -amount);
performSlopedTileUp(x, y1, -amount);
}
void CObject::moveRight(int amount, bool force)
......@@ -379,8 +378,8 @@ void CObject::moveRight(int amount, bool force)
else
blockedu = false;
if(!performSlopedTileDown(x, y2+(1<<STC), amount));
performSlopedTileUp(x, y1-(1<<STC), amount);
if(!performSlopedTileDown(x, y2, amount));
performSlopedTileUp(x, y1, amount);
}
void CObject::moveUp(int amount)
......@@ -521,8 +520,6 @@ unsigned int CObject::getYMidPos()
// returns nonzero if object1 overlaps object2
bool CObject::hitdetect(CObject &hitobject)
{
if(m_index == hitobject.m_index) return false;
unsigned int rect1x1, rect1y1, rect1x2, rect1y2;
unsigned int rect2x1, rect2y1, rect2x2, rect2y2;
......@@ -550,6 +547,7 @@ bool CObject::hitdetect(CObject &hitobject)
void CObject::processFalling()
{
if(m_type == OBJ_MESSIE) return;
// make object fall if it must
const int OBJFALLSPEED = 160;
......@@ -578,7 +576,7 @@ void CObject::processFalling()
void CObject::getShotByRay()
{
if(HealthPoints>0)
if( !m_invincible && HealthPoints>0)
{
if(HealthPoints>1 && g_pVideoDriver->getSpecialFXConfig())
blink(10);
......
......@@ -147,6 +147,7 @@ protected:
CMap *mp_Map;
Uint16 m_blinktime;
bool m_invincible;
unsigned int x, y; // x,y location in map coords, CSFed
static int m_number_of_objects;
......
......@@ -551,14 +551,6 @@ void CPlayer::InertiaAndFriction_X()
treshold = 0;
CPhysicsSettings &PhysicsSettings = g_pBehaviorEngine->getPhysicsSettings();
// Check left and right blocks again, because sometimes a door or mangling machine arm move away
int mlx = (getXLeftPos()-1)>>CSF;
int mrx = (getXRightPos()+1)>>CSF;
int my = getYUpPos()>>CSF;
std::vector<CTileProperties> &Tile = g_pBehaviorEngine->getTileProperties(1);
blockedr = Tile[mp_Map->at(mrx,my,1)].bleft;
blockedl = Tile[mp_Map->at(mlx,my,1)].bright;
// Calculate Threshold of your analog device for walking animation speed!
if(!pfrozentime)
{
......
......@@ -63,6 +63,17 @@ void CPlayer::processInLevel()
playpushed();
}
// Check left and right blocks again, because sometimes a door or mangling machine arm move away
if(!godmode)
{
int mlx = (getXLeftPos()-1)>>CSF;
int mrx = (getXRightPos()+1)>>CSF;
int my = getYUpPos()>>CSF;
std::vector<CTileProperties> &Tile = g_pBehaviorEngine->getTileProperties(1);
blockedr = Tile[mp_Map->at(mrx,my,1)].bleft;
blockedl = Tile[mp_Map->at(mlx,my,1)].bright;
}
checkSolidDoors();
InertiaAndFriction_X();
......
......@@ -60,9 +60,9 @@ bool CMessages::extractGlobalStrings()
{
case 131:
{
StringMap.insert( extractString( "CTSPACECHEAT", 0x14DEE, 0x14E51, 0 ) );
StringMap.insert( extractString( "GODMODEON", 0x14EF6, 0x14F06, 0 ) );
StringMap.insert( extractString( "GODMODEOFF", 0x14F07, 0x14F18, 0 ) );
StringMap.insert( extractString( "CTSPACECHEAT", 0x14DEE, 0x14E51 ) );
StringMap.insert( extractString( "GODMODEON", 0x14EF6, 0x14F06 ) );
StringMap.insert( extractString( "GODMODEOFF", 0x14F07, 0x14F18 ) );
StringMap.insert( extractString( "EP1_StatusBox" , 0x15052, 0x150F5, -512 ) );
StringMap.insert( extractString( "EP1_SHIP" , 0x1679B, 0x167D3, -512 ) );
StringMap.insert( extractString( "LIVES_LEFT" , 0x160D8, 0x160E5, -512 ) );
......@@ -110,13 +110,13 @@ bool CMessages::extractGlobalStrings()
StringMap.insert( extractString( "EP2_LVL15_TargetName" , 0x19CF7, 0x19CFD, -804) );
StringMap.insert( extractString( "EP2_LVL16_TargetName" , 0x19CFE, 0x19D07, -804) );
// Message Boxes
StringMap.insert( extractString( "EP2_ESEQ_PART1" , 0x1A4A7, 0x1A558, -775) );
StringMap.insert( extractString( "EP2_ESEQ_PART2" , 0x1A559, 0x1A5F1, -775) );
StringMap.insert( extractString( "EP2_ESEQ_PART3_PAGE1" , 0x1A5FD, 0x1A638, -775) );
StringMap.insert( extractString( "EP2_ESEQ_PART3_PAGE2" , 0x1A639, 0x1A6CE, -775) );
StringMap.insert( extractString( "EP2_ESEQ_PART3_PAGE3" , 0x1A6CF, 0x1A72E, -775) );
StringMap.insert( extractString( "EP2_ESEQ_PART3_PAGE4" , 0x1A72F, 0x1A739, -775) );
StringMap.insert( extractString( "TO_BE_CONTINUED" , 0x1A73A, 0x1A74D, -775 ) );
StringMap.insert( extractString( "EP2_ESEQ_PART1" , 0x1A4A7, 0x1A558, -774) );
StringMap.insert( extractString( "EP2_ESEQ_PART2" , 0x1A559, 0x1A5F0, -774) );
StringMap.insert( extractString( "EP2_ESEQ_PART3_PAGE1" , 0x1A5FD, 0x1A638, -774) );
StringMap.insert( extractString( "EP2_ESEQ_PART3_PAGE2" , 0x1A639, 0x1A6CD, -774) );
StringMap.insert( extractString( "EP2_ESEQ_PART3_PAGE3" , 0x1A6CF, 0x1A72D, -774) );
StringMap.insert( extractString( "EP2_ESEQ_PART3_PAGE4" , 0x1A72F, 0x1A739, -774) );
StringMap.insert( extractString( "TO_BE_CONTINUED" , 0x1A73A, 0x1A74D, -774 ) );
} break;
}
} break;
......@@ -137,18 +137,18 @@ bool CMessages::extractGlobalStrings()
StringMap.insert( extractString( "EP3_SHIP3" , 0x1D1D2, 0x1D24C, -765) );
StringMap.insert( extractString( "EP3_SHIP4" , 0x1D24D, 0x1D2C4, -765) );
//Mortimer
StringMap.insert( extractString( "EP3_MORTIMER" , 0x1C3B3, 0x1C3D8, -806) );
StringMap.insert( extractString( "EP3_MORTIMER2" , 0x1C3D9, 0x1C49B, -806) );
StringMap.insert( extractString( "EP3_MORTIMER3" , 0x1C49C, 0x1C53F, -806) );
StringMap.insert( extractString( "EP3_MORTIMER4" , 0x1C540, 0x1C607, -806) );
StringMap.insert( extractString( "EP3_MORTIMER5" , 0x1C608, 0x1C62A, -806) );
StringMap.insert( extractString( "EP3_MORTIMER6" , 0x1C62B, 0x1C692, -806) );
StringMap.insert( extractString( "EP3_MORTIMER" , 0x1C3B3, 0x1C3D8, -805) );
StringMap.insert( extractString( "EP3_MORTIMER2" , 0x1C3D9, 0x1C49B, -805) );
StringMap.insert( extractString( "EP3_MORTIMER3" , 0x1C49C, 0x1C53F, -805) );
StringMap.insert( extractString( "EP3_MORTIMER4" , 0x1C540, 0x1C607, -805) );
StringMap.insert( extractString( "EP3_MORTIMER5" , 0x1C608, 0x1C62A, -805) );
StringMap.insert( extractString( "EP3_MORTIMER6" , 0x1C62B, 0x1C692, -805) );
// Ending Pages
StringMap.insert( extractString( "EP3_ESEQ_PAGE1" , 0x1C693, 0x1C730, -807) );
StringMap.insert( extractString( "EP3_ESEQ_PAGE2" , 0x1C731, 0x1C7A7, -807) );
StringMap.insert( extractString( "EP3_ESEQ_PAGE3" , 0x1C7A8, 0x1C813, -807) );
StringMap.insert( extractString( "EP3_ESEQ_PAGE4" , 0x1C813, 0x1C821, -807) );
StringMap.insert( extractString( "THE_END" , 0x1C82D, 0x1C847, -807) );
StringMap.insert( extractString( "EP3_ESEQ_PAGE1" , 0x1C692, 0x1C72E, -805) );
StringMap.insert( extractString( "EP3_ESEQ_PAGE2" , 0x1C730, 0x1C7A5, -805) );
StringMap.insert( extractString( "EP3_ESEQ_PAGE3" , 0x1C7A7, 0x1C811, -805) );
StringMap.insert( extractString( "EP3_ESEQ_PAGE4" , 0x1C813, 0x1C81F, -805) );
StringMap.insert( extractString( "THE_END" , 0x1C82D, 0x1C845, -806) );
} break;
}
} break;
......@@ -174,7 +174,3 @@ bool CMessages::extractGlobalStrings()
}
return false;
}
CMessages::~CMessages() {
// TODO Auto-generated destructor stub
}
......@@ -18,7 +18,6 @@ public:
bool extractGlobalStrings();
virtual ~CMessages();
private:
std::pair<std::string, std::string>
extractString( std::string matchingstring, unsigned long start, unsigned long end, long offset=0 );
......
......@@ -118,7 +118,9 @@ static EpisodeInfoStruct EpisodeInfo[] = {
CEGAGraphicsGalaxy::CEGAGraphicsGalaxy(CExeFile &ExeFile) :
CEGAGraphics(ExeFile.getEpisode(), ExeFile.getDataDirectory()),
m_Exefile(ExeFile)
{}
{
createBitmapsIDs();
}
int CEGAGraphicsGalaxy::getNumSprites()
{ return 0; }
......@@ -132,7 +134,7 @@ short CEGAGraphicsGalaxy::getNumTiles()
bool CEGAGraphicsGalaxy::loadData()
{
// Set the palette, so the proper colours are loaded
g_pGfxEngine->Palette.setupColorPalettes();
g_pGfxEngine->Palette.setupColorPalettes(m_Exefile.getRawData(), m_episode);
if(!begin()) return false;
......@@ -164,7 +166,6 @@ bool CEGAGraphicsGalaxy::loadData()
g_pGfxEngine->getTileMap(3), true)) return false;
if(!readSprites( EpisodeInfo[m_episode-4].NumSprites,
EpisodeInfo[m_episode-4].IndexSprites )) return false;
//k456_export_sprites();
//k456_export_texts();
//k456_export_misc();
//k456_export_demos();
......@@ -625,7 +626,11 @@ bool CEGAGraphicsGalaxy::readBitmaps()
extractPicture(Bitmap.getSDLSurface(),
m_egagraph.at(EpisodeInfo[ep].IndexBitmaps + i).data,
BmpHead[i].Width, BmpHead[i].Height);
Bitmap.setName(m_BitmapNameMap[ep][i]);
}
return true;
}
......
......@@ -10,6 +10,7 @@
#include <string>
#include <vector>
#include <map>
#include <SDL.h>
#include "../../fileio/CExeFile.h"
#include "../CEGAGraphics.h"
......@@ -50,12 +51,16 @@ public:
CTilemap &Tilemap, bool tileoff );
bool readSprites( size_t NumSprites, size_t IndexSprite );
void createBitmapsIDs();
virtual ~CEGAGraphicsGalaxy();
private:
std::vector<unsigned long> m_egahead;
std::vector<ChunkStruct> m_egagraph;
std::string m_BitmapNameMap[4][1000];
CExeFile &m_Exefile;
};
......
......@@ -11,8 +11,6 @@
#include "../../sdl/CVideoDriver.h"
#include "../../sdl/CInput.h"
#include "GraphicsIDs.h"
namespace galaxy
{
......@@ -26,7 +24,7 @@ CMenuGalaxy::CMenuGalaxy( char menu_mode, CExeFile &ExeFile, CSavedGame &SavedGa
stOption *pOption, bool &restartVideo ) :
CMenu( menu_mode, ExeFile, SavedGame, pOption, DLG_THEME_GALAXY, restartVideo),
processPtr(&CMenuGalaxy::processMainMenu),
m_TitleBmp(g_pGfxEngine->getBitmap(BMP_MAINMENULABEL))
m_TitleBmp(*g_pGfxEngine->getBitmap("MAINMENULABEL"))
{
// Perform coordinate calculations
m_title_coord.x = (g_pVideoDriver->getGameResolution().w - m_TitleBmp.getWidth())/2-48;
......
......@@ -11,7 +11,6 @@
#include "../../graphics/CBitmap.h"
#include "../../graphics/CFont.h"
#include "../../dialog/CDialog.h"
#include "GraphicsIDs.h"
#include "../../common/CMenu.h"
......
......@@ -13,7 +13,6 @@
#include "../../sdl/CVideoDriver.h"
#include "../../sdl/CInput.h"
#include "GraphicsIDs.h"
namespace galaxy
{
......@@ -22,7 +21,7 @@ CPassiveGalaxy::CPassiveGalaxy(CExeFile &Exefile,
CSavedGame &SavedGame, stOption *p_Option) :
CPassive(Exefile, SavedGame, p_Option),
processMode(&CPassiveGalaxy::processIntro),
m_BackgroundBitmap(g_pGfxEngine->getBitmap(BMP_TITLE)),
m_BackgroundBitmap(*g_pGfxEngine->getBitmap("TITLE")),
mp_Menu(new CMenuGalaxy(PASSIVE, Exefile, SavedGame, p_Option, m_restartVideo))
{ }
......@@ -46,7 +45,7 @@ void CPassiveGalaxy::processIntro()
{
processMode = &CPassiveGalaxy::processTitle;
m_BackgroundBitmap = g_pGfxEngine->getBitmap(BMP_TITLE);
m_BackgroundBitmap = *g_pGfxEngine->getBitmap("TITLE");
g_pGfxEngine->pushEffectPtr(new CPixelate(2));
}
......@@ -65,7 +64,7 @@ void CPassiveGalaxy::processTitle()
{
// Now we process the Galaxy Menu
processMode = &CPassiveGalaxy::processMenu;
m_BackgroundBitmap = g_pGfxEngine->getBitmap(BMP_KEENSWATCH);
m_BackgroundBitmap = *g_pGfxEngine->getBitmap("KEENSWATCH");
g_pGfxEngine->pushEffectPtr(new CColorMerge(8));
}
}
......
......@@ -10,15 +10,19 @@
#include "../../graphics/CGfxEngine.h"
#include "../../sdl/CVideoDriver.h"
#include "../../sdl/CInput.h"
#include "../../StringUtils.h"
namespace galaxy
{
CPlayGameGalaxy::CPlayGameGalaxy(CExeFile &ExeFile, char level,
char numplayers, char difficulty, stOption *p_option) :
char numplayers, char difficulty,
stOption *p_option, CSavedGame &SavedGame) :
CPlayGame(ExeFile, level, numplayers, difficulty, p_option),
m_WorldMap(ExeFile)
m_WorldMap(ExeFile),
mp_Menu(NULL),
m_SavedGame(SavedGame)
{
m_WorldMap.init();
}
......@@ -51,28 +55,53 @@ void CPlayGameGalaxy::loadLevel()
// The main ingame process cycle when keen galaxy is up and running
void CPlayGameGalaxy::process()
{
// TODO: Process code for the main map
// Blit the background
processInput();
// process World Map if active. At the start it's enabled
if(m_WorldMap.isActive())
m_WorldMap.process();
// process World Map if active. At the start it's enabled
//if(m_LevelPlay.isActive())
if(mp_Menu) // In case the menu is open
{
// draw the title bitmap here!
m_BackgroundBitmap.draw(g_pVideoDriver->BlitSurface, 0, 0);
if(mp_Menu->mustClose())
{
delete mp_Menu;
mp_Menu = NULL;
}
else if(mp_Menu->getExitEvent())
{
m_exitgame = true;
}
else
{
mp_Menu->process();
}
}
else
{
processInput();
// process World Map if active. At the start it's enabled
if(m_WorldMap.isActive())
m_WorldMap.process();
// process World Map if active. At the start it's enabled
//if(m_LevelPlay.isActive())
//m_LevelPlay.process();
// process Page if one is open. Could be one of the finale
//if(m_Page.isActive())
// process Page if one is open. Could be one of the finale scenes
//if(m_Page.isActive())
//m_Page.process();
processRendering();
processRendering();
}
}
void CPlayGameGalaxy::processInput()
{
// open the menu
if(g_pInput->getPressedCommand(IC_QUIT))
{
mp_Menu = new CMenuGalaxy(PASSIVE, m_ExeFile, m_SavedGame, mp_option, m_restartVideo);
m_BackgroundBitmap = *g_pGfxEngine->getBitmap("KEENSWATCH");
}
}
......@@ -91,7 +120,8 @@ void CPlayGameGalaxy::cleanup()
CPlayGameGalaxy::~CPlayGameGalaxy()
{
// TODO Auto-generated destructor stub
if(mp_Menu)
delete mp_Menu;
}
}
......@@ -11,6 +11,7 @@
#include "../playgame/CPlayGame.h"
#include "../../common/CMap.h"
#include "CWorldMap.h"
#include "CMenuGalaxy.h"
#include <vector>
namespace galaxy
......@@ -21,7 +22,7 @@ class CPlayGameGalaxy : public CPlayGame
public:
CPlayGameGalaxy(CExeFile &ExeFile, char level,
char numplayers, char difficulty,
stOption *p_option);
stOption *p_option, CSavedGame &SavedGame);
bool loadGameState();
void loadLevel();
......@@ -38,7 +39,9 @@ public:
private:
CWorldMap m_WorldMap;
CMenuGalaxy *mp_Menu;
CSavedGame &m_SavedGame;
CBitmap m_BackgroundBitmap;
};
}
......
......@@ -42,7 +42,6 @@ void CWorldMap::process()
// Animate the tiles of the map
m_Map.animateAllTiles();
for( std::vector<CObject*>::iterator obj=m_ObjectPtr.begin() ;
obj!=m_ObjectPtr.end() ; obj++ )
{
......@@ -60,11 +59,6 @@ void CWorldMap::process()
void CWorldMap::processInput()
{
// TODO: wrap this into the camera class they way it can be used in the vorticons engine
// Also make it more efficient.
//if(g_pInput->getPressedCommand(IC_QUIT))
//m_endgame = true;
}
......
......@@ -4,6 +4,7 @@
* Created on: 06.04.2010
* Author: gerstrong
*
<<<<<<< HEAD
* This file holds the ID numbers of the Graphics used in order to
* draw them in the game. This is the Galaxy Engine, beware!
*/
......@@ -31,3 +32,41 @@ const int BMP_PADDLELABEL = 94;
const int BMP_QUITLABEL = 95;
#endif /* GRAPHICSIDS_H_ */
=======
* This file holds the ID strings of the Graphics used in order to
* draw them in the game. This is the Galaxy Engine, beware!
*/
#include "CEGAGraphicsGalaxy.h"
namespace galaxy
{
void CEGAGraphicsGalaxy::createBitmapsIDs()
{
/// Set the bitmap names
// Keen 4 Bitmap IDs
m_BitmapNameMap[0][103] = "TITLE";
m_BitmapNameMap[0][97] = "KEENSWATCH";
// Menu Labels
m_BitmapNameMap[0][82] = "MAINMENULABEL";
m_BitmapNameMap[0][83] = "NEWGAMELABEL";
m_BitmapNameMap[0][84] = "LOADMENULABEL";
m_BitmapNameMap[0][85] = "SAVEMENULABEL";
m_BitmapNameMap[0][86] = "CONFIGMENULABEL";
m_BitmapNameMap[0][87] = "SNDEFFMENULABEL";
m_BitmapNameMap[0][88] = "MUSICMENULABEL";
m_BitmapNameMap[0][89] = "KEYBMENULABEL";
m_BitmapNameMap[0][90] = "MOVEMENULABEL";
m_BitmapNameMap[0][91] = "BUTTONMENULABEL";
m_BitmapNameMap[0][92] = "JOYMENULABEL";
m_BitmapNameMap[0][93] = "OPTIONSMENULABEL";
m_BitmapNameMap[0][94] = "PADDLELABEL";
m_BitmapNameMap[0][95] = "QUITLABEL";
}
}
>>>>>>> 1123848... fixed enemy and shot speeds relative to keen as far as I could
/*
* GraphicsIDs.h
*
* Created on: 06.04.2010
* Author: gerstrong
*
* This file holds the ID numbers of the Graphics used in order to
* draw them in the game. This is the Galaxy Engine, beware!
*/
#ifndef GRAPHICSIDS_H_
#define GRAPHICSIDS_H_
const int BMP_TITLE = 103;
const int BMP_KEENSWATCH = 97;
// Menu Labels
const int BMP_MAINMENULABEL = 82;
const int BMP_NEWGAMELABEL = 83;
const int BMP_LOADMENULABEL = 84;
const int BMP_SAVEMENULABEL = 85;
const int BMP_CONFIGMENULABEL = 86;
const int BMP_SNDEFFMENULABEL = 87;
const int BMP_MUSICMENULABEL = 88;
const int BMP_KEYBMENULABEL = 89;
const int BMP_MOVEMENULABEL = 90;
const int BMP_BUTTONMENULABEL = 91;
const int BMP_JOYMENULABEL = 92;
const int BMP_OPTIONSMENULABEL = 93;
const int BMP_PADDLELABEL = 94;
const int BMP_QUITLABEL = 95;
#endif /* GRAPHICSIDS_H_ */
......@@ -49,7 +49,7 @@ void CPlayerWM::process()
*/
void CPlayerWM::processWalking()
{
size_t movespeed = 100;
size_t movespeed = 50;
bool walking=false;
// Normal walking
......
......@@ -67,7 +67,7 @@ bool CEGAGraphicsVort::loadData( int version, unsigned char *p_exedata )
g_pGfxEngine->freeTilemap();
// Set the palette, so the proper colours are loaded
g_pGfxEngine->Palette.setupColorPalettes();
g_pGfxEngine->Palette.setupColorPalettes(p_exedata, m_episode);
if(m_path == "")
buf = "egahead.ck" + itoa(m_episode);
......
......@@ -114,6 +114,7 @@ bool CPlayGameVorticon::loadGameState()
m_SavedGame.decodeData(object->inhibitfall);
m_SavedGame.decodeData(object->honorPriority);
m_SavedGame.decodeData(object->sprite);
object->setupinitialCollisions();
if(object->m_type == OBJ_DOOR or
object->m_type == OBJ_RAY or
......
......@@ -202,7 +202,7 @@ void CPlayGameVorticon::process()
// If the menu is open process it!
if(mp_Menu)
{
if( mp_Menu->mustBeClosed() || mp_Menu->getExitEvent() ||
if( mp_Menu->mustClose() || mp_Menu->getExitEvent() ||
mp_Menu->mustEndGame() || mp_Menu->mustStartGame() )
{
if( mp_Menu->getExitEvent() )
......
......@@ -93,7 +93,10 @@ bool CPatcher::readIntValue(const std::string &input, long &output)
}
// Try to read a decimal number
if((output = atoi(input)) != 0)
if( (output = atoi(input)) != 0)
return true;
if(input == "00" || input == "0")
return true;
return false;
......
......@@ -23,27 +23,87 @@ CPalette::~CPalette() {
// TODO Auto-generated destructor stub
}
void CPalette::setupColorPalettes()
/**
* This function checks whether the palette is patched or not.
* It has to look for a certain binary code, to know that...
*/
bool CPalette::patchedPalette(byte *p_exedata, int m_episode)
{
// go to the offset where we check the patched code
if(m_episode == 1)
p_exedata += 0x441C;
else if(m_episode == 2)
p_exedata += 0x157D;
else if(m_episode == 3)
p_exedata += 0x153B;
const byte palette_patch_array[] =
{ 0xB8, 0x0D, 0x00, 0xCD,
0x10, 0xB8, 0x12, 0x10, 0xB9, 0x08, 0x00, 0xBB,
0x00, 0x00, 0x8C, 0xDA, 0x8E, 0xC2, 0xBA, 0x04,
0x00, 0xCD, 0x10, 0xBB, 0x18, 0x00, 0xBA, 0x1C,
0x00, 0xCD, 0x10, 0xC3 };
return (memcmp( palette_patch_array, p_exedata, 32 ) == 0);
}
/**
* Reads the patched code and sets it up...
*/
void CPalette::setupPatchedPalette(byte *p_exedata, int m_episode)
{
setPaletteColour( 0, 0x00, 0x00, 0x00);
setPaletteColour( 1, 0x00, 0x00, 0xa8);
setPaletteColour( 2, 0x00, 0xa8, 0x00);
setPaletteColour( 3, 0x00, 0xa8, 0xa8);
setPaletteColour( 4, 0xa8, 0x00, 0x00);
setPaletteColour( 5, 0xa8, 0x00, 0xa8);
setPaletteColour( 6, 0xa8, 0x54, 0x00);
setPaletteColour( 7, 0xa8, 0xa8, 0xa8);
setPaletteColour( 8, 0x54, 0x54, 0x54);
setPaletteColour( 9, 0x54, 0x54, 0xfc);
setPaletteColour(10, 0x54, 0xfc, 0x54);
setPaletteColour(11, 0x54, 0xfc, 0xfc);
setPaletteColour(12, 0xfc, 0x54, 0x54);
setPaletteColour(13, 0xfc, 0x54, 0xfc);
setPaletteColour(14, 0xfc, 0xfc, 0x54);
setPaletteColour(15, 0xfc, 0xfc, 0xfc);
if(m_episode == 1)
p_exedata += 0x13054;
else if(m_episode == 2)
p_exedata += 0x17784;
else if(m_episode == 3)
p_exedata += 0x19824;
for( size_t i=0 ; i<16 ; i++ )
{
Uint8 r, g, b;
r = 4*(*p_exedata);
p_exedata++;
g = 4*(*p_exedata);
p_exedata++;
b = 4*(*p_exedata);
p_exedata++;
setPaletteColour( i, r, g, b);
}
setPaletteColour(16, 0x00, 0xff, 0xff);
}
void CPalette::setupColorPalettes(byte *p_exedata, int m_episode)
{
// TODO: Try to add patching code for palette patches of mods here!
// TODO: Here it will check, if the exe was patched with that code.
if(patchedPalette(p_exedata, m_episode))
{
setupPatchedPalette(p_exedata, m_episode);
}
else
{ // Default Palette
setPaletteColour( 0, 0x00, 0x00, 0x00);
setPaletteColour( 1, 0x00, 0x00, 0xa8);
setPaletteColour( 2, 0x00, 0xa8, 0x00);
setPaletteColour( 3, 0x00, 0xa8, 0xa8);
setPaletteColour( 4, 0xa8, 0x00, 0x00);
setPaletteColour( 5, 0xa8, 0x00, 0xa8);