Ordering info option has been added. This only works with Ep. 1
git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@209 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "fileio/CPatcher.h"
|
||||
#include "sdl/sound/CSound.h"
|
||||
#include "sdl/CVideoDriver.h"
|
||||
#include "vorticon/COrderingInfo.h"
|
||||
|
||||
CGame::CGame() {
|
||||
m_Episode = 0;
|
||||
@@ -161,7 +162,14 @@ short CGame::runCycle(stCloneKeenPlus *pCKP)
|
||||
pCredit = new CCredits;
|
||||
pCredit->Render(pCKP);
|
||||
delete pCredit;
|
||||
pCredit = NULL;
|
||||
break;
|
||||
|
||||
case MAINMNU_ORDERING_INFO:
|
||||
COrderingInfo *OrderingInfo;
|
||||
OrderingInfo = new COrderingInfo(pCKP->Control.levelcontrol.episode,
|
||||
pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
|
||||
OrderingInfo->Render(pCKP);
|
||||
delete OrderingInfo;
|
||||
break;
|
||||
|
||||
case MAINMNU_TIMEOUT:
|
||||
|
||||
27
src/keen.h
27
src/keen.h
@@ -766,19 +766,20 @@ typedef struct stShipQueue
|
||||
#define BONUSLEVEL_RESPAWN_X 31812
|
||||
#define BONUSLEVEL_RESPAWN_Y 18936
|
||||
|
||||
#define MAINMNU_1PLAYER 0
|
||||
#define MAINMNU_2PLAYER 1
|
||||
#define MAINMNU_LOADGAME 2
|
||||
#define MAINMNU_STORY 3
|
||||
#define MAINMNU_HIGHSCORES 4
|
||||
#define MAINMNU_OPTIONS 5
|
||||
#define MAINMNU_DEMO 6
|
||||
#define MAINMNU_NEW_GAME 7
|
||||
#define MAINMNU_ABOUT 8
|
||||
#define MAINMNU_QUIT 9
|
||||
#define MAINMNU_TIMEOUT 11 // going to demo due to timeout
|
||||
#define RESTART_GAME 12
|
||||
#define BACK2MAINMENU 13
|
||||
#define MAINMNU_1PLAYER 0
|
||||
#define MAINMNU_2PLAYER 1
|
||||
#define MAINMNU_LOADGAME 2
|
||||
#define MAINMNU_STORY 3
|
||||
#define MAINMNU_HIGHSCORES 4
|
||||
#define MAINMNU_OPTIONS 5
|
||||
#define MAINMNU_DEMO 6
|
||||
#define MAINMNU_NEW_GAME 7
|
||||
#define MAINMNU_ABOUT 8
|
||||
#define MAINMNU_ORDERING_INFO 9
|
||||
#define MAINMNU_QUIT 10
|
||||
#define MAINMNU_TIMEOUT 11 // going to demo due to timeout
|
||||
#define RESTART_GAME 12
|
||||
#define BACK2MAINMENU 13
|
||||
|
||||
#define MAINMENU_NUM_OPTIONS MAINMNU_QUIT
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
|
||||
// Prepare the Games Menu
|
||||
MainMenu = new CDialog();
|
||||
|
||||
MainMenu->setDimensions(11,8,18,12);
|
||||
MainMenu->setDimensions(11,7,18,13);
|
||||
|
||||
// Load the Title Bitmap
|
||||
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
||||
@@ -254,6 +254,7 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
|
||||
MainMenu->addOptionText("Demo");
|
||||
MainMenu->addOptionText("Change Game");
|
||||
MainMenu->addOptionText("About CG");
|
||||
MainMenu->addOptionText("Ordering Info");
|
||||
MainMenu->addOptionText("Quit");
|
||||
|
||||
x = (320/2)-(bitmaps[bmnum].xsize/2);
|
||||
|
||||
141
src/vorticon/COrderingInfo.cpp
Normal file
141
src/vorticon/COrderingInfo.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* COrderingInfo.cpp
|
||||
*
|
||||
* Created on: 04.08.2009
|
||||
* Author: gerstrong
|
||||
*/
|
||||
|
||||
#include "../keen.h"
|
||||
#include "COrderingInfo.h"
|
||||
#include "../sdl/CTimer.h"
|
||||
#include "../sdl/CInput.h"
|
||||
#include "../CGraphics.h"
|
||||
#include "../CLogFile.h"
|
||||
#include "../include/menu.h"
|
||||
#include "../include/gamedo.h"
|
||||
#include "../fileio/CExeFile.h"
|
||||
|
||||
COrderingInfo::COrderingInfo(int episode, std::string& datadirectory) {
|
||||
CExeFile *Exefile = new CExeFile(episode, datadirectory);
|
||||
|
||||
// load the exe file
|
||||
Exefile->readData();
|
||||
|
||||
// Get the offset where in the data the info is...
|
||||
size_t offset = 0;
|
||||
switch(episode)
|
||||
{
|
||||
case 1:
|
||||
m_starty = 4; // start of y-coordinate in textheights
|
||||
m_numberoflines = 21; // numberof lines to print
|
||||
if(Exefile->getEXEVersion() == 131)
|
||||
offset = 0x1632C;
|
||||
break;
|
||||
}
|
||||
|
||||
// Read the strings and save them the string array of the class
|
||||
if(offset)
|
||||
{
|
||||
char *data;
|
||||
data = (char*)Exefile->getData() + offset;
|
||||
std::string buf;
|
||||
for(int i=0 ; i<m_numberoflines ; i++)
|
||||
{
|
||||
if(*data == '\0')
|
||||
{
|
||||
data++;
|
||||
while(*data == ' ')
|
||||
data++;
|
||||
}
|
||||
while(*data != '\n') // For the next line
|
||||
{
|
||||
buf.push_back(*data);
|
||||
data++;
|
||||
}
|
||||
data++;
|
||||
m_Textline.push_back(buf);
|
||||
|
||||
buf.clear();
|
||||
}
|
||||
|
||||
// That part is a bit tricky. The Episodes have different X-Coordinates for evry text to center it properly
|
||||
if(episode == 1)
|
||||
{
|
||||
m_Text_Coordinate.push_back( 8*8 ); // Coordinate-x to get the lines centered, like in the original game.
|
||||
m_Text_Coordinate.push_back( 8*8 ); // Coordinate-x to get the lines centered, like in the original game.
|
||||
m_Text_Coordinate.push_back( 11*8 ); // Coordinate-x to get the lines centered, like in the original game.
|
||||
m_Text_Coordinate.push_back( 10*8 ); // Coordinate-x to get the lines centered, like in the original game.
|
||||
for(int i=0; i<3 ; i++ )
|
||||
m_Text_Coordinate.push_back( 8*8 ); // Coordinate-x to get the lines centered, like in the original game.
|
||||
for(int i=0; i<6 ; i++ )
|
||||
m_Text_Coordinate.push_back( 1*8 );
|
||||
m_Text_Coordinate.push_back( 23*8 );
|
||||
for(int i=0; i<6 ; i++ )
|
||||
m_Text_Coordinate.push_back( 0*8 ); // Coordinate-x to get the lines centered, like in the original game.
|
||||
m_Text_Coordinate.push_back( 3*8 ); // Coordinate-x to get the lines centered, like in the original game.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
delete Exefile;
|
||||
}
|
||||
|
||||
COrderingInfo::~COrderingInfo() {
|
||||
// TODO Auto-generated destructor stub
|
||||
}
|
||||
|
||||
void COrderingInfo::Render(stCloneKeenPlus *pCKP)
|
||||
{
|
||||
bool cancel = false;
|
||||
|
||||
if(!m_Textline.size())
|
||||
{
|
||||
g_pLogFile->textOut(RED,"Sorry, but the ordering information text could not be read. Returning to the main menu...<br>");
|
||||
return;
|
||||
}
|
||||
|
||||
fade.mode = FADE_GO;
|
||||
fade.rate = FADE_NORM;
|
||||
fade.dir = FADE_IN;
|
||||
fade.curamt = 0;
|
||||
fade.fadetimer = 0;
|
||||
|
||||
showmapatpos(90, 22<<4, 32, 0, pCKP);
|
||||
|
||||
do
|
||||
{
|
||||
// do fades
|
||||
gamedo_fades();
|
||||
|
||||
// blit the scrollbuffer to the display
|
||||
gamedo_frameskipping_blitonly();
|
||||
|
||||
gamedo_AnimatedTiles();
|
||||
|
||||
if(fade.mode != FADE_COMPLETE)
|
||||
continue;
|
||||
|
||||
for(int i=0 ; i<m_numberoflines ; i++)
|
||||
{
|
||||
g_pGraphics->drawFont(m_Textline[i], m_Text_Coordinate[i], 8*(i+m_starty), true);
|
||||
}
|
||||
|
||||
if( g_pInput->getPressedAnyCommand() )
|
||||
{
|
||||
cancel = true;
|
||||
fade.dir = FADE_OUT;
|
||||
fade.curamt = PAL_FADE_SHADES;
|
||||
fade.fadetimer = 0;
|
||||
fade.rate = FADE_NORM;
|
||||
fade.mode = FADE_GO;
|
||||
}
|
||||
|
||||
if(g_pInput->getExitEvent()) cancel=true;
|
||||
|
||||
g_pInput->pollEvents();
|
||||
g_pTimer->SpeedThrottle();
|
||||
|
||||
} while(!(cancel && fade.mode == FADE_COMPLETE));
|
||||
|
||||
|
||||
}
|
||||
29
src/vorticon/COrderingInfo.h
Normal file
29
src/vorticon/COrderingInfo.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* COrderingInfo.h
|
||||
*
|
||||
* Created on: 04.08.2009
|
||||
* Author: gerstrong
|
||||
*/
|
||||
|
||||
#ifndef CORDERINGINFO_H_
|
||||
#define CORDERINGINFO_H_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class COrderingInfo {
|
||||
public:
|
||||
COrderingInfo(int episode, std::string& datadirectory);
|
||||
virtual ~COrderingInfo();
|
||||
|
||||
void Render(stCloneKeenPlus *pCKP);
|
||||
|
||||
private:
|
||||
std::vector<int> m_Text_Coordinate;
|
||||
std::vector<std::string> m_Textline;
|
||||
|
||||
int m_starty; // start of y-coordinate in textheights
|
||||
int m_numberoflines; // number of lines to print
|
||||
};
|
||||
|
||||
#endif /* CORDERINGINFO_H_ */
|
||||
Reference in New Issue
Block a user