Commit 667faa4c authored by Tim Wegener's avatar Tim Wegener

Add support for keen 6 demo

parent 1bc618f4
......@@ -171,8 +171,10 @@ bool CGameLauncher::setupMenu()
mpEpisodeText = new CGUIText("Game");
mpVersionText = new CGUIText("Version");
mLauncherDialog.addControl(mpEpisodeText, GsRect<float>(0.5f, 0.75f, 0.5f, 0.05f));
mLauncherDialog.addControl(mpVersionText, GsRect<float>(0.5f, 0.80f, 0.5f, 0.05f));
mpDemoText = new CGUIText("Demo");
mLauncherDialog.addControl(mpEpisodeText, GsRect<float>(0.5f, 0.70f, 0.5f, 0.05f));
mLauncherDialog.addControl(mpVersionText, GsRect<float>(0.5f, 0.75f, 0.5f, 0.05f));
mLauncherDialog.addControl(mpDemoText, GsRect<float>(0.5f, 0.80f, 0.5f, 0.05f));
// This way it goes right to the selection list.
mLauncherDialog.setSelection(2);
......@@ -339,6 +341,7 @@ bool CGameLauncher::scanExecutables(const std::string& path)
newentry.version = executable.getEXEVersion();
newentry.supported = executable.Supported();
newentry.episode = i;
newentry.demo = executable.isDemo();
newentry.path = path;
newentry.exefilename = executable.getFileName();
// Check for an existing custom label for the menu
......@@ -647,12 +650,15 @@ void CGameLauncher::ponderGameSelDialog(const float deltaT)
if(mSelection != mpGameSelecList->getSelection())
{
mSelection = mpGameSelecList->getSelection();
const std::string nameText = "Episode " + itoa(m_Entries[mSelection].episode);
auto &entry = m_Entries[mSelection];
const std::string nameText = "Episode " + itoa(entry.episode);
mpEpisodeText->setText(nameText);
float fVer = m_Entries[mSelection].version;
float fVer = entry.version;
fVer /= 100.0f;
mpVersionText->setText("Version: " + ftoa(fVer));
mpDemoText->setText(entry.demo ? "Demo" : "");
// Now update the bitmap
mCurrentBmp->setBitmapPtr(mpPrevievBmpVec[mSelection]);
}
......
......@@ -46,11 +46,13 @@ struct GameEntry
short version;
bool supported;
Uint16 episode;
bool demo;
bool crcpass;
GameEntry() : version(0),
supported(false),
episode(0),
demo(false),
crcpass(false) {}
};
......@@ -159,7 +161,8 @@ private:
std::shared_ptr<CGUIBitmap> mCurrentBmp;
std::vector< std::shared_ptr<GsBitmap> > mpPrevievBmpVec;
CGUIText *mpEpisodeText;
CGUIText *mpVersionText;
CGUIText *mpDemoText;
CGUIText *mpVersionText;
CGUITextSelectionList *mpGSSelList;
......
......@@ -94,6 +94,9 @@ std::string CBehaviorEngine::getString(const std::string& name)
size_t CBehaviorEngine::getEpisode()
{ return mEpisode; }
bool CBehaviorEngine::isDemo()
{ return mDemo; }
EngineType CBehaviorEngine::getEngine()
{
if( mEpisode >= 4 && mEpisode <= 6 )
......
......@@ -92,6 +92,7 @@ public:
// This function evaluates if the used engine is galaxy or vorticon
EngineType getEngine();
size_t getEpisode();
bool isDemo();
stTeleporterTable& getTeleporterTableAt(size_t num)
{ return m_TeleporterTable[num]; }
std::vector<stTeleporterTable>& getTeleporterTable()
......@@ -103,6 +104,9 @@ public:
void setEpisode(const size_t Episode)
{ mEpisode = Episode; }
void setDemo(bool demo)
{ mDemo = demo; }
void setPause(const bool value)
{ mPausedGamePlay = value; }
......@@ -115,8 +119,8 @@ public:
int mPlayers = 1;
Difficulty mDifficulty = EASY;
EpisodeInfoStruct* getEpisodeInfoStructRef(const unsigned int episode)
{ return &pEpisodeInfo[episode-4]; }
EpisodeInfoStruct* getEpisodeInfoStructRef()
{ return &pEpisodeInfo[mDemo ? 4 : mEpisode - 4]; }
void setEpisodeInfoStructPtr(const EpisodeInfoStruct* epStruct)
{ pEpisodeInfo = const_cast<EpisodeInfoStruct*>(epStruct); }
......@@ -135,6 +139,7 @@ private:
// used by Episode 1 especially
int numStrings;
size_t mEpisode;
bool mDemo;
bool mPausedGamePlay = false;
......
......@@ -16,11 +16,12 @@
#include <cstring>
CMessages::CMessages(unsigned char *p_exebuf, char episode, int version) :
CMessages::CMessages(unsigned char *p_exebuf, char episode, bool demo, int version) :
mp_exe(p_exebuf),
mOffset(0)
{
m_episode = episode;
m_demo = demo;
m_version = version;
}
......@@ -276,6 +277,56 @@ bool CMessages::extractEp6Strings(std::map<std::string, std::string>& StringMap)
return false;
}
bool CMessages::extractEp6DemoStrings(std::map<std::string, std::string>& StringMap)
{
switch(m_version)
{
case 100:
{
// Level loading Texts
StringMap.insert( extractStringOff( "LEVEL0_LOAD_TEXT", 0x1B3B0 ) );
StringMap.insert( extractStringOff( "LEVEL1_LOAD_TEXT", 0x1B3D0 ) );
StringMap.insert( extractStringOff( "LEVEL2_LOAD_TEXT", 0x1B400 ) );
StringMap.insert( extractStringOff( "LEVEL3_LOAD_TEXT", 0x1B446 ) );
StringMap.insert( extractStringOff( "LEVEL4_LOAD_TEXT", 0x1B460 ) );
StringMap.insert( extractStringOff( "LEVEL5_LOAD_TEXT", 0x1B490 ) );
StringMap.insert( extractStringOff( "LEVEL6_LOAD_TEXT", 0x1B4C0 ) );
StringMap.insert( extractStringOff( "LEVEL7_LOAD_TEXT", 0x1B4F0 ) );
StringMap.insert( extractStringOff( "LEVEL8_LOAD_TEXT", 0x1B510 ) );
StringMap.insert( extractStringOff( "LEVEL9_LOAD_TEXT", 0x1B540 ) );
StringMap.insert( extractStringOff( "LEVEL10_LOAD_TEXT", 0x1B570 ) );
StringMap.insert( extractStringOff( "LEVEL11_LOAD_TEXT", 0x1B5A0 ) );
StringMap.insert( extractStringOff( "LEVEL12_LOAD_TEXT", 0x1B5F0 ) );
StringMap.insert( extractStringOff( "LEVEL13_LOAD_TEXT", 0x1B620 ) );
StringMap.insert( extractStringOff( "LEVEL14_LOAD_TEXT", 0x1B660 ) );
StringMap.insert( extractStringOff( "LEVEL15_LOAD_TEXT", 0x1B6A0 ) );
StringMap.insert( extractStringOff( "LEVEL16_LOAD_TEXT", 0x1B6E0 ) );
StringMap.insert( extractStringOff( "LEVEL17_LOAD_TEXT", 0x1B710 ) );
StringMap.insert( extractStringOff( "LEVEL18_LOAD_TEXT", 0x1B740 ) );
// Got Item Text.
setDecodeOffset(0x325B6);
StringMap.insert( extractNextString( "KEEN_GOT_SANDWICH" ) );
StringMap.insert( extractNextString( "KEEN_GOT_GRAPPLING_HOOK" ) );
StringMap.insert( extractNextString( "KEEN_GOT_SHIPCARD" ) );
// Grabbiter Text
setDecodeOffset(0x2C49A);
// StringMap.insert( extractNextString( "KEEN_GRABBITER_HUNGRY" ) );
// StringMap.insert( extractNextString( "KEEN_GRABBITER_SLEEPY" ) );
// StringMap.insert( extractNextString( "KEEN_KEYCARD_REQUIRED" ) );
StringMap.insert( extractNextString( "KEEN_ROPE_REQUIRED" ) );
setDecodeOffset(0x1AFF0);
StringMap.insert( extractNextString( "STORY_TEXT" ) );
return true;
} break;
}
return false;
}
bool CMessages::extractGlobalStrings()
{
std::map<std::string, std::string> StringMap; // Structure which stores all the extracted string
......@@ -396,7 +447,8 @@ bool CMessages::extractGlobalStrings()
case 6:
{
if(!extractEp6Strings(StringMap))
if(!(m_demo ? extractEp6DemoStrings(StringMap) :
extractEp6Strings(StringMap)))
gLogging.textOut(FONTCOLORS::RED,"This version of the game is not supported!");
} break;
......
......@@ -13,7 +13,7 @@
class CMessages {
public:
CMessages(unsigned char *p_exebuf, char episode, int version);
CMessages(unsigned char *p_exebuf, char episode, bool demo, int version);
bool extractGlobalStrings();
......@@ -35,9 +35,11 @@ private:
bool extractEp4Strings(std::map<std::string, std::string>& StringMap);
bool extractEp5Strings(std::map<std::string, std::string>& stringMap);
bool extractEp6Strings(std::map<std::string, std::string>& StringMap);
bool extractEp6DemoStrings(std::map<std::string, std::string>& StringMap);
unsigned char *mp_exe;
char m_episode;
bool m_demo;
int m_version;
unsigned int mOffset;
......
......@@ -575,7 +575,14 @@ void CSpriteObject::draw()
}
else
{
Sprite.drawSprite( showX, showY, w, h, (255-transluceny) );
if (w && h)
{
Sprite.drawSprite( showX, showY, w, h, (255-transluceny) );
}
else
{
gLogging.ftextOut("drawSprite problem w=%d h=%d mSprVar=%d mSpriteIdx=%d", w, h, mSprVar, mSpriteIdx);
}
}
hasbeenonscreen = true;
}
......
......@@ -51,6 +51,8 @@ void KeenEngine::start()
gBehaviorEngine.setEpisode(mEp);
gBehaviorEngine.setDemo(ExeFile.isDemo());
// Load the Resources
loadResources( LOADALL );
}
......
......@@ -47,7 +47,7 @@ void CLevelPlay::loadMap(const int level)
}
else if(episode == 6)
{
MapLoader.reset(new CMapLoaderGalaxyEp6(mObjectPtr, mInventoryVec));
MapLoader.reset(new CMapLoaderGalaxyEp6(mObjectPtr, mInventoryVec, gBehaviorEngine.isDemo()));
}
else
{
......
......@@ -326,7 +326,7 @@ bool CMapPlayGalaxy::operator<<(CSaveGameController &savedGame)
}
else if(episode == 6)
{
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp6( mObjectPtr, mInventoryVec) );
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp6( mObjectPtr, mInventoryVec, gBehaviorEngine.isDemo()) );
}
else
{
......@@ -516,7 +516,7 @@ void CMapPlayGalaxy::operator<<(boost::property_tree::ptree &levelNode)
}
else if(episode == 6)
{
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp6( mObjectPtr, mInventoryVec) );
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp6( mObjectPtr, mInventoryVec, gBehaviorEngine.isDemo() ) );
}
else
{
......
......@@ -57,8 +57,8 @@ mSkipSection(false)
mCreditsBmpID = 98;
else if(episode == 5)
mCreditsBmpID = 77;
else
mCreditsBmpID = 23;
else if(episode == 6)
mCreditsBmpID = gBehaviorEngine.isDemo() ? 18 : 23;
mCurrentLogoBmp = gGraphics.getBitmapFromId(mCreditsBmpID);
......
......@@ -193,7 +193,7 @@ bool GalaxyEngine::loadResources( const Uint8 flags )
if( (mFlags & LOADSTR) == LOADSTR )
{
// load the strings.
CMessages Messages(p_exedata, Episode, version);
CMessages Messages(p_exedata, Episode, ExeFile.isDemo(), version);
Messages.extractGlobalStrings();
mLoader.setPermilage(450);
}
......
......@@ -32,7 +32,7 @@ mClipped(false),
m_jumpdown(false),
mEndOfAction(false)
{
EpisodeInfoStruct* eiStructPtr = gBehaviorEngine.getEpisodeInfoStructRef(gBehaviorEngine.getEpisode());
EpisodeInfoStruct* eiStructPtr = gBehaviorEngine.getEpisodeInfoStructRef();
spriteOffset = eiStructPtr->IndexSprites;
}
......
......@@ -51,7 +51,7 @@ size_t CMapLoaderGalaxy::getMapheadOffset()
{
case 4: offset = 0x24830; break;
case 5: offset = 0x25990; break;
case 6: offset = 0x25080; break;
case 6: offset = gKeenFiles.exeFile.isDemo() ? 0x1F560 : 0x25080; break;
default: break;
}
......
......@@ -36,7 +36,7 @@ bool CWorldMap::init()
}
else if(gBehaviorEngine.getEpisode() == 6)
{
MapLoader.reset( new CMapLoaderGalaxyEp6( mObjectPtr, mInventoryVec) );
MapLoader.reset( new CMapLoaderGalaxyEp6( mObjectPtr, mInventoryVec, gBehaviorEngine.isDemo() ) );
}
const bool ok = MapLoader->loadMap( mMap, 0 );
......
......@@ -10,7 +10,12 @@
#include "sdl/audio/Audio.h"
size_t bulletActionMap[] =
{ 0x1738, 0x1502,0x153E };
{
0x1738,
0x1502,
0x153E,
0x15A4 // k6demo
};
namespace galaxy
{
......@@ -26,9 +31,9 @@ mReversed(false)
xDirection = xDir;
yDirection = yDir;
const size_t ep = gBehaviorEngine.getEpisode();
const size_t offsetIndex = gBehaviorEngine.isDemo() ? 3 : gBehaviorEngine.getEpisode() - 4;
setupGalaxyObjectOnMap(bulletActionMap[ep-4], A_KEENSHOT_MOVING);
setupGalaxyObjectOnMap(bulletActionMap[offsetIndex], A_KEENSHOT_MOVING);
setActionSprite();
calcBoundingBoxes();
playSound( SOUND_KEEN_FIRE );
......
......@@ -46,7 +46,7 @@ m_baseframe(0)
if(episode == 6)
{
setupGalaxyObjectOnMap(0x13F4, A_FLAG_FLIP);
setupGalaxyObjectOnMap(gBehaviorEngine.isDemo() ? 0x145A : 0x13F4, A_FLAG_FLIP);
}
else if(episode == 5)
{
......
......@@ -16,6 +16,7 @@
//#include <base/utils/CVec.h>
const Uint16 WAVING_BASEFRAME = 181;
const Uint16 WAVING_BASEFRAME_DEMO = 175;
namespace galaxy {
......
......@@ -987,7 +987,7 @@ bool CPlayerLevel::stun()
playSound(SOUND_KEEN_STUNNED);
mEndOfAction = false;
m_Action.setActionFormat(0x1868);
m_Action.setActionFormat(gBehaviorEngine.isDemo() ? 0x1862 : 0x1868);
mStunTimer = 0;
return true;
......
......@@ -61,7 +61,7 @@ mounted(false)
walkBaseFrame = mSpriteIdx;
wavingBaseFrame = walkBaseFrame + 22;
swimBaseFrame = walkBaseFrame + 24;
climbBaseFrame = walkBaseFrame + 37;
climbBaseFrame = walkBaseFrame + (gBehaviorEngine.isDemo() ? 26 : 37);
m_basesprite = walkBaseFrame;
performCollisions();
......@@ -351,7 +351,7 @@ void CPlayerWM::processMoving()
else
{
// Tell the player he cannot climb yet
showMsgWithBmp(gBehaviorEngine.getString("KEEN_ROPE_REQUIRED"), 29, RIGHT);
showMsgWithBmp(gBehaviorEngine.getString("KEEN_ROPE_REQUIRED"), "KEENTALKING", RIGHT);
moveYDir(-(climbDir<<CSF)/2);
}
}
......@@ -1083,7 +1083,7 @@ bool CPlayerWM::finishLevel(const int object)
Vector2D<Uint32> src(getXPosition(), getYPosition());
// Here we move the coordinates for the correction position of the done flag/sign
GsSprite &FlagSprite = gGraphics.getSprite(mSprVar, WAVING_BASEFRAME);
GsSprite &FlagSprite = gGraphics.getSprite(mSprVar, gBehaviorEngine.isDemo() ? WAVING_BASEFRAME_DEMO : WAVING_BASEFRAME);
unsigned int csfX = (x<<CSF);
unsigned int csfY = (y<<CSF);
......
......@@ -14,7 +14,7 @@ namespace galaxy {
CPlatform::CPlatform(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y) :
CGalaxySpriteObject(pmap, foeID, x, y, 0)
{
m_ActionBaseOffset = 0x316A;
m_ActionBaseOffset = gBehaviorEngine.isDemo() ? 0x1A98 : 0x316A;
}
void CPlatform::movePlatX(const int amnt)
......
......@@ -12,6 +12,7 @@
const int FIRE_CHANGE_TIME = 5;
const int FIRE_SPRITE = 363;
const int FIRE_SPRITE_DEMO = 314;
namespace galaxy
{
......@@ -22,9 +23,10 @@ CGalaxySpriteObject(pmap, foeID, x, y, sprVar),
CPlatform(pmap, foeID, x, y),
drawFire(false),
dimFire(false),
m_FireSprite(FIRE_SPRITE),
m_fireTimer(0)
{
m_FireSprite = gBehaviorEngine.isDemo() ? FIRE_SPRITE_DEMO : FIRE_SPRITE;
Vector2D<Uint32> pos = getPosition();
pos.y = (pos.y>>CSF); pos.x = (pos.x>>CSF);
......
......@@ -41,9 +41,12 @@ namespace galaxy
CMapLoaderGalaxyEp6::CMapLoaderGalaxyEp6(std::vector< std::shared_ptr<CGalaxySpriteObject> > &ObjectPtr,
std::vector<CInventory> &inventoryVec) :
std::vector<CInventory> &inventoryVec,
bool demo = false) :
CMapLoaderGalaxy(ObjectPtr, inventoryVec)
{}
{
m_demo = demo;
}
bool CMapLoaderGalaxyEp6::isKeenPlayer(const int foeID)
{
......@@ -119,7 +122,10 @@ CGalaxySpriteObject* CMapLoaderGalaxyEp6::addFoe(CMap &Map, word foe, size_t x,
// This is the player on the map in one level
inventory.Item.mLevelName = Map.getLevelName();
p_newfoe = new galaxy::CPlayerLevel(&Map, foe, x, y, m_ObjectPtr,
(foe==1) ? RIGHT : LEFT, inventory, 0x89A, mNumLoadedPlayers, mNumLoadedPlayers);
(foe==1) ? RIGHT : LEFT,
inventory,
m_demo ? 0x91E : 0x89A,
mNumLoadedPlayers, mNumLoadedPlayers);
}
mNumLoadedPlayers++;
break;
......@@ -132,7 +138,7 @@ CGalaxySpriteObject* CMapLoaderGalaxyEp6::addFoe(CMap &Map, word foe, size_t x,
// This is the player on the world map
// Add the Camera into the game scene and attach it to this player
inventory.Item.mLevelName = Map.getLevelName();
p_newfoe = new galaxy::CPlayerWM(&Map,foe, x, y, inventory, 0x13E0, mNumLoadedPlayers, mNumLoadedPlayers );
p_newfoe = new galaxy::CPlayerWM(&Map,foe, x, y, inventory, m_demo ? 0x1446 : 0x13E0, mNumLoadedPlayers, mNumLoadedPlayers );
}
mNumLoadedPlayers++;
break;
......@@ -146,10 +152,10 @@ CGalaxySpriteObject* CMapLoaderGalaxyEp6::addFoe(CMap &Map, word foe, size_t x,
// Blooglets
case 0x07: p_newfoe = new galaxy::CBlooglet(&Map, foe, 0x208A, false, x, y); break;
case 0x08: p_newfoe = new galaxy::CBlooglet(&Map, foe, 0x2120, false, x, y); break;
case 0x09: p_newfoe = new galaxy::CBlooglet(&Map, foe, 0x21B6, false, x, y); break;
case 0x0A: p_newfoe = new galaxy::CBlooglet(&Map, foe, 0x224C, false, x, y); break;
case 0x07: p_newfoe = new galaxy::CBlooglet(&Map, foe, m_demo ? 0x1D4A : 0x208A, false, x, y); break;
case 0x08: p_newfoe = new galaxy::CBlooglet(&Map, foe, m_demo ? 0x1DE0 : 0x2120, false, x, y); break;
case 0x09: p_newfoe = new galaxy::CBlooglet(&Map, foe, m_demo ? 0x1E76 : 0x21B6, false, x, y); break;
case 0x0A: p_newfoe = new galaxy::CBlooglet(&Map, foe, m_demo ? 0x1F0C : 0x224C, false, x, y); break;
// Blooglets carrying gems
case 0x0B: p_newfoe = new galaxy::CBlooglet(&Map, foe, 0x208A, true, x, y); break;
......@@ -168,41 +174,41 @@ CGalaxySpriteObject* CMapLoaderGalaxyEp6::addFoe(CMap &Map, word foe, size_t x,
case 0x1B:
p_newfoe = new galaxy::CPlatformVertical( &Map, foe, x, y, UP, 0x1DD8, 0 );
p_newfoe = new galaxy::CPlatformVertical( &Map, foe, x, y, UP, m_demo ? 0x1A98 : 0x1DD8, 0 );
break;
case 0x1C:
p_newfoe = new galaxy::CPlatformHorizontal( &Map, foe, RIGHT, x, y, 0x1DD8, 0 );
p_newfoe = new galaxy::CPlatformHorizontal( &Map, foe, RIGHT, x, y, m_demo ? 0x1A98 : 0x1DD8, 0 );
break;
case 0x1D:
p_newfoe = new galaxy::CPlatformVertical( &Map, foe, x, y, DOWN, 0x1DD8, 0 );
p_newfoe = new galaxy::CPlatformVertical( &Map, foe, x, y, DOWN, m_demo ? 0x1A98 : 0x1DD8, 0 );
break;
case 0x1E:
p_newfoe = new galaxy::CPlatformHorizontal( &Map, foe, LEFT, x, y, 0x1DD8, 0 );
p_newfoe = new galaxy::CPlatformHorizontal( &Map, foe, LEFT, x, y, m_demo ? 0x1A98 : 0x1DD8, 0 );
break;
case 0x20:
p_newfoe = new galaxy::CPlatformDrop( &Map, foe, x, y, 0x1E14, 0); break;
p_newfoe = new galaxy::CPlatformDrop( &Map, foe, x, y, m_demo ? 0x1A98 : 0x1E14, 0); break;
case 0x21: if (difficulty >= NORMAL) break;
case 0x22: if (difficulty >= HARD) break;
case 0x23:
p_newfoe = new galaxy::CPlatformSit( &Map, foe, x, y, 0x1E14, 0); break;
p_newfoe = new galaxy::CPlatformSit( &Map, foe, x, y, m_demo ? 0x1A98 : 0x1E14, 0); break;
// Var Plats red color
case 0x24:
p_newfoe = new galaxy::CVarPlatform( &Map, foe, x, y, CENTER, UP, 0x1E6E, 0); break;
p_newfoe = new galaxy::CVarPlatform( &Map, foe, x, y, CENTER, UP, m_demo ? 0x1A98 : 0x1E6E, 0); break;
case 0x25:
p_newfoe = new galaxy::CVarPlatform( &Map, foe, x, y, RIGHT, CENTER, 0x1E6E, 0); break;
p_newfoe = new galaxy::CVarPlatform( &Map, foe, x, y, RIGHT, CENTER, m_demo ? 0x1A98 : 0x1E6E, 0); break;
case 0x26:
p_newfoe = new galaxy::CVarPlatform( &Map, foe, x, y, CENTER, DOWN, 0x1E6E, 0); break;
p_newfoe = new galaxy::CVarPlatform( &Map, foe, x, y, CENTER, DOWN, m_demo ? 0x1A98 : 0x1E6E, 0); break;
case 0x27:
p_newfoe = new galaxy::CVarPlatform( &Map, foe, x, y, LEFT, CENTER, 0x1E6E, 0); break;
p_newfoe = new galaxy::CVarPlatform( &Map, foe, x, y, LEFT, CENTER, m_demo ? 0x1A98 : 0x1E6E, 0); break;
case 0x28:
p_newfoe = new galaxy::CPlatformMoveAway( &Map, foe, x, y, CENTER, LEFT, 0x1EC8, 0);
p_newfoe = new galaxy::CPlatformMoveAway( &Map, foe, x, y, CENTER, LEFT, m_demo ? 0x1A98 : 0x1EC8, 0);
break;
case 0x2B: if( difficulty < HARD ) break;
......
......@@ -17,11 +17,14 @@ class CMapLoaderGalaxyEp6 : public CMapLoaderGalaxy
{
public:
CMapLoaderGalaxyEp6(std::vector< std::shared_ptr<CGalaxySpriteObject> > &ObjectPtr,
std::vector<CInventory> &inventoryVec);
std::vector<CInventory> &inventoryVec,
bool demo);
bool isKeenPlayer(const int foeID);
CGalaxySpriteObject* addFoe(CMap &Map, word foe, size_t x, size_t y);
private:
bool m_demo;
};
}
......
......@@ -57,7 +57,7 @@ mGoodFireChance(false)
mActionMap[A_BABOBBA_STUNNED] = (GASOFctr) &CStunnable::processGettingStunned;
mActionMap[A_BABOBBA_NAPPING] = (GASOFctr) &CBabobba::processNapping;
setupGalaxyObjectOnMap(0x2F48, A_BABOBBA_JUMP);
setupGalaxyObjectOnMap(gBehaviorEngine.isDemo() ? 0x221E : 0x2F48, A_BABOBBA_JUMP);
xDirection = LEFT;
yinertia = MAX_JUMP_INERTIA;
......@@ -245,7 +245,7 @@ mTimer(0)
mActionMap[A_CINDER_LANDED] = (void (CGalaxyActionSpriteObject::*)()) &CCinder::processLanded;
mActionMap[A_CINDER_DYING] = (void (CGalaxyActionSpriteObject::*)()) &CCinder::processDying;
setupGalaxyObjectOnMap(0x30CE, A_CINDER_TOSSED);
setupGalaxyObjectOnMap(gBehaviorEngine.isDemo() ? 0x2368 : 0x30CE, A_CINDER_TOSSED);
yinertia = -60;
xDirection = horDir;
......
......@@ -53,7 +53,7 @@ mTimer(0)
mActionMap[A_BLOOG_WALK] = (GASOFctr) &CBloog::processWalking;
mActionMap[A_BLOOG_STUNNED] = (GASOFctr) &CStunnable::processGettingStunned;
setupGalaxyObjectOnMap(0x1EE6, A_BLOOG_WALK);
setupGalaxyObjectOnMap(gBehaviorEngine.isDemo() ? 0x1BA6 : 0x1EE6, A_BLOOG_WALK);
xDirection = LEFT;
......
......@@ -27,7 +27,7 @@ mStubPlayer(false)
mActionMap[A_BLOOGUARD_CLUBBING] = (GASOFctr) &CBlooguard::processClubbing;
mActionMap[A_BLOOGUARD_STUNNED] = (GASOFctr) &CStunnable::processGettingStunned;
setupGalaxyObjectOnMap(0x1F7C, A_BLOOGUARD_WALK);
setupGalaxyObjectOnMap(gBehaviorEngine.isDemo() ? 0x1C3C : 0x1F7C, A_BLOOGUARD_WALK);
xDirection = LEFT;
}
......
......@@ -30,7 +30,7 @@ mLaughed(false)
mActionMap[A_CEILICK_LICK] = (GASOFctr) &CCeilick::processLicking;
mActionMap[A_CEILICK_STUNNED] = (GASOFctr) &CStunnable::processGettingStunned;
setupGalaxyObjectOnMap(0x31BE, A_CEILICK_SLEEP);
setupGalaxyObjectOnMap(gBehaviorEngine.isDemo() ? 0x23FE : 0x31BE, A_CEILICK_SLEEP);
xDirection = LEFT;
solid = false;
......
......@@ -34,7 +34,7 @@ mpInteractPlayer(nullptr)
mActionMap[A_GIK_LAND] = (GASOFctr) &CGik::processLand;
mActionMap[A_GIK_SLIDE] = (GASOFctr) &CGik::processSlide;
setupGalaxyObjectOnMap(0x2604, A_GIK_WALK);
setupGalaxyObjectOnMap(gBehaviorEngine.isDemo() ? 0x2000 : 0x2604, A_GIK_WALK);
xDirection = LEFT;
}
......
......@@ -31,7 +31,7 @@ mTimer(0)
mActionMap[A_ROPE_ACTIVE] = (void (CGalaxyActionSpriteObject::*)()) &CRope::processActive;
mActionMap[A_ROPE_THROWN] = (void (CGalaxyActionSpriteObject::*)()) &CRope::processThrown;
setupGalaxyObjectOnMap(0x1C16, A_ROPE_THROWN);
setupGalaxyObjectOnMap(gBehaviorEngine.isDemo() ? 0x1A5C : 0x1C16, A_ROPE_THROWN);
solid=false;
}
......
......@@ -109,6 +109,46 @@ static EpisodeInfoStruct EpisodeInfo[] =
0, 0, /* NumMisc, IndexMisc */
0, 0, /* NumTexts, IndexTexts */
0, 0 /* NumDemos, IndexDemos */
},
{ /* Episode 6 (demo) */
// Size of datafile.dump.k6demo (exefile raw data)
0x37650, /* ExeImageSize */
// Offset in exefile raw data of 000000 chunk before contiguous
// run of chunk offsets. (Which should be preceded by two other
// 000000 "chunks".)
0x1c230, /* OffEgaHead k6demo */
// Look for fd 01 00 00 00 00, + 6 - 1024 to get start of egadict.
0x2fa40, /* OffEgaDict */
// Inspect egahead. This excludes last chunk which is offset to end of data file.
4365, /* NumChunks */
// Fonts has the same sizes as k4, so looks good.
3, 3, /* NumFonts, IndexFonts */
// Sum of NumBitmaps and IndexBitmaps should give IndexMasked Bitmaps.
// NumBitmaps should match outlen for i=0 (chunk 0).
32, 6, /* NumBitmaps, IndexBitmaps */
// Masked bitmaps starts with size=10920 (jump) like k4,
// so needs to have index of 38.
// The sizes match k4, so NumMaskedBitmaps looks good as is at 3.
// NumMaskedBitmaps should match outlen for i=1 (chunk 1).
3, 38, /* NumMaskedBitmaps, IndexMasked Bitmaps */
// The index is the sum of the previous num and index.
281, 41, /* NumSprites, IndexSprites */
// Index8Tiles is the sum of NumSprites and IndexSprites.
104, 322, /* Num8Tiles, Index8Tiles */
12, 323, /* Num8MaskedTiles, Index8MaskedTiles */
// 16Tiles have size of 128 or 0.
1296, 324, /* Num16Tiles, Index16Tiles */
// last 16 tile seems to be at 1616
// 16MaskedTiles have size of 160 or 0.
2736, 1620, /* Num16MaskedTiles, Index16MaskedTiles */
// Misc have size of ~4008-15044
// The index is the sum of NumTexts and IndexTexts.
4, 4357, /* NumMisc, IndexMisc */
// Texts have size of ~313-6884
1, 4356, /* NumTexts, IndexTexts */
// Demos have size ~66-194 and small first two words.
// NumChunks - 4 gives IndexDemos.
4, 4361 /* NumDemos, IndexDemos */
}
};
......@@ -122,7 +162,19 @@ m_Exefile(ExeFile)
gBehaviorEngine.setEpisodeInfoStructPtr(EpisodeInfo);
}
// Get the index for EpisodeInfo.
// 0 - keen4
// 1 - keen5
// 2 - keen6
// 3 - keen dreams
// 4 - keen6 demo
size_t CEGAGraphicsGalaxy::getEpisodeInfoIndex()
{
if (m_episode == 6 && m_Exefile.isDemo())
return 4;