reverted all src changes from rev95 commit (because all old work was just removed)
git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@107 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
CGame::CGame() {
|
CGame::CGame() {
|
||||||
m_Episode = 0;
|
m_Episode = 0;
|
||||||
memset(m_DataDirectory,0,256);
|
|
||||||
|
|
||||||
TileLoader = NULL;
|
TileLoader = NULL;
|
||||||
EGAGraphics = NULL;
|
EGAGraphics = NULL;
|
||||||
@@ -218,15 +217,13 @@ short CGame::runCycle(stCloneKeenPlus *pCKP)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGame::loadResources(unsigned short Episode, char *DataDirectory)
|
bool CGame::loadResources(unsigned short Episode, const std::string& DataDirectory)
|
||||||
{
|
{
|
||||||
m_Episode = Episode;
|
m_Episode = Episode;
|
||||||
memcpy(m_DataDirectory, DataDirectory, 256);
|
m_DataDirectory = DataDirectory;
|
||||||
|
|
||||||
int pos = strlen(DataDirectory)-1;
|
if( m_DataDirectory.size() > 0 && m_DataDirectory[m_DataDirectory.size()-1] != '/' )
|
||||||
if(pos == -1) pos =0;
|
m_DataDirectory += "/";
|
||||||
if( ( *(DataDirectory+pos) != '/' ) && strlen(DataDirectory) > 0)
|
|
||||||
strcat(DataDirectory,"/");
|
|
||||||
|
|
||||||
// Decode the entire graphics for the game (EGALATCH, EGASPRIT)
|
// Decode the entire graphics for the game (EGALATCH, EGASPRIT)
|
||||||
EGAGraphics = new CEGAGraphics(Episode, DataDirectory); // Path is relative to the data dir
|
EGAGraphics = new CEGAGraphics(Episode, DataDirectory); // Path is relative to the data dir
|
||||||
@@ -289,8 +286,6 @@ void CGame::preallocateCKP(stCloneKeenPlus *pCKP)
|
|||||||
pCKP->GameData = NULL;
|
pCKP->GameData = NULL;
|
||||||
pCKP->GameData = new stGameData[1];
|
pCKP->GameData = new stGameData[1];
|
||||||
|
|
||||||
memset(pCKP->GameData, 0, sizeof(stGameData));
|
|
||||||
|
|
||||||
framebyframe = 0;
|
framebyframe = 0;
|
||||||
|
|
||||||
demomode = DEMO_NODEMO;
|
demomode = DEMO_NODEMO;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#ifndef CGAME_H_
|
#ifndef CGAME_H_
|
||||||
#define CGAME_H_
|
#define CGAME_H_
|
||||||
|
|
||||||
#include <string.h>
|
#include <string>
|
||||||
#include "vorticon/CEGAGraphics.h"
|
#include "vorticon/CEGAGraphics.h"
|
||||||
#include "vorticon/CMessages.h"
|
#include "vorticon/CMessages.h"
|
||||||
|
|
||||||
@@ -17,15 +17,14 @@ public:
|
|||||||
CGame();
|
CGame();
|
||||||
virtual ~CGame();
|
virtual ~CGame();
|
||||||
|
|
||||||
bool loadResources(unsigned short Episode, char *DataDirectory);
|
bool loadResources(unsigned short Episode, const std::string& DataDirectory);
|
||||||
void freeResources(void);
|
void freeResources(void);
|
||||||
short runCycle(stCloneKeenPlus *pCKP);
|
short runCycle(stCloneKeenPlus *pCKP);
|
||||||
void preallocateCKP(stCloneKeenPlus *pCKP);
|
void preallocateCKP(stCloneKeenPlus *pCKP);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const unsigned short MAX_TEXT_LENGTH = 256;
|
|
||||||
unsigned short m_Episode;
|
unsigned short m_Episode;
|
||||||
char m_DataDirectory[MAX_TEXT_LENGTH];
|
std::string m_DataDirectory;
|
||||||
int current_demo;
|
int current_demo;
|
||||||
|
|
||||||
CEGAGraphics *EGAGraphics;
|
CEGAGraphics *EGAGraphics;
|
||||||
|
|||||||
@@ -10,12 +10,14 @@
|
|||||||
* not platform-specific).
|
* not platform-specific).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CGraphics.h"
|
|
||||||
#include "keen.h"
|
#include "keen.h"
|
||||||
|
#include "keenext.h"
|
||||||
|
#include "CGraphics.h"
|
||||||
#include "sdl/CVideoDriver.h"
|
#include "sdl/CVideoDriver.h"
|
||||||
#include "sdl/video/colourtable.h"
|
#include "sdl/video/colourtable.h"
|
||||||
#include "sdl/CVideoDriver.h"
|
#include "sdl/CVideoDriver.h"
|
||||||
#include "CLogFile.h"
|
#include "CLogFile.h"
|
||||||
|
#include "StringUtils.h"
|
||||||
|
|
||||||
CGraphics::CGraphics() {
|
CGraphics::CGraphics() {
|
||||||
HQBitmap = NULL;
|
HQBitmap = NULL;
|
||||||
@@ -591,13 +593,13 @@ int c;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// font drawing functions
|
// font drawing functions
|
||||||
void CGraphics::drawFont(unsigned char *text, int xoff, int yoff, int highlight)
|
void CGraphics::drawFont(const std::string& text, int xoff, int yoff, int highlight)
|
||||||
{
|
{
|
||||||
unsigned int i,x=xoff,y;
|
unsigned int i,x=xoff,y;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
y = yoff;
|
y = yoff;
|
||||||
for(i=0;i<strlen( (char*) text);i++)
|
for(i=0;i<text.size();i++)
|
||||||
{
|
{
|
||||||
c = text[i];
|
c = text[i];
|
||||||
if (!c) break;
|
if (!c) break;
|
||||||
@@ -614,15 +616,14 @@ int c;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void CGraphics::sb_font_draw(const unsigned char *text, int xoff, int yoff)
|
void CGraphics::sb_font_draw(const std::string& text, int xoff, int yoff)
|
||||||
{
|
{
|
||||||
unsigned int i,x,y;
|
unsigned int i,x,y;
|
||||||
|
|
||||||
x=xoff;
|
x=xoff;
|
||||||
y=yoff;
|
y=yoff;
|
||||||
for(i=0;i<strlen( (char*) text);i++)
|
for(i=0;i<text.size();i++)
|
||||||
{
|
{
|
||||||
if (!text[i]) break;
|
|
||||||
if (text[i]!=13)
|
if (text[i]!=13)
|
||||||
{
|
{
|
||||||
sb_drawCharacter(x, y, text[i]);
|
sb_drawCharacter(x, y, text[i]);
|
||||||
@@ -636,13 +637,13 @@ void CGraphics::sb_font_draw(const unsigned char *text, int xoff, int yoff)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraphics::sb_mask_font_draw(unsigned char *text, int xoff, int yoff, char mask)
|
void CGraphics::sb_mask_font_draw(const std::string& text, int xoff, int yoff, char mask)
|
||||||
{
|
{
|
||||||
unsigned int i,x,y;
|
unsigned int i,x,y;
|
||||||
|
|
||||||
x=xoff;
|
x=xoff;
|
||||||
y=yoff;
|
y=yoff;
|
||||||
for(i=0;i<strlen( (char*) text);i++)
|
for(i=0;i<text.size();i++)
|
||||||
{
|
{
|
||||||
if (text[i]!=13)
|
if (text[i]!=13)
|
||||||
{
|
{
|
||||||
@@ -658,15 +659,14 @@ unsigned int i,x,y;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CGraphics::sb_color_font_draw(unsigned char *text, int xoff, int yoff, unsigned int colour, unsigned short bgcolour)
|
void CGraphics::sb_color_font_draw(const std::string& text, int xoff, int yoff, unsigned int colour, unsigned short bgcolour)
|
||||||
{
|
{
|
||||||
unsigned int i,x,y;
|
unsigned int i,x,y;
|
||||||
|
|
||||||
x=xoff;
|
x=xoff;
|
||||||
y=yoff;
|
y=yoff;
|
||||||
for(i=0;i<strlen( (char*) text);i++)
|
for(i=0;i< text.size(); i++)
|
||||||
{
|
{
|
||||||
if (!text[i]) break;
|
|
||||||
if (text[i]!=13)
|
if (text[i]!=13)
|
||||||
{
|
{
|
||||||
sb_drawColorcharacter(x, y, text[i], colour, bgcolour);
|
sb_drawColorcharacter(x, y, text[i], colour, bgcolour);
|
||||||
@@ -680,14 +680,13 @@ unsigned int i,x,y;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraphics::sb_font_draw_inverse(unsigned char *text, int xoff, int yoff)
|
void CGraphics::sb_font_draw_inverse(const std::string& text, int xoff, int yoff)
|
||||||
{
|
{
|
||||||
unsigned int i,x=xoff,y;
|
unsigned int i,x=xoff,y;
|
||||||
|
|
||||||
y=yoff;
|
y=yoff;
|
||||||
for(i=0;i<strlen( (char*) text);i++)
|
for(i=0;i< text.size();i++)
|
||||||
{
|
{
|
||||||
if (!text[i]) break;
|
|
||||||
if (text[i]!=13)
|
if (text[i]!=13)
|
||||||
{
|
{
|
||||||
sb_drawCharacterinverse(x, y, text[i]);
|
sb_drawCharacterinverse(x, y, text[i]);
|
||||||
@@ -724,18 +723,12 @@ void CGraphics::renderHQBitmap()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraphics::loadHQGraphics(unsigned char episode, unsigned char level, char *datadir)
|
void CGraphics::loadHQGraphics(unsigned char episode, unsigned char level, const std::string& datadir)
|
||||||
{
|
{
|
||||||
char buf[256];
|
|
||||||
char buf2[256];
|
|
||||||
SDL_Rect screen_rect;
|
SDL_Rect screen_rect;
|
||||||
|
|
||||||
memset(buf,0,256);
|
std::string buf = formatPathString(datadir);
|
||||||
memset(buf2,0,256);
|
std::string buf2 = buf + "level" + itoa(level) + "ep" + itoa(episode) + ".bmp";
|
||||||
|
|
||||||
formatPathString(buf,datadir);
|
|
||||||
|
|
||||||
sprintf(buf2,"%slevel%dep%d.bmp",buf,level,episode);
|
|
||||||
|
|
||||||
screen_rect.x = 0;
|
screen_rect.x = 0;
|
||||||
screen_rect.y = 0;
|
screen_rect.y = 0;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "CSingleton.h"
|
#include "CSingleton.h"
|
||||||
#define g_pGraphics CGraphics::Get()
|
#define g_pGraphics CGraphics::Get()
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include "hqp/CHQBitmap.h"
|
#include "hqp/CHQBitmap.h"
|
||||||
|
|
||||||
@@ -44,18 +45,18 @@ public:
|
|||||||
void drawBitmap2FG(int xa, int ya, int b);
|
void drawBitmap2FG(int xa, int ya, int b);
|
||||||
int getBitmapNumberFromName(const char *bmname);
|
int getBitmapNumberFromName(const char *bmname);
|
||||||
void sb_drawCharacterinverse(int x, int y, int f);
|
void sb_drawCharacterinverse(int x, int y, int f);
|
||||||
void drawFont(unsigned char *text, int xoff, int yoff, int highlight);
|
void drawFont(const std::string& text, int xoff, int yoff, int highlight);
|
||||||
void sb_font_draw(const unsigned char *text, int xoff, int yoff);
|
void sb_font_draw(const std::string& text, int xoff, int yoff);
|
||||||
void sb_mask_font_draw(unsigned char *text, int xoff, int yoff, char mask);
|
void sb_mask_font_draw(const std::string& text, int xoff, int yoff, char mask);
|
||||||
void sb_color_font_draw(unsigned char *text, int xoff, int yoff, unsigned int colour, unsigned short bgcolour);
|
void sb_color_font_draw(const std::string& text, int xoff, int yoff, unsigned int colour, unsigned short bgcolour);
|
||||||
void sb_font_draw_inverse(unsigned char *text, int xoff, int yoff);
|
void sb_font_draw_inverse(const std::string& text, int xoff, int yoff);
|
||||||
void drawTile_direct(int x, int y, unsigned int t);
|
void drawTile_direct(int x, int y, unsigned int t);
|
||||||
void setFadeBlack(bool value);
|
void setFadeBlack(bool value);
|
||||||
|
|
||||||
Uint8 *getScrollbuffer(void);
|
Uint8 *getScrollbuffer(void);
|
||||||
|
|
||||||
void renderHQBitmap();
|
void renderHQBitmap();
|
||||||
void loadHQGraphics(unsigned char episode, unsigned char level, char *datadir);
|
void loadHQGraphics(unsigned char episode, unsigned char level, const std::string& datadir);
|
||||||
void unloadHQGraphics();
|
void unloadHQGraphics();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "fileio.h"
|
#include "fileio.h"
|
||||||
#include "keen.h"
|
#include "keen.h"
|
||||||
#include "keenext.h"
|
#include "keenext.h"
|
||||||
|
#include "StringUtils.h"
|
||||||
|
|
||||||
#include "CLogFile.h"
|
#include "CLogFile.h"
|
||||||
//#include "vorticon/CEGAGraphics.h"
|
//#include "vorticon/CEGAGraphics.h"
|
||||||
@@ -58,19 +59,15 @@ char CLatch::loadHeader(int episode, const char *path)
|
|||||||
FILE *headfile;
|
FILE *headfile;
|
||||||
unsigned long SpriteTableRAMSize;
|
unsigned long SpriteTableRAMSize;
|
||||||
unsigned long BitmapTableRAMSize;
|
unsigned long BitmapTableRAMSize;
|
||||||
char buf[12];
|
std::string buf;
|
||||||
int i,j,k;
|
int i,j,k;
|
||||||
char fname[80];
|
std::string fname;
|
||||||
char buffer[256];
|
std::string buffer;
|
||||||
|
|
||||||
memset(buffer,0,256);
|
buffer = formatPathString(path);
|
||||||
memset(fname,0,80);
|
buffer += "egahead.ck";
|
||||||
|
|
||||||
formatPathString(buffer,path);
|
fname = buffer + itoa(episode);
|
||||||
|
|
||||||
strcat(buffer,"egahead.ck");
|
|
||||||
|
|
||||||
sprintf(fname, "%s%d", buffer,episode);
|
|
||||||
|
|
||||||
/*CEGAGraphics *EGAGraphics;
|
/*CEGAGraphics *EGAGraphics;
|
||||||
|
|
||||||
@@ -80,14 +77,14 @@ char CLatch::loadHeader(int episode, const char *path)
|
|||||||
|
|
||||||
delete EGAGraphics;*/
|
delete EGAGraphics;*/
|
||||||
|
|
||||||
headfile = fopen(fname, "rb");
|
headfile = fopen(fname.c_str(), "rb");
|
||||||
if (!headfile)
|
if (!headfile)
|
||||||
{
|
{
|
||||||
g_pLogFile->ftextOut("latch_loadheader(): unable to open '%s'.<br>", fname);
|
g_pLogFile->ftextOut("latch_loadheader(): unable to open '%s'.<br>", fname.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pLogFile->ftextOut("latch_loadheader(): reading main header from '%s'...<br>", fname);
|
g_pLogFile->ftextOut("latch_loadheader(): reading main header from '%s'...<br>", fname.c_str());
|
||||||
|
|
||||||
// read the main header data from EGAHEAD
|
// read the main header data from EGAHEAD
|
||||||
LatchHeader.LatchPlaneSize = fgetl(headfile);
|
LatchHeader.LatchPlaneSize = fgetl(headfile);
|
||||||
@@ -135,7 +132,7 @@ char CLatch::loadHeader(int episode, const char *path)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pLogFile->ftextOut("latch_loadheader(): Reading sprite table from '%s'...<br>", fname);
|
g_pLogFile->ftextOut("latch_loadheader(): Reading sprite table from '%s'...<br>", fname.c_str());
|
||||||
|
|
||||||
fseek(headfile, LatchHeader.OffSpriteTable, SEEK_SET);
|
fseek(headfile, LatchHeader.OffSpriteTable, SEEK_SET);
|
||||||
for(i=0;i<LatchHeader.NumSprites;i++)
|
for(i=0;i<LatchHeader.NumSprites;i++)
|
||||||
@@ -172,7 +169,7 @@ char CLatch::loadHeader(int episode, const char *path)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pLogFile->ftextOut("latch_loadheader(): reading bitmap table from '%s'...<br>", fname);
|
g_pLogFile->ftextOut("latch_loadheader(): reading bitmap table from '%s'...<br>", fname.c_str());
|
||||||
|
|
||||||
fseek(headfile, LatchHeader.OffBitmapTable, SEEK_SET);
|
fseek(headfile, LatchHeader.OffBitmapTable, SEEK_SET);
|
||||||
|
|
||||||
@@ -191,7 +188,7 @@ char CLatch::loadHeader(int episode, const char *path)
|
|||||||
// print the bitmap info to the console for debug
|
// print the bitmap info to the console for debug
|
||||||
for(j=0;j<8;j++) buf[j] = BitmapTable[i].Name[j];
|
for(j=0;j<8;j++) buf[j] = BitmapTable[i].Name[j];
|
||||||
buf[j] = 0;
|
buf[j] = 0;
|
||||||
g_pLogFile->ftextOut(" Bitmap '%s': %dx%d at offset %04x. RAMAllocSize=0x%04x<br>", buf,BitmapTable[i].Width,BitmapTable[i].Height,BitmapTable[i].Offset,BitmapBufferRAMSize);
|
g_pLogFile->ftextOut(" Bitmap '%s': %dx%d at offset %04x. RAMAllocSize=0x%04x<br>", buf.c_str(),BitmapTable[i].Width,BitmapTable[i].Height,BitmapTable[i].Offset,BitmapBufferRAMSize);
|
||||||
}
|
}
|
||||||
BitmapBufferRAMSize++;
|
BitmapBufferRAMSize++;
|
||||||
|
|
||||||
@@ -206,26 +203,24 @@ char CLatch::load(int episode, const char *path)
|
|||||||
{
|
{
|
||||||
FILE *latchfile;
|
FILE *latchfile;
|
||||||
unsigned long plane1, plane2, plane3, plane4;
|
unsigned long plane1, plane2, plane3, plane4;
|
||||||
char fname[80];
|
std::string fname;
|
||||||
int x,y,t,b,c,p;
|
int x,y,t,b,c,p;
|
||||||
char *bmdataptr;
|
char *bmdataptr;
|
||||||
unsigned long RawDataSize;
|
unsigned long RawDataSize;
|
||||||
//unsigned char ch;
|
//unsigned char ch;
|
||||||
|
|
||||||
char buffer[256];
|
std::string buffer;
|
||||||
|
|
||||||
formatPathString(buffer,path);
|
buffer = formatPathString(path);
|
||||||
|
buffer += "egalatch.ck";
|
||||||
|
fname = buffer + itoa(episode);
|
||||||
|
|
||||||
strcat(buffer,"egalatch.ck");
|
g_pLogFile->ftextOut("latch_loadlatch(): Opening file '%s'.<br>", fname.c_str());
|
||||||
|
|
||||||
sprintf(fname, "%s%c", buffer,episode + '0');
|
latchfile = fopen(fname.c_str(), "rb");
|
||||||
|
|
||||||
g_pLogFile->ftextOut("latch_loadlatch(): Opening file '%s'.<br>", fname);
|
|
||||||
|
|
||||||
latchfile = fopen(fname, "rb");
|
|
||||||
if (!latchfile)
|
if (!latchfile)
|
||||||
{
|
{
|
||||||
g_pLogFile->ftextOut("latch_loadlatch(): Unable to open '%s'!<br>", fname);
|
g_pLogFile->ftextOut("latch_loadlatch(): Unable to open '%s'!<br>", fname.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,7 +261,7 @@ char buffer[256];
|
|||||||
plane4 = (LatchHeader.LatchPlaneSize * 3);
|
plane4 = (LatchHeader.LatchPlaneSize * 3);
|
||||||
|
|
||||||
// ** read the 8x8 tiles **
|
// ** read the 8x8 tiles **
|
||||||
g_pLogFile->ftextOut("latch_loadlatch(): Decoding 8x8 tiles...<br>", fname);
|
g_pLogFile->ftextOut("latch_loadlatch(): Decoding 8x8 tiles...<br>", fname.c_str());
|
||||||
|
|
||||||
// set up the getbit() function
|
// set up the getbit() function
|
||||||
|
|
||||||
@@ -309,7 +304,7 @@ char buffer[256];
|
|||||||
delete Planes;
|
delete Planes;
|
||||||
|
|
||||||
// ** read the 16x16 tiles **
|
// ** read the 16x16 tiles **
|
||||||
g_pLogFile->ftextOut("latch_loadlatch(): Decoding 16x16 tiles...<br>", fname);
|
g_pLogFile->ftextOut("latch_loadlatch(): Decoding 16x16 tiles...<br>", fname.c_str());
|
||||||
|
|
||||||
// set up the getbit() function
|
// set up the getbit() function
|
||||||
Planes = new CPlanes(plane1 + LatchHeader.Off16Tiles, \
|
Planes = new CPlanes(plane1 + LatchHeader.Off16Tiles, \
|
||||||
@@ -354,7 +349,7 @@ char buffer[256];
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pLogFile->ftextOut("latch_loadlatch(): Decoding bitmaps...<br>", fname);
|
g_pLogFile->ftextOut("latch_loadlatch(): Decoding bitmaps...<br>", fname.c_str());
|
||||||
|
|
||||||
// set up the getbit() function
|
// set up the getbit() function
|
||||||
Planes = new CPlanes(plane1 + LatchHeader.OffBitmaps, \
|
Planes = new CPlanes(plane1 + LatchHeader.OffBitmaps, \
|
||||||
@@ -419,24 +414,22 @@ char CLatch::loadSprites(int episode, const char *path)
|
|||||||
{
|
{
|
||||||
FILE *spritfile;
|
FILE *spritfile;
|
||||||
unsigned long plane1, plane2, plane3, plane4, plane5;
|
unsigned long plane1, plane2, plane3, plane4, plane5;
|
||||||
char fname[80];
|
std::string fname;
|
||||||
int x,y,s,c,p;
|
int x,y,s,c,p;
|
||||||
unsigned long RawDataSize;
|
unsigned long RawDataSize;
|
||||||
char buffer[256];
|
std::string buffer;
|
||||||
CPlanes *Planes;
|
CPlanes *Planes;
|
||||||
|
|
||||||
formatPathString(buffer,path);
|
buffer = formatPathString(path);
|
||||||
|
buffer += "egasprit.ck";
|
||||||
|
fname = buffer + itoa(episode);
|
||||||
|
|
||||||
strcat(buffer,"egasprit.ck");
|
g_pLogFile->ftextOut("latch_loadsprites(): Opening file '%s'.<br>", fname.c_str());
|
||||||
|
|
||||||
sprintf(fname, "%s%c", buffer,episode + '0');
|
spritfile = fopen(fname.c_str(), "rb");
|
||||||
|
|
||||||
g_pLogFile->ftextOut("latch_loadsprites(): Opening file '%s'.<br>", fname);
|
|
||||||
|
|
||||||
spritfile = fopen(fname, "rb");
|
|
||||||
if (!spritfile)
|
if (!spritfile)
|
||||||
{
|
{
|
||||||
g_pLogFile->ftextOut("latch_loadsprites(): Unable to open '%s'!<br>", fname);
|
g_pLogFile->ftextOut("latch_loadsprites(): Unable to open '%s'!<br>", fname.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,7 +468,7 @@ CPlanes *Planes;
|
|||||||
plane5 = (LatchHeader.SpritePlaneSize * 4);
|
plane5 = (LatchHeader.SpritePlaneSize * 4);
|
||||||
|
|
||||||
// ** read the sprites **
|
// ** read the sprites **
|
||||||
g_pLogFile->ftextOut("latch_loadsprites(): Decoding sprites...<br>", fname);
|
g_pLogFile->ftextOut("latch_loadsprites(): Decoding sprites...<br>", fname.c_str());
|
||||||
|
|
||||||
// set up the getbit() function
|
// set up the getbit() function
|
||||||
Planes = new CPlanes(plane1 + LatchHeader.OffSprites, \
|
Planes = new CPlanes(plane1 + LatchHeader.OffSprites, \
|
||||||
|
|||||||
885
src/eseq_ep1.cpp
885
src/eseq_ep1.cpp
@@ -1,442 +1,443 @@
|
|||||||
/* ESEQ_EP1.C
|
/* ESEQ_EP1.C
|
||||||
Ending sequence for Episode 1.
|
Ending sequence for Episode 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "keen.h"
|
#include "keen.h"
|
||||||
#include "include/game.h"
|
#include "include/game.h"
|
||||||
#include "include/gamedo.h"
|
#include "include/gamedo.h"
|
||||||
#include "include/gamepdo.h"
|
#include "include/gamepdo.h"
|
||||||
#include "sdl/CInput.h"
|
#include "sdl/CInput.h"
|
||||||
#include "sdl/CTimer.h"
|
#include "sdl/CTimer.h"
|
||||||
#include "include/eseq_ep1.h"
|
#include "include/eseq_ep1.h"
|
||||||
#include "include/eseq_ep2.h"
|
#include "include/eseq_ep2.h"
|
||||||
#include "include/menu.h"
|
#include "include/menu.h"
|
||||||
#include "CGraphics.h"
|
#include "CGraphics.h"
|
||||||
|
#include "StringUtils.h"
|
||||||
#define CMD_MOVE 0
|
|
||||||
#define CMD_WAIT 1
|
#define CMD_MOVE 0
|
||||||
#define CMD_SPAWNSPR 2
|
#define CMD_WAIT 1
|
||||||
#define CMD_REMOVESPR 3
|
#define CMD_SPAWNSPR 2
|
||||||
#define CMD_FADEOUT 4
|
#define CMD_REMOVESPR 3
|
||||||
#define CMD_ENDOFQUEUE 5
|
#define CMD_FADEOUT 4
|
||||||
#define CMD_ENABLESCROLLING 6
|
#define CMD_ENDOFQUEUE 5
|
||||||
#define CMD_DISABLESCROLLING 7
|
#define CMD_ENABLESCROLLING 6
|
||||||
|
#define CMD_DISABLESCROLLING 7
|
||||||
|
|
||||||
// start x,y map scroll position for eseq1_ShipFlys()
|
|
||||||
#define SHIPFLY_X 32
|
// start x,y map scroll position for eseq1_ShipFlys()
|
||||||
#define SHIPFLY_Y 0
|
#define SHIPFLY_X 32
|
||||||
|
#define SHIPFLY_Y 0
|
||||||
// worldmap scroll position for eseq1_ReturnsToShip()
|
|
||||||
#define WM_X 40
|
// worldmap scroll position for eseq1_ReturnsToShip()
|
||||||
#define WM_Y 540
|
#define WM_X 40
|
||||||
|
#define WM_Y 540
|
||||||
#define LETTER_SHOW_SPD 30
|
|
||||||
#define RETURNTOSHIP_WAIT_TIME 600
|
#define LETTER_SHOW_SPD 30
|
||||||
|
#define RETURNTOSHIP_WAIT_TIME 600
|
||||||
#define SPR_SHIP_RIGHT 115
|
|
||||||
#define SPR_SHIP_LEFT 116
|
#define SPR_SHIP_RIGHT 115
|
||||||
#define SPR_EXCLAMATION 117
|
#define SPR_SHIP_LEFT 116
|
||||||
#define SPR_QUESTION 118
|
#define SPR_EXCLAMATION 117
|
||||||
#define SHIPSPD 4
|
#define SPR_QUESTION 118
|
||||||
|
#define SHIPSPD 4
|
||||||
#define BACKHOME_SHORT_WAIT_TIME 250
|
|
||||||
|
#define BACKHOME_SHORT_WAIT_TIME 250
|
||||||
int eseq1_ReturnsToShip(stCloneKeenPlus *pCKP)
|
|
||||||
{
|
int eseq1_ReturnsToShip(stCloneKeenPlus *pCKP)
|
||||||
int i;
|
{
|
||||||
|
int i;
|
||||||
for(i=0;i<MAX_LEVELS;i++)
|
|
||||||
pCKP->Control.levelcontrol.levels_completed[i] = 0;
|
for(i=0;i<MAX_LEVELS;i++)
|
||||||
|
pCKP->Control.levelcontrol.levels_completed[i] = 0;
|
||||||
showmapatpos(80, WM_X, WM_Y, 0, pCKP);
|
|
||||||
|
showmapatpos(80, WM_X, WM_Y, 0, pCKP);
|
||||||
// draw keen next to his ship
|
|
||||||
g_pGraphics->drawSprite(168, 85, PMAPLEFTFRAME, 0);
|
// draw keen next to his ship
|
||||||
// do not show player when we render the screen
|
g_pGraphics->drawSprite(168, 85, PMAPLEFTFRAME, 0);
|
||||||
numplayers = 1;
|
// do not show player when we render the screen
|
||||||
player[0].x = 0;
|
numplayers = 1;
|
||||||
player[0].y = 0;
|
player[0].x = 0;
|
||||||
player[0].playframe = BlankSprite;
|
player[0].y = 0;
|
||||||
// all objects -> nonexistant
|
player[0].playframe = BlankSprite;
|
||||||
for(i=0;i<MAX_OBJECTS;i++) objects[i].exists = 0;
|
// all objects -> nonexistant
|
||||||
|
for(i=0;i<MAX_OBJECTS;i++) objects[i].exists = 0;
|
||||||
fade.mode = FADE_GO;
|
|
||||||
fade.dir = FADE_IN;
|
fade.mode = FADE_GO;
|
||||||
fade.curamt = 0;
|
fade.dir = FADE_IN;
|
||||||
fade.fadetimer = 0;
|
fade.curamt = 0;
|
||||||
fade.rate = FADE_NORM;
|
fade.fadetimer = 0;
|
||||||
|
fade.rate = FADE_NORM;
|
||||||
eseq_showmsg(getstring("EP1_ESEQ_PART1"),1,18,37,6,1, pCKP);
|
|
||||||
|
eseq_showmsg(getstring("EP1_ESEQ_PART1"),1,18,37,6,1, pCKP);
|
||||||
// fade out
|
|
||||||
fade.mode = FADE_GO;
|
// fade out
|
||||||
fade.dir = FADE_OUT;
|
fade.mode = FADE_GO;
|
||||||
fade.curamt = PAL_FADE_SHADES;
|
fade.dir = FADE_OUT;
|
||||||
fade.fadetimer = 0;
|
fade.curamt = PAL_FADE_SHADES;
|
||||||
fade.rate = FADE_NORM;
|
fade.fadetimer = 0;
|
||||||
do
|
fade.rate = FADE_NORM;
|
||||||
{
|
do
|
||||||
gamedo_fades();
|
{
|
||||||
gamedo_AnimatedTiles();
|
gamedo_fades();
|
||||||
|
gamedo_AnimatedTiles();
|
||||||
g_pInput->pollEvents();
|
|
||||||
g_pTimer->SpeedThrottle();
|
g_pInput->pollEvents();
|
||||||
} while(fade.mode != FADE_COMPLETE && !g_pInput->getPressedKey(KQUIT));
|
g_pTimer->SpeedThrottle();
|
||||||
|
} while(fade.mode != FADE_COMPLETE && !g_pInput->getPressedKey(KQUIT));
|
||||||
return 0;
|
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void addshipqueue(int cmd, int time, int flag1)
|
|
||||||
{
|
void addshipqueue(int cmd, int time, int flag1)
|
||||||
shipqueue[ShipQueuePtr].cmd = cmd;
|
{
|
||||||
shipqueue[ShipQueuePtr].time = time;
|
shipqueue[ShipQueuePtr].cmd = cmd;
|
||||||
shipqueue[ShipQueuePtr].flag1 = flag1;
|
shipqueue[ShipQueuePtr].time = time;
|
||||||
ShipQueuePtr++;
|
shipqueue[ShipQueuePtr].flag1 = flag1;
|
||||||
}
|
ShipQueuePtr++;
|
||||||
|
}
|
||||||
int eseq1_ShipFlys(stCloneKeenPlus *pCKP)
|
|
||||||
{
|
int eseq1_ShipFlys(stCloneKeenPlus *pCKP)
|
||||||
char enter,lastenterstate;
|
{
|
||||||
int x, y;
|
char enter,lastenterstate;
|
||||||
int scrollingon;
|
int x, y;
|
||||||
|
int scrollingon;
|
||||||
scrollingon = 1;
|
|
||||||
|
scrollingon = 1;
|
||||||
#define MARK_SPR_NUM 5
|
|
||||||
initgame(pCKP);
|
#define MARK_SPR_NUM 5
|
||||||
|
initgame(pCKP);
|
||||||
// set up the ship's route
|
|
||||||
ShipQueuePtr = 0;
|
// set up the ship's route
|
||||||
addshipqueue(CMD_MOVE, 230, DUP);
|
ShipQueuePtr = 0;
|
||||||
addshipqueue(CMD_WAIT, 50, 0);
|
addshipqueue(CMD_MOVE, 230, DUP);
|
||||||
addshipqueue(CMD_MOVE, 2690, DDOWNRIGHT);
|
addshipqueue(CMD_WAIT, 50, 0);
|
||||||
addshipqueue(CMD_WAIT, 100, 0);
|
addshipqueue(CMD_MOVE, 2690, DDOWNRIGHT);
|
||||||
addshipqueue(CMD_MOVE, 480, DDOWN);
|
addshipqueue(CMD_WAIT, 100, 0);
|
||||||
addshipqueue(CMD_WAIT, 150, 0);
|
addshipqueue(CMD_MOVE, 480, DDOWN);
|
||||||
addshipqueue(CMD_SPAWNSPR, 0, SPR_QUESTION);
|
addshipqueue(CMD_WAIT, 150, 0);
|
||||||
addshipqueue(CMD_DISABLESCROLLING, 0, 0);
|
addshipqueue(CMD_SPAWNSPR, 0, SPR_QUESTION);
|
||||||
addshipqueue(CMD_WAIT, 350, 0);
|
addshipqueue(CMD_DISABLESCROLLING, 0, 0);
|
||||||
addshipqueue(CMD_REMOVESPR, 0, 0);
|
addshipqueue(CMD_WAIT, 350, 0);
|
||||||
addshipqueue(CMD_WAIT, 50, 0);
|
addshipqueue(CMD_REMOVESPR, 0, 0);
|
||||||
addshipqueue(CMD_MOVE, 700, DLEFT);
|
addshipqueue(CMD_WAIT, 50, 0);
|
||||||
addshipqueue(CMD_WAIT, 150, 0);
|
addshipqueue(CMD_MOVE, 700, DLEFT);
|
||||||
addshipqueue(CMD_SPAWNSPR, 0, SPR_EXCLAMATION);
|
addshipqueue(CMD_WAIT, 150, 0);
|
||||||
addshipqueue(CMD_WAIT, 500, 0);
|
addshipqueue(CMD_SPAWNSPR, 0, SPR_EXCLAMATION);
|
||||||
addshipqueue(CMD_REMOVESPR, 0, 0);
|
addshipqueue(CMD_WAIT, 500, 0);
|
||||||
addshipqueue(CMD_WAIT, 50, 0);
|
addshipqueue(CMD_REMOVESPR, 0, 0);
|
||||||
addshipqueue(CMD_MOVE, 700, DRIGHT);
|
addshipqueue(CMD_WAIT, 50, 0);
|
||||||
addshipqueue(CMD_WAIT, 25, 0);
|
addshipqueue(CMD_MOVE, 700, DRIGHT);
|
||||||
addshipqueue(CMD_ENABLESCROLLING, 0, 0);
|
addshipqueue(CMD_WAIT, 25, 0);
|
||||||
addshipqueue(CMD_MOVE, 465, DDOWN);
|
addshipqueue(CMD_ENABLESCROLLING, 0, 0);
|
||||||
addshipqueue(CMD_FADEOUT, 0, 0);
|
addshipqueue(CMD_MOVE, 465, DDOWN);
|
||||||
addshipqueue(CMD_MOVE, 100, DDOWN);
|
addshipqueue(CMD_FADEOUT, 0, 0);
|
||||||
addshipqueue(CMD_ENDOFQUEUE, 0, 0);
|
addshipqueue(CMD_MOVE, 100, DDOWN);
|
||||||
|
addshipqueue(CMD_ENDOFQUEUE, 0, 0);
|
||||||
showmapatpos(81, SHIPFLY_X, SHIPFLY_Y, 0, pCKP);
|
|
||||||
|
showmapatpos(81, SHIPFLY_X, SHIPFLY_Y, 0, pCKP);
|
||||||
objects[MARK_SPR_NUM].type = OBJ_YORP; // doesn't matter
|
|
||||||
objects[MARK_SPR_NUM].exists = 0;
|
objects[MARK_SPR_NUM].type = OBJ_YORP; // doesn't matter
|
||||||
objects[MARK_SPR_NUM].sprite = SPR_QUESTION;
|
objects[MARK_SPR_NUM].exists = 0;
|
||||||
|
objects[MARK_SPR_NUM].sprite = SPR_QUESTION;
|
||||||
numplayers = 1;
|
|
||||||
// place the player at the center of mars
|
numplayers = 1;
|
||||||
if (map_findtile(593, &x, &y))
|
// place the player at the center of mars
|
||||||
{ // found the tile at the center of mars
|
if (map_findtile(593, &x, &y))
|
||||||
player[0].x = ((x<<4)+1)<<CSF;
|
{ // found the tile at the center of mars
|
||||||
player[0].y = ((y<<4)-3)<<CSF;
|
player[0].x = ((x<<4)+1)<<CSF;
|
||||||
}
|
player[0].y = ((y<<4)-3)<<CSF;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
crashflag = 1;
|
{
|
||||||
why_term_ptr = "eseq1_shipflys(): unable to find center of Mars.";
|
crashflag = 1;
|
||||||
return 1;
|
why_term_ptr = "eseq1_shipflys(): unable to find center of Mars.";
|
||||||
}
|
return 1;
|
||||||
|
}
|
||||||
player[0].playframe = SPR_SHIP_RIGHT;
|
|
||||||
// player[0].pbgprioritycorners = 0;
|
player[0].playframe = SPR_SHIP_RIGHT;
|
||||||
|
// player[0].pbgprioritycorners = 0;
|
||||||
fade.mode = FADE_GO;
|
|
||||||
fade.dir = FADE_IN;
|
fade.mode = FADE_GO;
|
||||||
fade.curamt = 0;
|
fade.dir = FADE_IN;
|
||||||
fade.fadetimer = 0;
|
fade.curamt = 0;
|
||||||
fade.rate = FADE_NORM;
|
fade.fadetimer = 0;
|
||||||
ShipQueuePtr = 0;
|
fade.rate = FADE_NORM;
|
||||||
max_scroll_x = max_scroll_y = 20000;
|
ShipQueuePtr = 0;
|
||||||
do
|
max_scroll_x = max_scroll_y = 20000;
|
||||||
{
|
do
|
||||||
// keep the question or exclamation mark sprite next to the player
|
{
|
||||||
objects[MARK_SPR_NUM].x = player[0].x + (20<<CSF);
|
// keep the question or exclamation mark sprite next to the player
|
||||||
objects[MARK_SPR_NUM].y = player[0].y - (10<<CSF);
|
objects[MARK_SPR_NUM].x = player[0].x + (20<<CSF);
|
||||||
objects[MARK_SPR_NUM].onscreen = 1;
|
objects[MARK_SPR_NUM].y = player[0].y - (10<<CSF);
|
||||||
// objects[MARK_SPR_NUM].priorityptsfound = 0;
|
objects[MARK_SPR_NUM].onscreen = 1;
|
||||||
// objects[MARK_SPR_NUM].priorityptschecked = 4;
|
// objects[MARK_SPR_NUM].priorityptsfound = 0;
|
||||||
objects[MARK_SPR_NUM].scrx = (objects[MARK_SPR_NUM].x>>CSF)-scroll_x;
|
// objects[MARK_SPR_NUM].priorityptschecked = 4;
|
||||||
objects[MARK_SPR_NUM].scry = (objects[MARK_SPR_NUM].y>>CSF)-scroll_y;
|
objects[MARK_SPR_NUM].scrx = (objects[MARK_SPR_NUM].x>>CSF)-scroll_x;
|
||||||
|
objects[MARK_SPR_NUM].scry = (objects[MARK_SPR_NUM].y>>CSF)-scroll_y;
|
||||||
// execute the current command in the queue
|
|
||||||
if (fade.dir != FADE_OUT)
|
// execute the current command in the queue
|
||||||
{
|
if (fade.dir != FADE_OUT)
|
||||||
switch(shipqueue[ShipQueuePtr].cmd)
|
{
|
||||||
{
|
switch(shipqueue[ShipQueuePtr].cmd)
|
||||||
case CMD_MOVE:
|
{
|
||||||
switch(shipqueue[ShipQueuePtr].flag1)
|
case CMD_MOVE:
|
||||||
{
|
switch(shipqueue[ShipQueuePtr].flag1)
|
||||||
case DUP:
|
{
|
||||||
player[0].y-=SHIPSPD;
|
case DUP:
|
||||||
player[0].playframe = SPR_SHIP_RIGHT;
|
player[0].y-=SHIPSPD;
|
||||||
break;
|
player[0].playframe = SPR_SHIP_RIGHT;
|
||||||
case DDOWN:
|
break;
|
||||||
player[0].y+=SHIPSPD/2;
|
case DDOWN:
|
||||||
player[0].playframe = SPR_SHIP_RIGHT;
|
player[0].y+=SHIPSPD/2;
|
||||||
break;
|
player[0].playframe = SPR_SHIP_RIGHT;
|
||||||
case DLEFT:
|
break;
|
||||||
player[0].x-=SHIPSPD;
|
case DLEFT:
|
||||||
player[0].playframe = SPR_SHIP_LEFT;
|
player[0].x-=SHIPSPD;
|
||||||
break;
|
player[0].playframe = SPR_SHIP_LEFT;
|
||||||
case DRIGHT:
|
break;
|
||||||
player[0].x+=SHIPSPD;
|
case DRIGHT:
|
||||||
player[0].playframe = SPR_SHIP_RIGHT;
|
player[0].x+=SHIPSPD;
|
||||||
break;
|
player[0].playframe = SPR_SHIP_RIGHT;
|
||||||
case DDOWNRIGHT:
|
break;
|
||||||
player[0].x+=SHIPSPD*2;
|
case DDOWNRIGHT:
|
||||||
player[0].y+=SHIPSPD*0.8;
|
player[0].x+=SHIPSPD*2;
|
||||||
player[0].playframe = SPR_SHIP_RIGHT;
|
player[0].y+=SHIPSPD*0.8;
|
||||||
break;
|
player[0].playframe = SPR_SHIP_RIGHT;
|
||||||
}
|
break;
|
||||||
break;
|
}
|
||||||
case CMD_SPAWNSPR:
|
break;
|
||||||
objects[MARK_SPR_NUM].sprite = shipqueue[ShipQueuePtr].flag1;
|
case CMD_SPAWNSPR:
|
||||||
objects[MARK_SPR_NUM].exists = 1;
|
objects[MARK_SPR_NUM].sprite = shipqueue[ShipQueuePtr].flag1;
|
||||||
break;
|
objects[MARK_SPR_NUM].exists = 1;
|
||||||
case CMD_REMOVESPR:
|
break;
|
||||||
objects[MARK_SPR_NUM].sprite = shipqueue[ShipQueuePtr].flag1;
|
case CMD_REMOVESPR:
|
||||||
objects[MARK_SPR_NUM].exists = 0;
|
objects[MARK_SPR_NUM].sprite = shipqueue[ShipQueuePtr].flag1;
|
||||||
break;
|
objects[MARK_SPR_NUM].exists = 0;
|
||||||
case CMD_ENABLESCROLLING:
|
break;
|
||||||
scrollingon = 1;
|
case CMD_ENABLESCROLLING:
|
||||||
break;
|
scrollingon = 1;
|
||||||
case CMD_DISABLESCROLLING:
|
break;
|
||||||
scrollingon = 0;
|
case CMD_DISABLESCROLLING:
|
||||||
break;
|
scrollingon = 0;
|
||||||
case CMD_WAIT:
|
break;
|
||||||
break;
|
case CMD_WAIT:
|
||||||
case CMD_FADEOUT:
|
break;
|
||||||
if (fade.dir!=FADE_OUT)
|
case CMD_FADEOUT:
|
||||||
{
|
if (fade.dir!=FADE_OUT)
|
||||||
fade.dir = FADE_OUT;
|
{
|
||||||
fade.curamt = PAL_FADE_SHADES;
|
fade.dir = FADE_OUT;
|
||||||
fade.fadetimer = 0;
|
fade.curamt = PAL_FADE_SHADES;
|
||||||
fade.mode = FADE_GO;
|
fade.fadetimer = 0;
|
||||||
fade.rate = FADE_NORM;
|
fade.mode = FADE_GO;
|
||||||
}
|
fade.rate = FADE_NORM;
|
||||||
break;
|
}
|
||||||
default: break;
|
break;
|
||||||
}
|
default: break;
|
||||||
// decrease the time remaining
|
}
|
||||||
if (shipqueue[ShipQueuePtr].time)
|
// decrease the time remaining
|
||||||
{
|
if (shipqueue[ShipQueuePtr].time)
|
||||||
shipqueue[ShipQueuePtr].time--;
|
{
|
||||||
}
|
shipqueue[ShipQueuePtr].time--;
|
||||||
else
|
}
|
||||||
{ // no time left on this command, go to next cmd
|
else
|
||||||
ShipQueuePtr++;
|
{ // no time left on this command, go to next cmd
|
||||||
}
|
ShipQueuePtr++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (fade.dir==FADE_OUT && fade.mode==FADE_COMPLETE)
|
|
||||||
{ // we're done
|
if (fade.dir==FADE_OUT && fade.mode==FADE_COMPLETE)
|
||||||
return 0;
|
{ // we're done
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
enter = ( g_pInput->getPressedKey(KENTER) || g_pInput->getPressedKey(KCTRL) || g_pInput->getPressedKey(KALT) );
|
|
||||||
if (enter)
|
enter = ( g_pInput->getPressedKey(KENTER) || g_pInput->getPressedKey(KCTRL) || g_pInput->getPressedKey(KALT) );
|
||||||
{
|
if (enter)
|
||||||
if (fade.dir!=FADE_OUT)
|
{
|
||||||
{
|
if (fade.dir!=FADE_OUT)
|
||||||
fade.dir = FADE_OUT;
|
{
|
||||||
fade.curamt = PAL_FADE_SHADES;
|
fade.dir = FADE_OUT;
|
||||||
fade.fadetimer = 0;
|
fade.curamt = PAL_FADE_SHADES;
|
||||||
fade.mode = FADE_GO;
|
fade.fadetimer = 0;
|
||||||
fade.rate = FADE_NORM;
|
fade.mode = FADE_GO;
|
||||||
}
|
fade.rate = FADE_NORM;
|
||||||
}
|
}
|
||||||
lastenterstate = enter;
|
}
|
||||||
|
lastenterstate = enter;
|
||||||
gamedo_fades();
|
|
||||||
gamedo_AnimatedTiles();
|
gamedo_fades();
|
||||||
|
gamedo_AnimatedTiles();
|
||||||
gamedo_frameskipping(pCKP);
|
|
||||||
if (scrollingon) gamedo_ScrollTriggers(0);
|
gamedo_frameskipping(pCKP);
|
||||||
|
if (scrollingon) gamedo_ScrollTriggers(0);
|
||||||
g_pInput->pollEvents();
|
|
||||||
g_pTimer->SpeedThrottle();
|
g_pInput->pollEvents();
|
||||||
} while(!g_pInput->getPressedKey(KQUIT));
|
g_pTimer->SpeedThrottle();
|
||||||
return 1;
|
} while(!g_pInput->getPressedKey(KQUIT));
|
||||||
}
|
return 1;
|
||||||
|
}
|
||||||
int eseq1_BackAtHome(stCloneKeenPlus *pCKP)
|
|
||||||
{
|
int eseq1_BackAtHome(stCloneKeenPlus *pCKP)
|
||||||
/*int draw;*/
|
{
|
||||||
int i;
|
/*int draw;*/
|
||||||
char *text[10];
|
int i;
|
||||||
char strname[40];
|
std::string text[10];
|
||||||
char tempbuf[200];
|
std::string strname;
|
||||||
short textline, showtimer;
|
std::string tempbuf;
|
||||||
unsigned short amountshown;
|
short textline, showtimer;
|
||||||
signed int waittimer;
|
unsigned short amountshown;
|
||||||
int state;
|
signed int waittimer;
|
||||||
int enter, lastenterstate;
|
int state;
|
||||||
int dlgX, dlgY, dlgW, dlgH;
|
int enter, lastenterstate;
|
||||||
|
int dlgX, dlgY, dlgW, dlgH;
|
||||||
#define STATE_TEXTAPPEARING 0
|
|
||||||
#define STATE_WAITASEC 1
|
#define STATE_TEXTAPPEARING 0
|
||||||
#define STATE_FADING 2
|
#define STATE_WAITASEC 1
|
||||||
|
#define STATE_FADING 2
|
||||||
// get pointers to all the strings we're going to be using
|
|
||||||
for(i=0;i<8;i++)
|
// get pointers to all the strings we're going to be using
|
||||||
{
|
for(i=0;i<8;i++)
|
||||||
sprintf(strname, "EP1_ESEQ_PART2_PAGE%d", i+1);
|
{
|
||||||
text[i] = getstring(strname);
|
strname = "EP1_ESEQ_PART2_PAGE" + itoa(i+1);
|
||||||
}
|
text[i] = getstring(strname);
|
||||||
|
}
|
||||||
textline = 0;
|
|
||||||
amountshown = 0;
|
textline = 0;
|
||||||
showtimer = 0;
|
amountshown = 0;
|
||||||
state = STATE_TEXTAPPEARING;
|
showtimer = 0;
|
||||||
lastenterstate = 1;
|
state = STATE_TEXTAPPEARING;
|
||||||
waittimer = 0;
|
lastenterstate = 1;
|
||||||
|
waittimer = 0;
|
||||||
finale_draw("finale.ck1", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
|
|
||||||
scrollx_buf = scroll_x = 0;
|
finale_draw("finale.ck1", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
|
||||||
scrolly_buf = scroll_y = 0;
|
scrollx_buf = scroll_x = 0;
|
||||||
|
scrolly_buf = scroll_y = 0;
|
||||||
numplayers = 1;
|
|
||||||
player[0].x = 16;
|
numplayers = 1;
|
||||||
player[0].y = 16;
|
player[0].x = 16;
|
||||||
player[0].playframe = BlankSprite;
|
player[0].y = 16;
|
||||||
|
player[0].playframe = BlankSprite;
|
||||||
dlgX = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "LEFT");
|
|
||||||
dlgY = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "TOP");
|
dlgX = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "LEFT");
|
||||||
dlgW = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "WIDTH");
|
dlgY = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "TOP");
|
||||||
dlgH = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "HEIGHT");
|
dlgW = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "WIDTH");
|
||||||
|
dlgH = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "HEIGHT");
|
||||||
fade.mode = FADE_GO;
|
|
||||||
fade.rate = FADE_NORM;
|
fade.mode = FADE_GO;
|
||||||
fade.dir = FADE_IN;
|
fade.rate = FADE_NORM;
|
||||||
fade.curamt = 0;
|
fade.dir = FADE_IN;
|
||||||
fade.fadetimer = 0;
|
fade.curamt = 0;
|
||||||
do
|
fade.fadetimer = 0;
|
||||||
{
|
do
|
||||||
enter = ( g_pInput->getPressedKey(KENTER) || g_pInput->getPressedKey(KCTRL) || g_pInput->getPressedKey(KALT) );
|
{
|
||||||
|
enter = ( g_pInput->getPressedKey(KENTER) || g_pInput->getPressedKey(KCTRL) || g_pInput->getPressedKey(KALT) );
|
||||||
sb_dialogbox(dlgX, dlgY, dlgW, dlgH);
|
|
||||||
|
sb_dialogbox(dlgX, dlgY, dlgW, dlgH);
|
||||||
// draw the current text line up to the amount currently shown
|
|
||||||
strcpy(tempbuf, text[textline]);
|
// draw the current text line up to the amount currently shown
|
||||||
tempbuf[amountshown] = 0;
|
tempbuf = text[textline];
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) tempbuf, (dlgX+1)*8, (dlgY+1)*8);
|
tempbuf.erase(amountshown);
|
||||||
|
g_pGraphics->sb_font_draw( tempbuf, (dlgX+1)*8, (dlgY+1)*8);
|
||||||
if (state==STATE_TEXTAPPEARING)
|
|
||||||
{
|
if (state==STATE_TEXTAPPEARING)
|
||||||
if (enter) goto fullshow;
|
{
|
||||||
if (showtimer > LETTER_SHOW_SPD)
|
if (enter) goto fullshow;
|
||||||
{ // it's time to show a new letter
|
if (showtimer > LETTER_SHOW_SPD)
|
||||||
amountshown++;
|
{ // it's time to show a new letter
|
||||||
if (amountshown > strlen(text[textline]))
|
amountshown++;
|
||||||
{ // reached end of line
|
if (amountshown > text[textline].size())
|
||||||
state = STATE_WAITASEC;
|
{ // reached end of line
|
||||||
// if (textline==8)
|
state = STATE_WAITASEC;
|
||||||
// waittimer = -BACKHOME_SHORT_WAIT_TIME*3;
|
// if (textline==8)
|
||||||
// else
|
// waittimer = -BACKHOME_SHORT_WAIT_TIME*3;
|
||||||
waittimer = -BACKHOME_SHORT_WAIT_TIME*2;
|
// else
|
||||||
}
|
waittimer = -BACKHOME_SHORT_WAIT_TIME*2;
|
||||||
// if the last letter shown is a dash/cr ('Billy...are you a-'),
|
}
|
||||||
// show the rest of the text immediately
|
// if the last letter shown is a dash/cr ('Billy...are you a-'),
|
||||||
// (for when the mom shouts "WHAT IS THIS ONE-EYED GREEN THING..."
|
// show the rest of the text immediately
|
||||||
if (text[textline][amountshown]==13 && \
|
// (for when the mom shouts "WHAT IS THIS ONE-EYED GREEN THING..."
|
||||||
text[textline][amountshown-1]=='-')
|
if (text[textline][amountshown]==13 && \
|
||||||
{
|
text[textline][amountshown-1]=='-')
|
||||||
fullshow: ;
|
{
|
||||||
amountshown = strlen(text[textline]);
|
fullshow: ;
|
||||||
state = STATE_WAITASEC;
|
amountshown = text[textline].size();
|
||||||
waittimer = -BACKHOME_SHORT_WAIT_TIME*3;
|
state = STATE_WAITASEC;
|
||||||
}
|
waittimer = -BACKHOME_SHORT_WAIT_TIME*3;
|
||||||
showtimer = 0;
|
}
|
||||||
} else showtimer++;
|
showtimer = 0;
|
||||||
|
} else showtimer++;
|
||||||
// user pressed enter
|
|
||||||
if (enter)
|
// user pressed enter
|
||||||
{ // show all text immediately
|
if (enter)
|
||||||
|
{ // show all text immediately
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (state==STATE_WAITASEC)
|
}
|
||||||
{
|
else if (state==STATE_WAITASEC)
|
||||||
if (enter) goto nextline;
|
{
|
||||||
if (waittimer<BACKHOME_SHORT_WAIT_TIME)
|
if (enter) goto nextline;
|
||||||
{
|
if (waittimer<BACKHOME_SHORT_WAIT_TIME)
|
||||||
waittimer++;
|
{
|
||||||
if (waittimer==BACKHOME_SHORT_WAIT_TIME)
|
waittimer++;
|
||||||
{
|
if (waittimer==BACKHOME_SHORT_WAIT_TIME)
|
||||||
nextline: ;
|
{
|
||||||
textline++;
|
nextline: ;
|
||||||
state = STATE_TEXTAPPEARING;
|
textline++;
|
||||||
amountshown = 0;
|
state = STATE_TEXTAPPEARING;
|
||||||
if (textline>7)
|
amountshown = 0;
|
||||||
{ // end of text
|
if (textline>7)
|
||||||
break;
|
{ // end of text
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (fade.dir==FADE_OUT && fade.mode==FADE_COMPLETE)
|
|
||||||
return 0;
|
if (fade.dir==FADE_OUT && fade.mode==FADE_COMPLETE)
|
||||||
|
return 0;
|
||||||
gamedo_fades();
|
|
||||||
gamedo_frameskipping_blitonly();
|
gamedo_fades();
|
||||||
|
gamedo_frameskipping_blitonly();
|
||||||
lastenterstate = enter;
|
|
||||||
|
lastenterstate = enter;
|
||||||
g_pInput->pollEvents();
|
|
||||||
g_pTimer->SpeedThrottle();
|
g_pInput->pollEvents();
|
||||||
if (g_pInput->getPressedKey(KQUIT)) return 1;
|
g_pTimer->SpeedThrottle();
|
||||||
} while(1);
|
if (g_pInput->getPressedKey(KQUIT)) return 1;
|
||||||
|
} while(1);
|
||||||
finale_draw("finale.ck1", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
|
|
||||||
eseq_ToBeContinued(pCKP);
|
finale_draw("finale.ck1", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
|
||||||
return 1;
|
eseq_ToBeContinued(pCKP);
|
||||||
}
|
return 1;
|
||||||
|
}
|
||||||
void eseq_ToBeContinued(stCloneKeenPlus *pCKP)
|
|
||||||
{
|
void eseq_ToBeContinued(stCloneKeenPlus *pCKP)
|
||||||
int i;
|
{
|
||||||
char *text;
|
int i;
|
||||||
int dlgX, dlgY, dlgW, dlgH;
|
std::string text;
|
||||||
|
int dlgX, dlgY, dlgW, dlgH;
|
||||||
// remove all objects because eseq_showmsg will call drawobjects
|
|
||||||
for(i=0;i<MAX_OBJECTS;i++)
|
// remove all objects because eseq_showmsg will call drawobjects
|
||||||
objects[i].exists = 0;
|
for(i=0;i<MAX_OBJECTS;i++)
|
||||||
|
objects[i].exists = 0;
|
||||||
text = getstring("TO_BE_CONTINUED");
|
|
||||||
dlgX = GetStringAttribute("TO_BE_CONTINUED", "LEFT");
|
text = getstring("TO_BE_CONTINUED");
|
||||||
dlgY = GetStringAttribute("TO_BE_CONTINUED", "TOP");
|
dlgX = GetStringAttribute("TO_BE_CONTINUED", "LEFT");
|
||||||
dlgW = GetStringAttribute("TO_BE_CONTINUED", "WIDTH");
|
dlgY = GetStringAttribute("TO_BE_CONTINUED", "TOP");
|
||||||
dlgH = GetStringAttribute("TO_BE_CONTINUED", "HEIGHT");
|
dlgW = GetStringAttribute("TO_BE_CONTINUED", "WIDTH");
|
||||||
eseq_showmsg(text, dlgX, dlgY, dlgW, dlgH, 0, pCKP);
|
dlgH = GetStringAttribute("TO_BE_CONTINUED", "HEIGHT");
|
||||||
|
eseq_showmsg(text, dlgX, dlgY, dlgW, dlgH, 0, pCKP);
|
||||||
fade.dir = FADE_OUT;
|
|
||||||
fade.curamt = PAL_FADE_SHADES;
|
fade.dir = FADE_OUT;
|
||||||
fade.fadetimer = 0;
|
fade.curamt = PAL_FADE_SHADES;
|
||||||
fade.rate = FADE_NORM;
|
fade.fadetimer = 0;
|
||||||
fade.mode = FADE_GO;
|
fade.rate = FADE_NORM;
|
||||||
do
|
fade.mode = FADE_GO;
|
||||||
{
|
do
|
||||||
gamedo_fades();
|
{
|
||||||
if (g_pInput->getPressedKey(KQUIT)) return;
|
gamedo_fades();
|
||||||
g_pInput->pollEvents();
|
if (g_pInput->getPressedKey(KQUIT)) return;
|
||||||
g_pTimer->SpeedThrottle();
|
g_pInput->pollEvents();
|
||||||
} while(fade.mode == FADE_GO);
|
g_pTimer->SpeedThrottle();
|
||||||
}
|
} while(fade.mode == FADE_GO);
|
||||||
|
}
|
||||||
|
|||||||
1430
src/eseq_ep2.cpp
1430
src/eseq_ep2.cpp
File diff suppressed because it is too large
Load Diff
1585
src/fileio.cpp
1585
src/fileio.cpp
File diff suppressed because it is too large
Load Diff
12
src/fileio.h
12
src/fileio.h
@@ -1,14 +1,12 @@
|
|||||||
#ifdef __cplusplus
|
#ifndef __CG_FILEIO2_H__
|
||||||
extern "C" {
|
#define __CG_FILEIO2_H__
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <string>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
char loadstrings(const char *fname);
|
char loadstrings(const char *fname);
|
||||||
unsigned int fgeti(FILE *fp);
|
unsigned int fgeti(FILE *fp);
|
||||||
unsigned long fgetl(FILE *fp);
|
unsigned long fgetl(FILE *fp);
|
||||||
void formatPathString(char *output, const char *path);
|
std::string formatPathString(const std::string& path);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,29 +6,31 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CExeFile.h"
|
#include "CExeFile.h"
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include "../StringUtils.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
CExeFile::CExeFile(int episode, char *datadirectory) {
|
CExeFile::CExeFile(int episode, const std::string& datadirectory) {
|
||||||
m_episode = episode;
|
m_episode = episode;
|
||||||
m_datadirectory = datadirectory;
|
m_datadirectory = datadirectory;
|
||||||
m_data = NULL;
|
m_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CExeFile::~CExeFile() {
|
CExeFile::~CExeFile() {
|
||||||
if(m_data) delete [] m_data;
|
if(m_data) delete m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CExeFile::readData()
|
bool CExeFile::readData()
|
||||||
{
|
{
|
||||||
char filename[256];
|
|
||||||
unsigned char *m_data_temp;
|
unsigned char *m_data_temp;
|
||||||
|
|
||||||
sprintf(filename, "data/%skeen%d.exe", m_datadirectory, m_episode);
|
std::string filename = "data/" + m_datadirectory + "keen" + itoa(m_episode) + ".exe";
|
||||||
|
|
||||||
ifstream File(filename,ios::binary);
|
std::ifstream File(filename.c_str(),ios::binary);
|
||||||
|
|
||||||
if(!File) return false;
|
if(!File) return false;
|
||||||
|
|
||||||
@@ -55,7 +57,7 @@ bool CExeFile::readData()
|
|||||||
m_data = new unsigned char[m_datasize];
|
m_data = new unsigned char[m_datasize];
|
||||||
memcpy(m_data, m_data_temp+512,m_datasize);
|
memcpy(m_data, m_data_temp+512,m_datasize);
|
||||||
}
|
}
|
||||||
delete [] m_data_temp;
|
delete m_data_temp;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,11 @@
|
|||||||
#define CEXEFILE_H_
|
#define CEXEFILE_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using namespace std;
|
#include <string>
|
||||||
|
|
||||||
class CExeFile {
|
class CExeFile {
|
||||||
public:
|
public:
|
||||||
CExeFile(int episode, char *datadirectory);
|
CExeFile(int episode, const std::string& datadirectory);
|
||||||
virtual ~CExeFile();
|
virtual ~CExeFile();
|
||||||
|
|
||||||
bool readData();
|
bool readData();
|
||||||
@@ -27,10 +27,10 @@ private:
|
|||||||
int m_datasize;
|
int m_datasize;
|
||||||
int m_episode;
|
int m_episode;
|
||||||
unsigned char *m_data;
|
unsigned char *m_data;
|
||||||
char *m_datadirectory;
|
std::string m_datadirectory;
|
||||||
|
|
||||||
int get_bit(int *p_bit_count, unsigned char *fin, int *posin);
|
int get_bit(int *p_bit_count, unsigned char *fin, int *posin);
|
||||||
int unlzexe(unsigned char *fin, vector<unsigned char> *outbuffer);
|
int unlzexe(unsigned char *fin, std::vector<unsigned char> *outbuffer);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CEXEFILE_H_ */
|
#endif /* CEXEFILE_H_ */
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
CPatcher::CPatcher(int episode, int version,unsigned char *data, char *datadir) {
|
CPatcher::CPatcher(int episode, int version,unsigned char *data, const std::string& datadir) {
|
||||||
m_episode = episode;
|
m_episode = episode;
|
||||||
m_version = version;
|
m_version = version;
|
||||||
m_data = data;
|
m_data = data;
|
||||||
strcpy(m_datadirectory, datadir);
|
m_datadirectory = datadir;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPatcher::~CPatcher() {
|
CPatcher::~CPatcher() {
|
||||||
@@ -35,7 +35,7 @@ void CPatcher::patchMemory()
|
|||||||
|
|
||||||
// change to the proper directory
|
// change to the proper directory
|
||||||
chdir("data");
|
chdir("data");
|
||||||
chdir(m_datadirectory);
|
chdir(m_datadirectory.c_str());
|
||||||
|
|
||||||
// TODO: Extend this part further with more commands
|
// TODO: Extend this part further with more commands
|
||||||
while(!m_TextList.empty())
|
while(!m_TextList.empty())
|
||||||
@@ -80,7 +80,6 @@ void CPatcher::patchMemory()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!m_TextList.empty())
|
if(!m_TextList.empty())
|
||||||
@@ -109,7 +108,7 @@ bool CPatcher::loadPatchfile()
|
|||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
chdir("data");
|
chdir("data");
|
||||||
chdir(m_datadirectory);
|
chdir(m_datadirectory.c_str());
|
||||||
// Detect the patchfile
|
// Detect the patchfile
|
||||||
DIR *dir = opendir(".");
|
DIR *dir = opendir(".");
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
@@ -121,8 +120,9 @@ bool CPatcher::loadPatchfile()
|
|||||||
if(strstr(dp->d_name,".pat"))
|
if(strstr(dp->d_name,".pat"))
|
||||||
{
|
{
|
||||||
// The file was found! now read it into the memory!
|
// The file was found! now read it into the memory!
|
||||||
|
|
||||||
char* buf;
|
char* buf;
|
||||||
ifstream Patchfile(dp->d_name);
|
std::ifstream Patchfile(dp->d_name);
|
||||||
|
|
||||||
while(!Patchfile.eof())
|
while(!Patchfile.eof())
|
||||||
{
|
{
|
||||||
@@ -157,12 +157,12 @@ bool CPatcher::loadPatchfile()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPatcher::patchMemfromFile(const char *patch_file_name, int offset)
|
void CPatcher::patchMemfromFile(const std::string& patch_file_name, int offset)
|
||||||
{
|
{
|
||||||
unsigned char *buf_to_patch;
|
unsigned char *buf_to_patch;
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
|
|
||||||
ifstream Patchfile(patch_file_name, ios::binary);
|
std::ifstream Patchfile(patch_file_name.c_str(), std::ios::binary);
|
||||||
|
|
||||||
if(!Patchfile) return;
|
if(!Patchfile) return;
|
||||||
|
|
||||||
|
|||||||
@@ -9,15 +9,15 @@
|
|||||||
#define CPATCHER_H_
|
#define CPATCHER_H_
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
using namespace std;
|
#include <string>
|
||||||
|
|
||||||
class CPatcher {
|
class CPatcher {
|
||||||
public:
|
public:
|
||||||
CPatcher(int episode, int version,unsigned char *data, char *datadir);
|
CPatcher(int episode, int version,unsigned char *data, const std::string& datadir);
|
||||||
virtual ~CPatcher();
|
virtual ~CPatcher();
|
||||||
|
|
||||||
void patchMemory();
|
void patchMemory();
|
||||||
void patchMemfromFile(const char *patch_file_name, int offset);
|
void patchMemfromFile(const std::string& patch_file_name, int offset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -26,9 +26,9 @@ private:
|
|||||||
int m_episode;
|
int m_episode;
|
||||||
int m_version;
|
int m_version;
|
||||||
unsigned char *m_data;
|
unsigned char *m_data;
|
||||||
char m_datadirectory[256];
|
std::string m_datadirectory;
|
||||||
|
|
||||||
list<char*> m_TextList;
|
std::list<char*> m_TextList;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -12,24 +12,19 @@
|
|||||||
#include "../include/fileio.h"
|
#include "../include/fileio.h"
|
||||||
#include "../fileio/CExeFile.h"
|
#include "../fileio/CExeFile.h"
|
||||||
#include "../CLogFile.h"
|
#include "../CLogFile.h"
|
||||||
|
#include "../StringUtils.h"
|
||||||
|
|
||||||
int readStoryText(char **ptext, int episode, char *path)
|
int readStoryText(char **ptext, int episode, const std::string& path)
|
||||||
{
|
{
|
||||||
|
std::string buf2 = formatPathString(path);
|
||||||
|
std::string buf = buf2 + "storytxt.ck" + itoa(episode);
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[256];
|
if((fp=fopen(buf.c_str(),"rt"))==NULL)
|
||||||
char buf2[256];
|
|
||||||
|
|
||||||
memset(buf,0,256*sizeof(char));
|
|
||||||
|
|
||||||
formatPathString(buf2,path);
|
|
||||||
|
|
||||||
sprintf(buf,"%sstorytxt.ck%d",buf2,episode);
|
|
||||||
|
|
||||||
if((fp=fopen(buf,"rt"))==NULL)
|
|
||||||
{
|
{
|
||||||
sprintf(buf,"%skeen%d.exe",buf2,episode);
|
buf = buf2 + "keen" + itoa(episode) + ".exe";
|
||||||
|
|
||||||
if((fp=fopen(buf,"rb"))!=NULL)
|
if((fp=fopen(buf.c_str(),"rb"))!=NULL)
|
||||||
{
|
{
|
||||||
unsigned char *filebuf;
|
unsigned char *filebuf;
|
||||||
int startflag=0, endflag=0; // where story begins and ends!
|
int startflag=0, endflag=0; // where story begins and ends!
|
||||||
|
|||||||
268
src/finale.cpp
268
src/finale.cpp
@@ -1,135 +1,133 @@
|
|||||||
/* FINALE.C
|
/* FINALE.C
|
||||||
Code for displaying the FINALE.CK? files.
|
Code for displaying the FINALE.CK? files.
|
||||||
Thanks to Andrew Durdin for FIN2BMP, from which I got
|
Thanks to Andrew Durdin for FIN2BMP, from which I got
|
||||||
the decompression algorithm.
|
the decompression algorithm.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "keen.h"
|
#include "keen.h"
|
||||||
#include "include/fileio.h"
|
#include "include/fileio.h"
|
||||||
#include "CGraphics.h"
|
#include "CGraphics.h"
|
||||||
|
|
||||||
int finale_x;
|
int finale_x;
|
||||||
int finale_y;
|
int finale_y;
|
||||||
int finale_count;
|
int finale_count;
|
||||||
int finale_planecol;
|
int finale_planecol;
|
||||||
int finale_plane_length;
|
int finale_plane_length;
|
||||||
int finale_done;
|
int finale_done;
|
||||||
|
|
||||||
// used internally by finale_draw()
|
// used internally by finale_draw()
|
||||||
void finale_plot(int pix)
|
void finale_plot(int pix)
|
||||||
{
|
{
|
||||||
int mask;
|
int mask;
|
||||||
|
|
||||||
mask = 128;
|
mask = 128;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (pix & mask)
|
if (pix & mask)
|
||||||
{
|
{
|
||||||
if (finale_planecol==1)
|
if (finale_planecol==1)
|
||||||
{
|
{
|
||||||
g_pGraphics->sb_setpixel(finale_x, finale_y, finale_planecol);
|
g_pGraphics->sb_setpixel(finale_x, finale_y, finale_planecol);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // merge with previous planes
|
{ // merge with previous planes
|
||||||
g_pGraphics->sb_setpixel(finale_x, finale_y, g_pGraphics->sb_getpixel(finale_x, finale_y) | finale_planecol);
|
g_pGraphics->sb_setpixel(finale_x, finale_y, g_pGraphics->sb_getpixel(finale_x, finale_y) | finale_planecol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (finale_planecol==1)
|
else if (finale_planecol==1)
|
||||||
{
|
{
|
||||||
g_pGraphics->sb_setpixel(finale_x, finale_y, 0);
|
g_pGraphics->sb_setpixel(finale_x, finale_y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
finale_x++;
|
finale_x++;
|
||||||
if (finale_x > 319)
|
if (finale_x > 319)
|
||||||
{
|
{
|
||||||
finale_x = 0;
|
finale_x = 0;
|
||||||
finale_y++;
|
finale_y++;
|
||||||
}
|
}
|
||||||
|
|
||||||
finale_count++;
|
finale_count++;
|
||||||
if (finale_count >= finale_plane_length)
|
if (finale_count >= finale_plane_length)
|
||||||
{
|
{
|
||||||
finale_x = finale_y = 0;
|
finale_x = finale_y = 0;
|
||||||
finale_count = 0;
|
finale_count = 0;
|
||||||
finale_planecol <<= 1;
|
finale_planecol <<= 1;
|
||||||
if (finale_planecol > 8) finale_done = 1;
|
if (finale_planecol > 8) finale_done = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask==1)
|
if (mask==1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mask >>= 1;
|
mask >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while(1);
|
} while(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// draws a finale.ck? file into the upper-left corner of the scrollbuffer
|
// draws a finale.ck? file into the upper-left corner of the scrollbuffer
|
||||||
void finale_draw(const char *filename, const char *path)
|
void finale_draw(const std::string& filename, const std::string& path)
|
||||||
{
|
{
|
||||||
char fname[256];
|
FILE *fp;
|
||||||
FILE *fp;
|
int cmdbyte;
|
||||||
int cmdbyte;
|
int bytecount;
|
||||||
int bytecount;
|
int repeatbyte;
|
||||||
int repeatbyte;
|
int i;
|
||||||
int i;
|
|
||||||
char buffer[256];
|
|
||||||
|
std::string buffer = formatPathString(path);
|
||||||
|
|
||||||
formatPathString(buffer,path);
|
|
||||||
|
map_unregister_all_animtiles();
|
||||||
|
|
||||||
map_unregister_all_animtiles();
|
std::string fname = buffer + filename;
|
||||||
|
fp = fopen(fname.c_str(), "rb");
|
||||||
sprintf(fname, "%s%s", buffer,filename);
|
if (!fp)
|
||||||
fp = fopen(fname, "rb");
|
{
|
||||||
if (!fp)
|
crashflag = 1;
|
||||||
{
|
why_term_ptr = "finale_draw(): cannot open finake.ck? file.";
|
||||||
crashflag = 1;
|
return;
|
||||||
why_term_ptr = "finale_draw(): cannot open finake.ck? file.";
|
}
|
||||||
return;
|
|
||||||
}
|
finale_plane_length = fgetl(fp)*2; //length of a plane when decompressed
|
||||||
|
finale_planecol = 1;
|
||||||
finale_plane_length = fgetl(fp)*2; //length of a plane when decompressed
|
finale_x = finale_y = 0;
|
||||||
finale_planecol = 1;
|
finale_count = 0;
|
||||||
finale_x = finale_y = 0;
|
finale_done = 0;
|
||||||
finale_count = 0;
|
|
||||||
finale_done = 0;
|
/* decompress/draw the image */
|
||||||
|
do
|
||||||
/* decompress/draw the image */
|
{
|
||||||
do
|
cmdbyte = fgetc(fp);
|
||||||
{
|
if (cmdbyte<0)
|
||||||
cmdbyte = fgetc(fp);
|
{ // EOF
|
||||||
if (cmdbyte<0)
|
return;
|
||||||
{ // EOF
|
}
|
||||||
return;
|
|
||||||
}
|
if (cmdbyte & 0x80)
|
||||||
|
{
|
||||||
if (cmdbyte & 0x80)
|
//N + 1 bytes of data follows
|
||||||
{
|
bytecount = (cmdbyte & 0x7F) + 1;
|
||||||
//N + 1 bytes of data follows
|
for(i=0;i<bytecount;i++)
|
||||||
bytecount = (cmdbyte & 0x7F) + 1;
|
{
|
||||||
for(i=0;i<bytecount;i++)
|
finale_plot(fgetc(fp));
|
||||||
{
|
}
|
||||||
finale_plot(fgetc(fp));
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
else
|
//Repeat N + 3 of following byte
|
||||||
{
|
bytecount = (cmdbyte + 3);
|
||||||
//Repeat N + 3 of following byte
|
repeatbyte = fgetc(fp);
|
||||||
bytecount = (cmdbyte + 3);
|
for(i=0;i<bytecount;i++)
|
||||||
repeatbyte = fgetc(fp);
|
{
|
||||||
for(i=0;i<bytecount;i++)
|
finale_plot(repeatbyte);
|
||||||
{
|
}
|
||||||
finale_plot(repeatbyte);
|
}
|
||||||
}
|
|
||||||
}
|
} while(!finale_done);
|
||||||
|
|
||||||
} while(!finale_done);
|
fclose(fp);
|
||||||
|
}
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
|
|||||||
325
src/funcdefs.h
325
src/funcdefs.h
@@ -1,163 +1,162 @@
|
|||||||
/*check if the compiler is of C++*/
|
|
||||||
#ifdef __cplusplus
|
#ifndef __CG_FUNCDEFS_H__
|
||||||
extern "C" {
|
#define __CG_FUNCDEFS_H__
|
||||||
#endif
|
|
||||||
|
#include <string>
|
||||||
// gamedo.c
|
|
||||||
int gamedo_ScrollTriggers(int theplayer);
|
// gamedo.c
|
||||||
void gamedo_AnimatedTiles(void);
|
int gamedo_ScrollTriggers(int theplayer);
|
||||||
|
void gamedo_AnimatedTiles(void);
|
||||||
void gamedo_render_eraseobjects(void);
|
|
||||||
void gamedo_render_drawdebug(void);
|
void gamedo_render_eraseobjects(void);
|
||||||
void gamedo_render_erasedebug(void);
|
void gamedo_render_drawdebug(void);
|
||||||
void gamedo_fades(void);
|
void gamedo_render_erasedebug(void);
|
||||||
|
void gamedo_fades(void);
|
||||||
// gamepdo.c
|
|
||||||
|
// gamepdo.c
|
||||||
|
|
||||||
// gamepdowm.c
|
|
||||||
//void gamepdo_wm_HandlePlayer(int cp);
|
// gamepdowm.c
|
||||||
//void gamepdo_InertiaAndFriction_Y(int cp);
|
//void gamepdo_wm_HandlePlayer(int cp);
|
||||||
//void gamepdo_wm_AllowEnterLevel(int cp);
|
//void gamepdo_InertiaAndFriction_Y(int cp);
|
||||||
char wm_issolid(int xb, int yb, int *levels_completed);
|
//void gamepdo_wm_AllowEnterLevel(int cp);
|
||||||
|
char wm_issolid(int xb, int yb, int *levels_completed);
|
||||||
// game.c
|
|
||||||
//void SetGameOver(void);
|
// game.c
|
||||||
void overrun_detect(void);
|
//void SetGameOver(void);
|
||||||
void scrolltest(void);
|
void overrun_detect(void);
|
||||||
//void gameloop_initialize(void);
|
void scrolltest(void);
|
||||||
void give_keycard(int doortile, int p);
|
//void gameloop_initialize(void);
|
||||||
void take_keycard(int doortile, int p);
|
void give_keycard(int doortile, int p);
|
||||||
//void open_door(int doortile, int doorsprite, int mpx, int mpy, int cp, stCloneKeenPlus *pCKP)
|
void take_keycard(int doortile, int p);
|
||||||
void extralifeat(int p);
|
//void open_door(int doortile, int doorsprite, int mpx, int mpy, int cp, stCloneKeenPlus *pCKP)
|
||||||
char spawn_object(int x, int y, int otype);
|
void extralifeat(int p);
|
||||||
void common_enemy_ai(int o);
|
char spawn_object(int x, int y, int otype);
|
||||||
char hitdetect(int object1, int object2);
|
void common_enemy_ai(int o);
|
||||||
void freezeplayer(int theplayer);
|
char hitdetect(int object1, int object2);
|
||||||
void unregister_animtiles(int tile);
|
void freezeplayer(int theplayer);
|
||||||
//void endlevel(int success, stCloneKeenPlus *pCKP)
|
void unregister_animtiles(int tile);
|
||||||
char checkobjsolid(unsigned int x, unsigned int y, unsigned int cp);
|
//void endlevel(int success, stCloneKeenPlus *pCKP)
|
||||||
//void initsprites(stCloneKeenPlus *pCKP)
|
char checkobjsolid(unsigned int x, unsigned int y, unsigned int cp);
|
||||||
void CopyTileToSprite(int t, int s, int ntilestocopy, int transparent);
|
//void initsprites(stCloneKeenPlus *pCKP)
|
||||||
void GiveAnkh(int cp);
|
void CopyTileToSprite(int t, int s, int ntilestocopy, int transparent);
|
||||||
// map.c
|
void GiveAnkh(int cp);
|
||||||
void map_scroll_right(void);
|
// map.c
|
||||||
void map_scroll_left(void);
|
void map_scroll_right(void);
|
||||||
void map_scroll_down(void);
|
void map_scroll_left(void);
|
||||||
void map_scroll_up(void);
|
void map_scroll_down(void);
|
||||||
void map_draw_vstripe(unsigned int x, unsigned int mpx);
|
void map_scroll_up(void);
|
||||||
void map_draw_hstripe(unsigned int y, unsigned int mpy);
|
void map_draw_vstripe(unsigned int x, unsigned int mpx);
|
||||||
void nosb_map_draw_vstripe(unsigned int x, unsigned int mapx);
|
void map_draw_hstripe(unsigned int y, unsigned int mpy);
|
||||||
unsigned int getmaptileat(unsigned int x, unsigned int y);
|
void nosb_map_draw_vstripe(unsigned int x, unsigned int mapx);
|
||||||
unsigned int getlevelat(unsigned int x, unsigned int y);
|
unsigned int getmaptileat(unsigned int x, unsigned int y);
|
||||||
void drawmap(void);
|
unsigned int getlevelat(unsigned int x, unsigned int y);
|
||||||
void map_unregister_all_animtiles(void);
|
void drawmap(void);
|
||||||
void map_deanimate(int x, int y);
|
void map_unregister_all_animtiles(void);
|
||||||
int map_isanimated(int x, int y);
|
void map_deanimate(int x, int y);
|
||||||
void map_animate(int x, int y);
|
int map_isanimated(int x, int y);
|
||||||
char map_findobject(unsigned int obj, int *xout, int *yout);
|
void map_animate(int x, int y);
|
||||||
char map_findtile(unsigned int tile, int *xout, int *yout);
|
char map_findobject(unsigned int obj, int *xout, int *yout);
|
||||||
void map_redraw(void);
|
char map_findtile(unsigned int tile, int *xout, int *yout);
|
||||||
void map_chgtile(unsigned int x,unsigned int y, int newtile);
|
void map_redraw(void);
|
||||||
// dos\snddrv.c
|
void map_chgtile(unsigned int x,unsigned int y, int newtile);
|
||||||
void SoundDrv_Stop(void);
|
// dos\snddrv.c
|
||||||
void sound_do(void);
|
void SoundDrv_Stop(void);
|
||||||
void sound_play_stereo(int snd, char mode, short balance);
|
void sound_do(void);
|
||||||
void sound_play_stereo_from_coord(int snd, char mode, unsigned int xcoordinate);
|
void sound_play_stereo(int snd, char mode, short balance);
|
||||||
void sound_play(int snd, char mode);
|
void sound_play_stereo_from_coord(int snd, char mode, unsigned int xcoordinate);
|
||||||
char sound_is_playing(int snd);
|
void sound_play(int snd, char mode);
|
||||||
void sound_stop(int snd);
|
char sound_is_playing(int snd);
|
||||||
void sound_stop_all(void);
|
void sound_stop(int snd);
|
||||||
void sound_pause(void);
|
void sound_stop_all(void);
|
||||||
void sound_resume(void);
|
void sound_pause(void);
|
||||||
char sound_extraction_of_exe_files(char *inputpath, int episode);
|
void sound_resume(void);
|
||||||
|
char sound_extraction_of_exe_files(char *inputpath, int episode);
|
||||||
// graphics.c
|
|
||||||
void DrawBitmap(int xa, int ya, int b);
|
// graphics.c
|
||||||
void freemem(void);
|
void DrawBitmap(int xa, int ya, int b);
|
||||||
void Graphics_Stop(void);
|
void freemem(void);
|
||||||
void /*inline*/ sb_setpixel(int x, int y, unsigned char c);
|
void Graphics_Stop(void);
|
||||||
unsigned char sb_getpixel(int x, int y);
|
void /*inline*/ sb_setpixel(int x, int y, unsigned char c);
|
||||||
void drawtile(int x, int y, unsigned int t);
|
unsigned char sb_getpixel(int x, int y);
|
||||||
void drawtile_direct(int x, int y, unsigned int t);
|
void drawtile(int x, int y, unsigned int t);
|
||||||
void drawtilewithmask(int x, int y, unsigned int til, unsigned int tmask);
|
void drawtile_direct(int x, int y, unsigned int t);
|
||||||
void drawprioritytile(int x, int y, unsigned int til);
|
void drawtilewithmask(int x, int y, unsigned int til, unsigned int tmask);
|
||||||
void drawsprite_direct(int x, int y, unsigned int t);
|
void drawprioritytile(int x, int y, unsigned int til);
|
||||||
void drawsprite(int x, int y, unsigned int s, int objectnum);
|
void drawsprite_direct(int x, int y, unsigned int t);
|
||||||
void erasesprite(int x, int y, unsigned int s, int objectnum);
|
void drawsprite(int x, int y, unsigned int s, int objectnum);
|
||||||
void drawcharacter(int x, int y, int f);
|
void erasesprite(int x, int y, unsigned int s, int objectnum);
|
||||||
void sb_drawcharacter(int x, int y, int f);
|
void drawcharacter(int x, int y, int f);
|
||||||
void sb_drawcharacterwithmask(int x, int y, int f, char mask);
|
void sb_drawcharacter(int x, int y, int f);
|
||||||
void sb_drawcolorcharacter(int x, int y, int f, unsigned short colour, unsigned short bgcolour);
|
void sb_drawcharacterwithmask(int x, int y, int f, char mask);
|
||||||
void sb_drawcharacterinverse(int x, int y, int f);
|
void sb_drawcolorcharacter(int x, int y, int f, unsigned short colour, unsigned short bgcolour);
|
||||||
void save_area(int x1, int y1, int x2, int y2);
|
void sb_drawcharacterinverse(int x, int y, int f);
|
||||||
void restore_area(int x1, int y1, int x2, int y2);
|
void save_area(int x1, int y1, int x2, int y2);
|
||||||
void setvideomode(unsigned char mode);
|
void restore_area(int x1, int y1, int x2, int y2);
|
||||||
void addpal(int c, int r, int g, int b);
|
void setvideomode(unsigned char mode);
|
||||||
void pal_init(int dark);
|
void addpal(int c, int r, int g, int b);
|
||||||
void pal_fade(int fadeamt);
|
void pal_init(int dark);
|
||||||
void pal_apply(void);
|
void pal_fade(int fadeamt);
|
||||||
void font_draw(unsigned char *text, int xoff, int yoff, int highlight);
|
void pal_apply(void);
|
||||||
void sb_font_draw(const unsigned char *text, int xoff, int yoff);
|
void font_draw(unsigned char *text, int xoff, int yoff, int highlight);
|
||||||
void sb_mask_font_draw(unsigned char *text, int xoff, int yoff, char mask);
|
void sb_font_draw(const unsigned char *text, int xoff, int yoff);
|
||||||
void sb_color_font_draw(unsigned char *text, int xoff, int yoff, unsigned int colour, unsigned short bgcolour);
|
void sb_mask_font_draw(unsigned char *text, int xoff, int yoff, char mask);
|
||||||
void sb_font_draw_inverse(unsigned char *text, int xoff, int yoff);
|
void sb_color_font_draw(unsigned char *text, int xoff, int yoff, unsigned int colour, unsigned short bgcolour);
|
||||||
// viddrv.c
|
void sb_font_draw_inverse(unsigned char *text, int xoff, int yoff);
|
||||||
// fileio.c
|
// viddrv.c
|
||||||
//void addmaptile(unsigned int t, stCloneKeenPlus *pCKP);
|
// fileio.c
|
||||||
//void addenemytile(unsigned int t, stCloneKeenPlus *pCKP);
|
//void addmaptile(unsigned int t, stCloneKeenPlus *pCKP);
|
||||||
//unsigned int fgeti(FILE *fp);
|
//void addenemytile(unsigned int t, stCloneKeenPlus *pCKP);
|
||||||
//unsigned long fgetl(FILE *fp);
|
//unsigned int fgeti(FILE *fp);
|
||||||
//unsigned int loadmap(char *filename, char *path, int lvlnum, int isworldmap);
|
//unsigned long fgetl(FILE *fp);
|
||||||
#include "fileio.h"
|
//unsigned int loadmap(char *filename, char *path, int lvlnum, int isworldmap);
|
||||||
|
#include "fileio.h"
|
||||||
bool loadtileattributes(int episode, int version, unsigned char *filebuf);
|
|
||||||
int freestrings(void);
|
bool loadtileattributes(int episode, int version, unsigned char *filebuf);
|
||||||
char* getstring(const char *name);
|
int freestrings(void);
|
||||||
int GetStringAttribute(const char *stringName, const char *attrName);
|
std::string getstring(const std::string& name);
|
||||||
|
int GetStringAttribute(const std::string& stringName, const char *attrName);
|
||||||
// keydrv.c
|
|
||||||
char KeyDrv_Start(void);
|
// keydrv.c
|
||||||
void KeyDrv_Stop(void);
|
char KeyDrv_Start(void);
|
||||||
|
void KeyDrv_Stop(void);
|
||||||
// misc.c
|
|
||||||
void banner(void);
|
// misc.c
|
||||||
void dialogbox(int x1, int y1, int w, int h);
|
void banner(void);
|
||||||
void sb_dialogbox(int x1, int y1, int w, int h);
|
void dialogbox(int x1, int y1, int w, int h);
|
||||||
void statusbox(void);
|
void sb_dialogbox(int x1, int y1, int w, int h);
|
||||||
|
void statusbox(void);
|
||||||
int savegameiswm(char *fname);
|
|
||||||
void usage(void);
|
int savegameiswm(char *fname);
|
||||||
void radar(void);
|
void usage(void);
|
||||||
void SetAllCanSupportPlayer(int o, int state);
|
void radar(void);
|
||||||
void AllPlayersInvisible(void);
|
void SetAllCanSupportPlayer(int o, int state);
|
||||||
|
void AllPlayersInvisible(void);
|
||||||
// menu.c
|
|
||||||
int GetBitmapNumberFromName(const char *bmname);
|
// menu.c
|
||||||
|
int GetBitmapNumberFromName(const char *bmname);
|
||||||
|
|
||||||
// eseq_ep1.c
|
|
||||||
void addshipqueue(int cmd, int time, int flag1);
|
// eseq_ep1.c
|
||||||
|
void addshipqueue(int cmd, int time, int flag1);
|
||||||
// latch.c
|
|
||||||
//char latch_loadgraphics(int episode, char *path);
|
// latch.c
|
||||||
|
//char latch_loadgraphics(int episode, char *path);
|
||||||
// sglre.c
|
|
||||||
void sgrle_reset(void);
|
// sglre.c
|
||||||
void sgrle_compress(FILE *fp, unsigned char *ptr, unsigned long nbytes);
|
void sgrle_reset(void);
|
||||||
void sgrle_decompress(FILE *fp, unsigned char *ptr, unsigned long nbytes);
|
void sgrle_compress(FILE *fp, unsigned char *ptr, unsigned long nbytes);
|
||||||
unsigned char sgrle_get_next_byte(FILE *fp);
|
void sgrle_decompress(FILE *fp, unsigned char *ptr, unsigned long nbytes);
|
||||||
|
unsigned char sgrle_get_next_byte(FILE *fp);
|
||||||
// lz.c
|
|
||||||
char lz_decompress(FILE *lzfile, unsigned char *outbuffer);
|
// lz.c
|
||||||
|
char lz_decompress(FILE *lzfile, unsigned char *outbuffer);
|
||||||
// finale.c
|
|
||||||
void finale_draw(const char *filename, const char *path);
|
// finale.c
|
||||||
|
void finale_draw(const std::string& filename, const std::string& path);
|
||||||
// scalerx.c
|
|
||||||
//void scale2x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height);
|
// scalerx.c
|
||||||
|
//void scale2x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height);
|
||||||
/*check if the compiler is of C++*/
|
|
||||||
#ifdef __cplusplus
|
#endif
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
1497
src/gamedo.cpp
1497
src/gamedo.cpp
File diff suppressed because it is too large
Load Diff
@@ -22,9 +22,9 @@ CHQBitmap::~CHQBitmap() {
|
|||||||
if(m_blackscreen){ SDL_FreeSurface(m_blackscreen); m_blackscreen = NULL;}
|
if(m_blackscreen){ SDL_FreeSurface(m_blackscreen); m_blackscreen = NULL;}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHQBitmap::loadImage(const char *pFilename, int wsize, int hsize)
|
bool CHQBitmap::loadImage(const std::string& pFilename, int wsize, int hsize)
|
||||||
{
|
{
|
||||||
SDL_Surface *BitmapSurface = SDL_LoadBMP(pFilename);
|
SDL_Surface *BitmapSurface = SDL_LoadBMP(pFilename.c_str());
|
||||||
|
|
||||||
m_active = false;
|
m_active = false;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#define CHQBITMAP_H_
|
#define CHQBITMAP_H_
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class CHQBitmap {
|
class CHQBitmap {
|
||||||
public:
|
public:
|
||||||
@@ -17,7 +18,7 @@ public:
|
|||||||
|
|
||||||
void setScrollposition(unsigned int xpos, unsigned int ypos);
|
void setScrollposition(unsigned int xpos, unsigned int ypos);
|
||||||
void updateHQBitmap(SDL_Surface *m_surface, SDL_Rect *p_srcrect, SDL_Rect *p_dstrect);
|
void updateHQBitmap(SDL_Surface *m_surface, SDL_Rect *p_srcrect, SDL_Rect *p_dstrect);
|
||||||
bool loadImage(const char *pFilename, int wsize, int hsize);
|
bool loadImage(const std::string& pFilename, int wsize, int hsize);
|
||||||
void setAlphaBlend(Uint8 alpha);
|
void setAlphaBlend(Uint8 alpha);
|
||||||
void offsetAlphaBlend(Uint8 alpha);
|
void offsetAlphaBlend(Uint8 alpha);
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
CMusic::CMusic() {
|
CMusic::CMusic() {
|
||||||
playmode = PLAY_MODE_STOP;
|
playmode = PLAY_MODE_STOP;
|
||||||
music_buffer = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMusic::~CMusic() {
|
CMusic::~CMusic() {
|
||||||
@@ -21,8 +20,6 @@ CMusic::~CMusic() {
|
|||||||
|
|
||||||
int CMusic::load(SDL_AudioSpec AudioSpec, char *musicfile)
|
int CMusic::load(SDL_AudioSpec AudioSpec, char *musicfile)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
|
||||||
|
|
||||||
if(AudioSpec.format != 0)
|
if(AudioSpec.format != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -36,10 +33,10 @@ int CMusic::load(SDL_AudioSpec AudioSpec, char *musicfile)
|
|||||||
pOggAudio.sound_len=0;
|
pOggAudio.sound_len=0;
|
||||||
pOggAudio.sound_pos=0;
|
pOggAudio.sound_pos=0;
|
||||||
|
|
||||||
|
FILE *fp;
|
||||||
if((fp = fopen(musicfile,"rb")) == NULL)
|
if((fp = fopen(musicfile,"rb")) == NULL)
|
||||||
{
|
{
|
||||||
g_pLogFile->textOut(PURPLE,"Music Driver(): \"%s\". File does not exist!<br>", musicfile);
|
g_pLogFile->textOut(PURPLE,"Music Driver(): \"%s\". File does not exist!<br>", musicfile);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,8 +101,7 @@ void CMusic::unload(void)
|
|||||||
|
|
||||||
void CMusic::play(void)
|
void CMusic::play(void)
|
||||||
{
|
{
|
||||||
if(music_buffer)
|
playmode = PLAY_MODE_PLAY;
|
||||||
playmode = PLAY_MODE_PLAY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMusic::stop(void)
|
void CMusic::stop(void)
|
||||||
|
|||||||
@@ -11,17 +11,17 @@
|
|||||||
#include "../include/vorbis/oggsupport.h"
|
#include "../include/vorbis/oggsupport.h"
|
||||||
#include "../CLogFile.h"
|
#include "../CLogFile.h"
|
||||||
|
|
||||||
short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const char *soundfile)
|
short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const std::string& soundfile)
|
||||||
{
|
{
|
||||||
SDL_AudioSpec AudioFileSpec;
|
SDL_AudioSpec AudioFileSpec;
|
||||||
SDL_AudioCVT Audio_cvt;
|
SDL_AudioCVT Audio_cvt;
|
||||||
|
|
||||||
psound->sound_buffer = NULL;
|
psound->sound_buffer = NULL;
|
||||||
char buf[80];
|
std::string buf;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
sprintf(buf,"data/hqp/snd/%s.OGG",soundfile); // Start with OGG
|
buf = "data/hqp/snd/" + soundfile + ".OGG"; // Start with OGG
|
||||||
if((fp = fopen(buf,"rb")) != NULL)
|
if((fp = fopen(buf.c_str(),"rb")) != NULL)
|
||||||
{
|
{
|
||||||
#ifdef BUILD_WITH_OGG
|
#ifdef BUILD_WITH_OGG
|
||||||
if(openOGGSound(fp, &AudioFileSpec, AudioSpec->format, psound) != 0)
|
if(openOGGSound(fp, &AudioFileSpec, AudioSpec->format, psound) != 0)
|
||||||
@@ -29,38 +29,37 @@ short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const char *sou
|
|||||||
g_pLogFile->textOut(PURPLE,"OGG file could not be opened: \"%s\". The file was detected, but appears to be damaged. Trying to load the classical sound<br>", soundfile);
|
g_pLogFile->textOut(PURPLE,"OGG file could not be opened: \"%s\". The file was detected, but appears to be damaged. Trying to load the classical sound<br>", soundfile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
psound->enabled = true;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BUILD_WITH_OGG
|
#ifndef BUILD_WITH_OGG
|
||||||
g_pLogFile->textOut(PURPLE,"Sorry, OGG-Support is disabled!<br>");
|
g_pLogFile->textOut(PURPLE,"Sorry, OGG-Support is disabled!<br>");
|
||||||
sprintf(buf,"data/hqp/snd/%s.WAV",soundfile);
|
buf = "data/hqp/snd/"+ soundfile + ".WAV";
|
||||||
|
|
||||||
// Check, if it is a wav file or go back to classic sounds
|
// Check, if it is a wav file or go back to classic sounds
|
||||||
if (SDL_LoadWAV (buf, &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL)
|
if (SDL_LoadWAV (buf.c_str(), &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL)
|
||||||
{
|
{
|
||||||
g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sound<br>", buf);
|
g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sound<br>", buf.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
psound->enabled = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(buf,"data/hqp/snd/%s.WAV",soundfile);
|
buf = "data/hqp/snd/" + soundfile + ".WAV";
|
||||||
|
|
||||||
// Check, if it is a wav file or go back to classic sounds
|
// Check, if it is a wav file or go back to classic sounds
|
||||||
if (SDL_LoadWAV (buf, &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL)
|
if (SDL_LoadWAV (buf.c_str(), &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL)
|
||||||
{
|
{
|
||||||
g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sounds<br>", buf);
|
g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sounds<br>", buf.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
psound->sound_pos = 0;
|
psound->sound_pos = 0;
|
||||||
g_pLogFile->textOut(PURPLE,"File \"%s\" opened successfully!<br>", buf);
|
g_pLogFile->textOut(PURPLE,"File \"%s\" opened successfully!<br>", buf.c_str());
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
/* Build AudioCVT (This is needed for the conversion from one format to the one used in the game)*/
|
/* Build AudioCVT (This is needed for the conversion from one format to the one used in the game)*/
|
||||||
|
|||||||
@@ -5,15 +5,21 @@
|
|||||||
* Author: gerstrong
|
* Author: gerstrong
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <SDL.h>
|
#ifndef __CG_HQ_SOUND_H__
|
||||||
|
#define __CG_HQ_SOUND_H__
|
||||||
|
|
||||||
typedef struct stHQSound
|
#include <SDL.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
struct stHQSound
|
||||||
{
|
{
|
||||||
Uint8 *sound_buffer;
|
Uint8 *sound_buffer;
|
||||||
Uint32 sound_len;
|
Uint32 sound_len;
|
||||||
int sound_pos;
|
int sound_pos;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
} stHQSound;
|
};
|
||||||
|
|
||||||
short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const char *soundfile);
|
short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const std::string& soundfile);
|
||||||
void HQSndDrv_Unload(stHQSound *psound);
|
void HQSndDrv_Unload(stHQSound *psound);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
|
#ifndef __CG_DECLARATIONS_H__
|
||||||
|
#define __CG_DECLARATIONS_H__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <SDL.h>
|
||||||
|
|
||||||
#define MAX_COMMANDS 8
|
#define MAX_COMMANDS 8
|
||||||
#define MAX_SOUND_LENGTH 1024
|
#define MAX_SOUND_LENGTH 1024
|
||||||
#define MAX_SOUNDS 50
|
#define MAX_SOUNDS 50
|
||||||
#define MAX_STRING_LENGTH 256
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_NUMBER_OF_FILES 100
|
#define MAX_NUMBER_OF_FILES 100
|
||||||
@@ -68,10 +72,11 @@ typedef struct stControl
|
|||||||
|
|
||||||
typedef struct stGameData
|
typedef struct stGameData
|
||||||
{
|
{
|
||||||
char DataDirectory[MAX_STRING_LENGTH];
|
std::string DataDirectory;
|
||||||
short Episode;
|
short Episode;
|
||||||
char Name[MAX_STRING_LENGTH];
|
std::string Name;
|
||||||
char FileList[MAX_NUMBER_OF_FILES][MAX_STRING_LENGTH];
|
std::string FileList[MAX_NUMBER_OF_FILES];
|
||||||
|
stGameData() : Episode(0) {}
|
||||||
} stGameData;
|
} stGameData;
|
||||||
|
|
||||||
|
|
||||||
@@ -106,3 +111,5 @@ typedef struct stNewPlayer
|
|||||||
{
|
{
|
||||||
stCommand Command;
|
stCommand Command;
|
||||||
} stNewPlayer;
|
} stNewPlayer;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -5,10 +5,17 @@
|
|||||||
* Author: gerstrong
|
* Author: gerstrong
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __CG_ESEQ_EP2_H__
|
||||||
|
#define __CG_ESEQ_EP2_H__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
struct stCloneKeenPlus;
|
||||||
|
|
||||||
int eseq2_LimpsHome(stCloneKeenPlus *pCKP);
|
int eseq2_LimpsHome(stCloneKeenPlus *pCKP);
|
||||||
int eseq2_TantalusRay(stCloneKeenPlus *pCKP);
|
int eseq2_TantalusRay(stCloneKeenPlus *pCKP);
|
||||||
void eseq2_vibrate(stCloneKeenPlus *pCKP);
|
void eseq2_vibrate(stCloneKeenPlus *pCKP);
|
||||||
int eseq2_HeadsForEarth(stCloneKeenPlus *pCKP);
|
int eseq2_HeadsForEarth(stCloneKeenPlus *pCKP);
|
||||||
int eseq2_SnowedOutside(stCloneKeenPlus *pCKP);
|
int eseq2_SnowedOutside(stCloneKeenPlus *pCKP);
|
||||||
void eseq_showmsg(char *text, int boxleft, int boxtop, int boxwidth, int boxheight, char autodismiss, stCloneKeenPlus *pCKP);
|
void eseq_showmsg(const std::string& text, int boxleft, int boxtop, int boxwidth, int boxheight, char autodismiss, stCloneKeenPlus *pCKP);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -5,10 +5,17 @@
|
|||||||
* Author: gerstrong
|
* Author: gerstrong
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned int loadmap(char filename[MAX_STRING_LENGTH], char *path, int lvlnum, int isworldmap, stCloneKeenPlus *pCKP);
|
#ifndef __CG_FILEIO_H__
|
||||||
|
#define __CG_FILEIO_H__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
unsigned int loadmap(const std::string& filename, const std::string& path, int lvlnum, int isworldmap, stCloneKeenPlus *pCKP);
|
||||||
void addmaptile(unsigned int t);
|
void addmaptile(unsigned int t);
|
||||||
void addenemytile(unsigned int t, stCloneKeenPlus *pCKP);
|
void addenemytile(unsigned int t, stCloneKeenPlus *pCKP);
|
||||||
short checkConsistencyofGameData(stGameData *p_GameData);
|
short checkConsistencyofGameData(stGameData *p_GameData);
|
||||||
void formatPathString(char *output, const char *path);
|
std::string formatPathString(const std::string& path);
|
||||||
bool renameFilenamesLowerCase(const char *dir_name);
|
bool renameFilenamesLowerCase(const char *dir_name);
|
||||||
void assignChangeTileAttribute(stTile *tile, int episode);
|
void assignChangeTileAttribute(stTile *tile, int episode);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -5,4 +5,11 @@
|
|||||||
* Author: gerstrong
|
* Author: gerstrong
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int readStoryText(char **ptext, int episode, char *path);
|
#ifndef __CG_STORY_H__
|
||||||
|
#define __CG_STORY_H__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
int readStoryText(char **ptext, int episode, const std::string& path);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
1728
src/keen.h
1728
src/keen.h
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
CloneKeen 2003-2005 Caitlin Shaw
|
CloneKeen 2003-2005 Caitlin Shaw
|
||||||
CloneKeenPlus 2008-2009 Gerstrong
|
CloneKeenPlus 2008-2009 Gerstrong
|
||||||
Commander Genius 2009 Tulip, Pickle, DaVince and Albert
|
Commander Genius 2009 Tulip, Pickle and DaVince
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "keen.h"
|
#include "keen.h"
|
||||||
@@ -574,6 +574,7 @@ demoHeaderCorrupt: ;
|
|||||||
short readCommandLine(int argc, char *argv[], stCloneKeenPlus *pCKP)
|
short readCommandLine(int argc, char *argv[], stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
static const int MAX_STRING_LENGTH = 256;
|
||||||
char tempbuf[MAX_STRING_LENGTH];
|
char tempbuf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2739
src/misc.cpp
2739
src/misc.cpp
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@
|
|||||||
* Author: gerstrong
|
* Author: gerstrong
|
||||||
*/
|
*/
|
||||||
#include "COpenGL.h"
|
#include "COpenGL.h"
|
||||||
|
#include "CVideoDriver.h"
|
||||||
#include "../CLogFile.h"
|
#include "../CLogFile.h"
|
||||||
|
|
||||||
#define GAME_STD_WIDTH 320
|
#define GAME_STD_WIDTH 320
|
||||||
@@ -115,7 +116,7 @@ void COpenGL::render(void)
|
|||||||
//Clear the screen
|
//Clear the screen
|
||||||
glClear(GL_COLOR_BUFFER_BIT); // Clear The Screen
|
glClear(GL_COLOR_BUFFER_BIT); // Clear The Screen
|
||||||
|
|
||||||
SDL_LockSurface(m_blitsurface);
|
LockSurface(m_blitsurface);
|
||||||
|
|
||||||
if(m_ScaleX == 2) //Scale 2x
|
if(m_ScaleX == 2) //Scale 2x
|
||||||
{
|
{
|
||||||
@@ -157,7 +158,7 @@ void COpenGL::render(void)
|
|||||||
glVertex3f (0.0, 1.0, 0.0);
|
glVertex3f (0.0, 1.0, 0.0);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
SDL_UnlockSurface(m_blitsurface);
|
UnlockSurface(m_blitsurface);
|
||||||
|
|
||||||
// Reset (Position?)
|
// Reset (Position?)
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ char tempbuf[80];
|
|||||||
#else
|
#else
|
||||||
sprintf(tempbuf, "FPS: %03d", fps);
|
sprintf(tempbuf, "FPS: %03d", fps);
|
||||||
#endif
|
#endif
|
||||||
g_pGraphics->drawFont( (unsigned char *) tempbuf, 320-3-(strlen( (char *) tempbuf)<<3), 3, 1);
|
g_pGraphics->drawFont( tempbuf, 320-3-(strlen( (char *) tempbuf)<<3), 3, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_screen();
|
update_screen();
|
||||||
@@ -499,11 +499,11 @@ void CVideoDriver::update_screen(void)
|
|||||||
|
|
||||||
mp_OpenGL->render();
|
mp_OpenGL->render();
|
||||||
|
|
||||||
SDL_LockSurface(FGLayerSurface);
|
LockSurface(FGLayerSurface);
|
||||||
// Flush the layers
|
// Flush the layers
|
||||||
memset(FGLayerSurface->pixels,SDL_MapRGB(FGLayerSurface->format, 0, 0, 0),
|
memset(FGLayerSurface->pixels,SDL_MapRGB(FGLayerSurface->format, 0, 0, 0),
|
||||||
GAME_STD_WIDTH*GAME_STD_HEIGHT*FGLayerSurface->format->BytesPerPixel);
|
GAME_STD_WIDTH*GAME_STD_HEIGHT*FGLayerSurface->format->BytesPerPixel);
|
||||||
SDL_UnlockSurface(FGLayerSurface);
|
UnlockSurface(FGLayerSurface);
|
||||||
}
|
}
|
||||||
else // No OpenGL but Software Rendering
|
else // No OpenGL but Software Rendering
|
||||||
{
|
{
|
||||||
@@ -514,8 +514,8 @@ void CVideoDriver::update_screen(void)
|
|||||||
// another offscreen buffer, and must now stretchblit it to the screen
|
// another offscreen buffer, and must now stretchblit it to the screen
|
||||||
if (Zoom == 1 && m_Resolution.width != 320 )
|
if (Zoom == 1 && m_Resolution.width != 320 )
|
||||||
{
|
{
|
||||||
SDL_LockSurface(BlitSurface);
|
LockSurface(BlitSurface);
|
||||||
SDL_LockSurface(screen);
|
LockSurface(screen);
|
||||||
|
|
||||||
if(Filtermode == 0)
|
if(Filtermode == 0)
|
||||||
{
|
{
|
||||||
@@ -527,13 +527,13 @@ void CVideoDriver::update_screen(void)
|
|||||||
g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter<br>");
|
g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter<br>");
|
||||||
Filtermode = 0;
|
Filtermode = 0;
|
||||||
}
|
}
|
||||||
SDL_UnlockSurface(screen);
|
UnlockSurface(screen);
|
||||||
SDL_UnlockSurface(BlitSurface);
|
UnlockSurface(BlitSurface);
|
||||||
}
|
}
|
||||||
if (Zoom == 2)
|
if (Zoom == 2)
|
||||||
{
|
{
|
||||||
SDL_LockSurface(BlitSurface);
|
LockSurface(BlitSurface);
|
||||||
SDL_LockSurface(screen);
|
LockSurface(screen);
|
||||||
|
|
||||||
if(Filtermode == 0)
|
if(Filtermode == 0)
|
||||||
{
|
{
|
||||||
@@ -551,13 +551,13 @@ void CVideoDriver::update_screen(void)
|
|||||||
Filtermode = 0;
|
Filtermode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_UnlockSurface(screen);
|
UnlockSurface(screen);
|
||||||
SDL_UnlockSurface(BlitSurface);
|
UnlockSurface(BlitSurface);
|
||||||
}
|
}
|
||||||
else if (Zoom == 3)
|
else if (Zoom == 3)
|
||||||
{
|
{
|
||||||
SDL_LockSurface(BlitSurface);
|
LockSurface(BlitSurface);
|
||||||
SDL_LockSurface(screen);
|
LockSurface(screen);
|
||||||
|
|
||||||
if(Filtermode == 0)
|
if(Filtermode == 0)
|
||||||
{
|
{
|
||||||
@@ -579,13 +579,13 @@ void CVideoDriver::update_screen(void)
|
|||||||
g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter<br>");
|
g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter<br>");
|
||||||
Filtermode = 0;
|
Filtermode = 0;
|
||||||
}
|
}
|
||||||
SDL_UnlockSurface(screen);
|
UnlockSurface(screen);
|
||||||
SDL_UnlockSurface(BlitSurface);
|
UnlockSurface(BlitSurface);
|
||||||
}
|
}
|
||||||
else if (Zoom == 4)
|
else if (Zoom == 4)
|
||||||
{
|
{
|
||||||
SDL_LockSurface(BlitSurface);
|
LockSurface(BlitSurface);
|
||||||
SDL_LockSurface(screen);
|
LockSurface(screen);
|
||||||
|
|
||||||
if(Filtermode == 0)
|
if(Filtermode == 0)
|
||||||
{
|
{
|
||||||
@@ -612,18 +612,18 @@ void CVideoDriver::update_screen(void)
|
|||||||
g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter<br>");
|
g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter<br>");
|
||||||
Filtermode = 0;
|
Filtermode = 0;
|
||||||
}
|
}
|
||||||
SDL_UnlockSurface(screen);
|
UnlockSurface(screen);
|
||||||
SDL_UnlockSurface(BlitSurface);
|
UnlockSurface(BlitSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Flip(screen);
|
SDL_Flip(screen);
|
||||||
//SDL_UpdateRect(screen, screenrect.x, screenrect.y, screenrect.w, screenrect.h);
|
//SDL_UpdateRect(screen, screenrect.x, screenrect.y, screenrect.w, screenrect.h);
|
||||||
|
|
||||||
SDL_LockSurface(FGLayerSurface);
|
LockSurface(FGLayerSurface);
|
||||||
// Flush the layers
|
// Flush the layers
|
||||||
memset(FGLayerSurface->pixels,SDL_MapRGB(FGLayerSurface->format, 0, 0, 0),
|
memset(FGLayerSurface->pixels,SDL_MapRGB(FGLayerSurface->format, 0, 0, 0),
|
||||||
GAME_STD_WIDTH*GAME_STD_HEIGHT*FGLayerSurface->format->BytesPerPixel);
|
GAME_STD_WIDTH*GAME_STD_HEIGHT*FGLayerSurface->format->BytesPerPixel);
|
||||||
SDL_UnlockSurface(FGLayerSurface);
|
UnlockSurface(FGLayerSurface);
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -765,7 +765,7 @@ int y;
|
|||||||
y = CONSOLE_MESSAGE_Y;
|
y = CONSOLE_MESSAGE_Y;
|
||||||
for(i=0;i<NumConsoleMessages;i++)
|
for(i=0;i<NumConsoleMessages;i++)
|
||||||
{
|
{
|
||||||
g_pGraphics->drawFont( (unsigned char *) cmsg[i].msg, CONSOLE_MESSAGE_X, y, 1);
|
g_pGraphics->drawFont( cmsg[i].msg, CONSOLE_MESSAGE_X, y, 1);
|
||||||
y += CONSOLE_MESSAGE_SPACING;
|
y += CONSOLE_MESSAGE_SPACING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,17 @@ struct st_resolution
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <list>
|
#include <list>
|
||||||
using namespace std;
|
|
||||||
|
inline bool LockSurface(SDL_Surface * bmp) {
|
||||||
|
if (SDL_MUSTLOCK(bmp))
|
||||||
|
return SDL_LockSurface(bmp) != -1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void UnlockSurface(SDL_Surface * bmp) {
|
||||||
|
if (SDL_MUSTLOCK(bmp))
|
||||||
|
SDL_UnlockSurface(bmp);
|
||||||
|
}
|
||||||
|
|
||||||
class CVideoDriver : public CSingleton<CVideoDriver>
|
class CVideoDriver : public CSingleton<CVideoDriver>
|
||||||
{
|
{
|
||||||
@@ -99,8 +109,8 @@ private:
|
|||||||
|
|
||||||
st_resolution m_Resolution;
|
st_resolution m_Resolution;
|
||||||
|
|
||||||
list<st_resolution> m_Resolutionlist;
|
std::list<st_resolution> m_Resolutionlist;
|
||||||
list<st_resolution> :: iterator m_Resolution_pos;
|
std::list<st_resolution> :: iterator m_Resolution_pos;
|
||||||
|
|
||||||
unsigned int Mode;
|
unsigned int Mode;
|
||||||
bool Fullscreen;
|
bool Fullscreen;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "../../hqp/CMusic.h"
|
#include "../../hqp/CMusic.h"
|
||||||
#include "../../vorticon/sounds.h"
|
#include "../../vorticon/sounds.h"
|
||||||
#include "../../fileio/CExeFile.h"
|
#include "../../fileio/CExeFile.h"
|
||||||
|
#include "../../StringUtils.h"
|
||||||
|
|
||||||
#define SAFE_DELETE_ARRAY(x) if(x) delete[] x; x=NULL
|
#define SAFE_DELETE_ARRAY(x) if(x) delete[] x; x=NULL
|
||||||
|
|
||||||
@@ -44,7 +45,7 @@ CSound::~CSound() {
|
|||||||
|
|
||||||
bool CSound::init(void)
|
bool CSound::init(void)
|
||||||
{
|
{
|
||||||
char name[MAX_STRING_LENGTH];
|
char name[256];
|
||||||
SDL_AudioSpec *desired, *obtained;
|
SDL_AudioSpec *desired, *obtained;
|
||||||
|
|
||||||
desired = &AudioSpec;
|
desired = &AudioSpec;
|
||||||
@@ -297,14 +298,14 @@ playsound: ;
|
|||||||
m_soundchannel[chnl].setupSound((unsigned short)snd, 0, true, WAVE_IN, 0, (mode==PLAY_FORCE) ? true : false );
|
m_soundchannel[chnl].setupSound((unsigned short)snd, 0, true, WAVE_IN, 0, (mode==PLAY_FORCE) ? true : false );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSound::loadSoundData(unsigned short Episode, char *DataDirectory)
|
bool CSound::loadSoundData(unsigned short Episode, const std::string& DataDirectory)
|
||||||
{
|
{
|
||||||
if(!m_active) return false;
|
if(!m_active) return false;
|
||||||
|
|
||||||
char *path;
|
std::string path;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
char soundfile[80];
|
std::string soundfile;
|
||||||
char buf[256];
|
std::string buf;
|
||||||
|
|
||||||
if(m_soundslot) delete[] m_soundslot;
|
if(m_soundslot) delete[] m_soundslot;
|
||||||
m_soundslot = new CSoundSlot[MAX_SOUNDS];
|
m_soundslot = new CSoundSlot[MAX_SOUNDS];
|
||||||
@@ -318,21 +319,16 @@ bool CSound::loadSoundData(unsigned short Episode, char *DataDirectory)
|
|||||||
|
|
||||||
g_pLogFile->ftextOut("sound_load_all(): loading all sounds...<br>");
|
g_pLogFile->ftextOut("sound_load_all(): loading all sounds...<br>");
|
||||||
|
|
||||||
char buffer[256];
|
soundfile = formatPathString(path) + "sounds.ck" + itoa(Episode);
|
||||||
|
|
||||||
formatPathString(buffer,path);
|
|
||||||
|
|
||||||
sprintf(soundfile, "%ssounds.ck%d", buffer,Episode);
|
|
||||||
|
|
||||||
FILE *p_file;
|
FILE *p_file;
|
||||||
|
|
||||||
if( ( p_file = fopen(soundfile,"rb") ) == NULL )
|
if( ( p_file = fopen(soundfile.c_str(),"rb") ) == NULL )
|
||||||
{
|
{
|
||||||
formatPathString(buffer,path);
|
|
||||||
|
buf = "keen" + itoa(Episode) + ".exe";
|
||||||
sprintf(buf,"keen%d.exe",Episode);
|
g_pLogFile->ftextOut("sound_load_all(): \"%s\" was not found in the data directory. Looking for \"%s\" in \"%s\" and trying to extract this file<br>", soundfile.c_str(), buf.c_str(), formatPathString(path).c_str());
|
||||||
g_pLogFile->ftextOut("sound_load_all(): \"%s\" was not found in the data directory. Looking for \"%s\" in \"%s\" and trying to extract this file<br>", soundfile, buf, buffer);
|
extractOfExeFile(formatPathString(path), Episode);
|
||||||
extractOfExeFile(buffer, Episode);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fclose(p_file);
|
fclose(p_file);
|
||||||
@@ -409,18 +405,16 @@ bool CSound::loadSoundData(unsigned short Episode, char *DataDirectory)
|
|||||||
the sound data.
|
the sound data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char CSound::extractOfExeFile(char *inputpath, int episode)
|
char CSound::extractOfExeFile(const std::string& inputpath, int episode)
|
||||||
{
|
{
|
||||||
const char *outputfname;
|
std::string outputfname;
|
||||||
int bit_count;
|
int bit_count;
|
||||||
int pos, sounds_start, sounds_end, ret = 0;
|
int pos, sounds_start, sounds_end, ret = 0;
|
||||||
char buffer[MAX_STRING_LENGTH];
|
std::string buffer;
|
||||||
char inputfname[MAX_STRING_LENGTH];
|
std::string inputfname;
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
bit_count = 0;
|
bit_count = 0;
|
||||||
memset(buffer,0, MAX_STRING_LENGTH*sizeof(char));
|
|
||||||
memset(inputfname,0, MAX_STRING_LENGTH*sizeof(char));
|
|
||||||
|
|
||||||
// Set Offsets. Episode 1 already provides this
|
// Set Offsets. Episode 1 already provides this
|
||||||
if (episode == 2)
|
if (episode == 2)
|
||||||
@@ -437,7 +431,7 @@ char CSound::extractOfExeFile(char *inputpath, int episode)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_pLogFile->ftextOut("Error: Unknown keen executable name: %s<br>", inputfname);
|
g_pLogFile->ftextOut("Error: Unknown keen executable name: %s<br>", inputfname.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,7 +440,7 @@ char CSound::extractOfExeFile(char *inputpath, int episode)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
FILE *fout;
|
FILE *fout;
|
||||||
if(!(fout = fopen(outputfname,"wb"))) ret = 1;
|
if(!(fout = fopen(outputfname.c_str(),"wb"))) ret = 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fwrite( ExeFile->getData()+sounds_start, 1, (sounds_end-sounds_start), fout);
|
fwrite( ExeFile->getData()+sounds_start, 1, (sounds_end-sounds_start), fout);
|
||||||
|
|||||||
@@ -11,10 +11,12 @@
|
|||||||
#include "../../CSingleton.h"
|
#include "../../CSingleton.h"
|
||||||
#define g_pSound CSound::Get()
|
#define g_pSound CSound::Get()
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include "CSoundChannel.h"
|
#include "CSoundChannel.h"
|
||||||
#include "CSoundSlot.h"
|
#include "CSoundSlot.h"
|
||||||
|
|
||||||
|
|
||||||
class CSound : public CSingleton<CSound>
|
class CSound : public CSingleton<CSound>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -23,11 +25,11 @@ public:
|
|||||||
|
|
||||||
bool init(void);
|
bool init(void);
|
||||||
void stop(void);
|
void stop(void);
|
||||||
bool loadSoundData(unsigned short Episode, char *DataDirectory);
|
bool loadSoundData(unsigned short Episode, const std::string& DataDirectory);
|
||||||
void stopAllSounds(void);
|
void stopAllSounds(void);
|
||||||
|
|
||||||
bool forcedisPlaying(void);
|
bool forcedisPlaying(void);
|
||||||
char sound_load_all(const char *path);
|
char sound_load_all(const std::string& path);
|
||||||
void transform_into_logaritmic_sound(int *pcmstream, int len);
|
void transform_into_logaritmic_sound(int *pcmstream, int len);
|
||||||
void callback(void *unused, Uint8 *stream, int len);
|
void callback(void *unused, Uint8 *stream, int len);
|
||||||
void pauseSound(void);
|
void pauseSound(void);
|
||||||
@@ -44,7 +46,7 @@ public:
|
|||||||
|
|
||||||
void setSoundmode(int freq, bool stereo);
|
void setSoundmode(int freq, bool stereo);
|
||||||
|
|
||||||
char extractOfExeFile(char *inputpath, int episode); // This is a special funktion. It doesn't belong here!
|
char extractOfExeFile(const std::string& inputpath, int episode); // This is a special funktion. It doesn't belong here!
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSoundChannel *m_soundchannel;
|
CSoundChannel *m_soundchannel;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ CSoundSlot::~CSoundSlot() {
|
|||||||
|
|
||||||
// loads sound searchname from file fname, into sounds[] entry loadnum
|
// loads sound searchname from file fname, into sounds[] entry loadnum
|
||||||
// return value is false on failure
|
// return value is false on failure
|
||||||
bool CSoundSlot::loadSound(const char *fname, const char *searchname, unsigned int loadnum)
|
bool CSoundSlot::loadSound(const std::string& fname, const std::string& searchname, unsigned int loadnum)
|
||||||
{
|
{
|
||||||
// Unload the sound if any was previously loaded
|
// Unload the sound if any was previously loaded
|
||||||
if(m_sounddata){ delete[] m_sounddata; m_sounddata = NULL; }
|
if(m_sounddata){ delete[] m_sounddata; m_sounddata = NULL; }
|
||||||
@@ -57,10 +57,10 @@ bool CSoundSlot::loadSound(const char *fname, const char *searchname, unsigned i
|
|||||||
for(i=0;i<12;i++)
|
for(i=0;i<12;i++)
|
||||||
name[i] = 0;
|
name[i] = 0;
|
||||||
|
|
||||||
fp = fopen(fname, "rb");
|
fp = fopen(fname.c_str(), "rb");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
g_pLogFile->ftextOut("loadSound : Sounds file '%s' unopenable attempting load of '%s'<br>", fname, searchname);
|
g_pLogFile->ftextOut("loadSound : Sounds file '%s' unopenable attempting load of '%s'<br>", fname.c_str(), searchname.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,12 +75,12 @@ bool CSoundSlot::loadSound(const char *fname, const char *searchname, unsigned i
|
|||||||
priority = fgetc(fp);
|
priority = fgetc(fp);
|
||||||
garbage = fgetc(fp);
|
garbage = fgetc(fp);
|
||||||
for(i=0;i<12;i++) name[i] = fgetc(fp);
|
for(i=0;i<12;i++) name[i] = fgetc(fp);
|
||||||
if (!strcmp(name, searchname)) goto sound_found;
|
if (name == searchname) goto sound_found;
|
||||||
|
|
||||||
curheader += 0x10;
|
curheader += 0x10;
|
||||||
}
|
}
|
||||||
// sound could not be found
|
// sound could not be found
|
||||||
g_pLogFile->ftextOut("loadSound : sound %s could not be found in %s.<br>", searchname, fname);
|
g_pLogFile->ftextOut("loadSound : sound %s could not be found in %s.<br>", searchname.c_str(), fname.c_str());
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ bool CSoundSlot::loadSound(const char *fname, const char *searchname, unsigned i
|
|||||||
|
|
||||||
memcpy(m_sounddata, tempstack, m_soundlength*sizeof(unsigned int));
|
memcpy(m_sounddata, tempstack, m_soundlength*sizeof(unsigned int));
|
||||||
|
|
||||||
g_pLogFile->ftextOut("loadSound : loaded sound %s of %d bytes.<br>", searchname, m_soundlength);
|
g_pLogFile->ftextOut("loadSound : loaded sound %s of %d bytes.<br>", searchname.c_str(), m_soundlength);
|
||||||
m_hqsound.enabled = false;
|
m_hqsound.enabled = false;
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public:
|
|||||||
CSoundSlot();
|
CSoundSlot();
|
||||||
virtual ~CSoundSlot();
|
virtual ~CSoundSlot();
|
||||||
|
|
||||||
bool loadSound(const char *fname, const char *searchname, unsigned int loadnum);
|
bool loadSound(const std::string& fname, const std::string& searchname, unsigned int loadnum);
|
||||||
|
|
||||||
void setpAudioSpec(SDL_AudioSpec *pAudioSpec){ m_pAudioSpec = pAudioSpec; }
|
void setpAudioSpec(SDL_AudioSpec *pAudioSpec){ m_pAudioSpec = pAudioSpec; }
|
||||||
|
|
||||||
|
|||||||
@@ -64,14 +64,11 @@ short openOGGSound(FILE *fp, SDL_AudioSpec *pspec, Uint16 format, stHQSound *pso
|
|||||||
|
|
||||||
psound->sound_len = buffer.size();
|
psound->sound_len = buffer.size();
|
||||||
|
|
||||||
//psound->sound_buffer = new Uint8[psound->sound_len];
|
psound->sound_buffer = new Uint8[psound->sound_len];
|
||||||
psound->sound_buffer = (Uint8*) malloc(psound->sound_len);
|
for(Uint32 i=0; i<psound->sound_len ; i++ )
|
||||||
/*for(Uint32 i=0; i<psound->sound_len ; i++ )
|
|
||||||
{
|
{
|
||||||
memcpy( &(psound->sound_buffer[i]), &(buffer[i]), 1);
|
memcpy( &(psound->sound_buffer[i]), &(buffer[i]), 1);
|
||||||
}*/
|
}
|
||||||
memcpy( psound->sound_buffer, buffer.data(), psound->sound_len );
|
|
||||||
buffer.clear();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ void CCredits::Render(stCloneKeenPlus *pCKP)
|
|||||||
|
|
||||||
for(int j=0 ; j<51 ; j++)
|
for(int j=0 ; j<51 ; j++)
|
||||||
if(scrolly+(j<<3) > -8 && scrolly+(j<<3) < 200)
|
if(scrolly+(j<<3) > -8 && scrolly+(j<<3) < 200)
|
||||||
g_pGraphics->sb_font_draw_inverse( (unsigned char*) scrolltext[j], mid[j], scrolly+(j<<3));
|
g_pGraphics->sb_font_draw_inverse( scrolltext[j], mid[j], scrolly+(j<<3));
|
||||||
|
|
||||||
if( g_pInput->getPressedAnyCommand() )
|
if( g_pInput->getPressedAnyCommand() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,10 +77,9 @@ void CDialog::addSeparator(void)
|
|||||||
addOptionText("");
|
addOptionText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialog::addOptionText(const char *text)
|
void CDialog::addOptionText(const std::string& text)
|
||||||
{
|
{
|
||||||
char buf[TEXT_LENGTH];
|
std::string buf;
|
||||||
memset(buf,0,TEXT_LENGTH);
|
|
||||||
// This algorithm is similar to one pointer session and
|
// This algorithm is similar to one pointer session and
|
||||||
// list implementation. TextList is the head.
|
// list implementation. TextList is the head.
|
||||||
if(OptionTextList == NULL)
|
if(OptionTextList == NULL)
|
||||||
@@ -88,22 +87,21 @@ void CDialog::addOptionText(const char *text)
|
|||||||
OptionTextList = new stTextList;
|
OptionTextList = new stTextList;
|
||||||
OptionTextList->nextElement = NULL;
|
OptionTextList->nextElement = NULL;
|
||||||
|
|
||||||
memset(OptionTextList->text,0,TEXT_LENGTH);
|
OptionTextList->text = "";
|
||||||
|
|
||||||
strcpy(buf,text);
|
buf = text;
|
||||||
|
|
||||||
unsigned int length;
|
size_t length = buf.length();
|
||||||
length = strlen(buf);
|
|
||||||
|
|
||||||
// before the text is copied, check if that string is too long.
|
// before the text is copied, check if that string is too long.
|
||||||
if(length > w-4)
|
if(length > w-4)
|
||||||
{
|
{
|
||||||
copy(text,text+w-7,OptionTextList->text);
|
OptionTextList->text = text.substr(0, w-7);
|
||||||
strcat(OptionTextList->text,"...");
|
OptionTextList->text += "...";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(OptionTextList->text,text);
|
OptionTextList->text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
number_of_options = 1;
|
number_of_options = 1;
|
||||||
@@ -124,41 +122,41 @@ void CDialog::addOptionText(const char *text)
|
|||||||
|
|
||||||
curTextList = (stTextList*) curTextList->nextElement;
|
curTextList = (stTextList*) curTextList->nextElement;
|
||||||
|
|
||||||
memset(curTextList->text,0, TEXT_LENGTH);
|
curTextList->text = "";
|
||||||
|
|
||||||
number_of_options++;
|
number_of_options++;
|
||||||
|
|
||||||
strcpy(buf,text);
|
buf = text;
|
||||||
|
|
||||||
unsigned int length;
|
size_t length = buf.length();
|
||||||
length = strlen(buf);
|
|
||||||
|
|
||||||
// before the text is copied, check if that string is too long.
|
// before the text is copied, check if that string is too long.
|
||||||
if(length > w-4)
|
if(length > w-4)
|
||||||
{
|
{
|
||||||
copy(text,text+w-7,curTextList->text);
|
curTextList->text = text.substr(0, w-7);
|
||||||
strcat(curTextList->text,"...");
|
curTextList->text += "...";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(curTextList->text,text);
|
curTextList->text = text;
|
||||||
}
|
}
|
||||||
curTextList->nextElement = NULL;
|
curTextList->nextElement = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialog::setOptionText(unsigned int pos, const char *text)
|
void CDialog::setOptionText(unsigned int pos, const std::string& text)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
stTextList *curTextList;
|
stTextList *curTextList = OptionTextList;
|
||||||
|
|
||||||
curTextList = OptionTextList;
|
for(i=0 ; i<pos ; i++) {
|
||||||
|
if(!curTextList)
|
||||||
for(i=0 ; i<pos ; i++)
|
// TODO: print error
|
||||||
curTextList = (stTextList*) curTextList->nextElement;
|
return;
|
||||||
|
curTextList = curTextList->nextElement;
|
||||||
memset(curTextList->text,0,TEXT_LENGTH);
|
}
|
||||||
strcpy(curTextList->text,text);
|
|
||||||
|
curTextList->text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialog::setDimensions(int rectx, int recty, int rectw, int recth)
|
void CDialog::setDimensions(int rectx, int recty, int rectw, int recth)
|
||||||
@@ -197,7 +195,7 @@ void CDialog::renderDialog()
|
|||||||
|
|
||||||
while(curTextList != NULL)
|
while(curTextList != NULL)
|
||||||
{
|
{
|
||||||
g_pGraphics->sb_font_draw((unsigned char*)(curTextList->text), (x+3)<<3, (y+i+1)<<3);
|
g_pGraphics->sb_font_draw(curTextList->text, (x+3)<<3, (y+i+1)<<3);
|
||||||
curTextList = (stTextList*) curTextList->nextElement;
|
curTextList = (stTextList*) curTextList->nextElement;
|
||||||
i++;
|
i++;
|
||||||
if(i >= h-2)
|
if(i >= h-2)
|
||||||
@@ -287,7 +285,7 @@ void CDialog::renderOpenDialogAnimation(int x,int y, int w, int h)
|
|||||||
isanimated = false;
|
isanimated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *CDialog::getOptionString(unsigned int pos)
|
std::string CDialog::getOptionString(unsigned int pos)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
stTextList *curTextList;
|
stTextList *curTextList;
|
||||||
@@ -327,7 +325,7 @@ bool CDialog::setNextSelection()
|
|||||||
int i=0;
|
int i=0;
|
||||||
if(selection+1 < number_of_options)
|
if(selection+1 < number_of_options)
|
||||||
{
|
{
|
||||||
while(strcmp(getOptionString(selection+i+1),"") == 0)
|
while(getOptionString(selection+i+1) == "")
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
selection += i;
|
selection += i;
|
||||||
@@ -343,7 +341,7 @@ bool CDialog::setPrevSelection()
|
|||||||
int i=0;
|
int i=0;
|
||||||
if(selection-1 > 0)
|
if(selection-1 > 0)
|
||||||
{
|
{
|
||||||
while(strcmp(getOptionString(selection-i-1),"") == 0)
|
while(getOptionString(selection-i-1) == "")
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
selection -= i;
|
selection -= i;
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
#ifndef CDIALOG_H_
|
#ifndef CDIALOG_H_
|
||||||
#define CDIALOG_H_
|
#define CDIALOG_H_
|
||||||
|
|
||||||
#define TEXT_LENGTH 256
|
#include <string>
|
||||||
|
|
||||||
typedef struct stTextList
|
struct stTextList
|
||||||
{
|
{
|
||||||
char text[TEXT_LENGTH];
|
std::string text;
|
||||||
void *nextElement;
|
stTextList *nextElement;
|
||||||
}stTextList;
|
};
|
||||||
|
|
||||||
class CDialog {
|
class CDialog {
|
||||||
public:
|
public:
|
||||||
@@ -25,8 +25,8 @@ public:
|
|||||||
void drawDialogbox(int x1, int y1, int w, int h);
|
void drawDialogbox(int x1, int y1, int w, int h);
|
||||||
void setDimensions(int rectx, int recty, int rectw, int recth);
|
void setDimensions(int rectx, int recty, int rectw, int recth);
|
||||||
|
|
||||||
void addOptionText(const char *text);
|
void addOptionText(const std::string& text);
|
||||||
void setOptionText(unsigned int pos, const char *text);
|
void setOptionText(unsigned int pos, const std::string& text);
|
||||||
void addSeparator(void);
|
void addSeparator(void);
|
||||||
|
|
||||||
bool setSelection(int value);
|
bool setSelection(int value);
|
||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
bool setPrevSelection();
|
bool setPrevSelection();
|
||||||
|
|
||||||
int getSelection(void);
|
int getSelection(void);
|
||||||
char *getOptionString(unsigned int pos);
|
std::string getOptionString(unsigned int pos);
|
||||||
|
|
||||||
void renderOpenDialogAnimation(int x,int y, int w, int h);
|
void renderOpenDialogAnimation(int x,int y, int w, int h);
|
||||||
void animateDialogBox(bool value);
|
void animateDialogBox(bool value);
|
||||||
|
|||||||
@@ -12,11 +12,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "../StringUtils.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
CEGAGraphics::CEGAGraphics(short episode, const char *path) {
|
CEGAGraphics::CEGAGraphics(short episode, const std::string& path) {
|
||||||
m_episode = episode;
|
m_episode = episode;
|
||||||
strcpy(m_path, path);
|
m_path = path;
|
||||||
|
|
||||||
// EGAHEAD Structure
|
// EGAHEAD Structure
|
||||||
LatchPlaneSize = 0;
|
LatchPlaneSize = 0;
|
||||||
@@ -51,15 +54,15 @@ CEGAGraphics::~CEGAGraphics() {
|
|||||||
|
|
||||||
bool CEGAGraphics::loadData()
|
bool CEGAGraphics::loadData()
|
||||||
{
|
{
|
||||||
char buf[256];
|
std::string buf;
|
||||||
vector<char> databuf;
|
vector<char> databuf;
|
||||||
|
|
||||||
chdir("data"); // TODO: You must be able to use another directory
|
chdir("data"); // TODO: You must be able to use another directory
|
||||||
if(m_path[0] == 0)
|
if(m_path == "")
|
||||||
sprintf(buf,"egahead.ck%hd",m_episode);
|
buf = "egahead.ck" + itoa(m_episode);
|
||||||
else
|
else
|
||||||
sprintf(buf,"%s/egahead.ck%hd",m_path,m_episode);
|
buf = m_path + "/egahead.ck" + itoa(m_episode);
|
||||||
ifstream HeadFile(buf,ios::binary);
|
std::ifstream HeadFile(buf.c_str(),ios::binary);
|
||||||
|
|
||||||
if(!HeadFile)
|
if(!HeadFile)
|
||||||
return false;
|
return false;
|
||||||
@@ -72,9 +75,7 @@ bool CEGAGraphics::loadData()
|
|||||||
}
|
}
|
||||||
HeadFile.close();
|
HeadFile.close();
|
||||||
|
|
||||||
char *data;
|
char *data = new char[databuf.size()];
|
||||||
data = new char[databuf.size()];
|
|
||||||
|
|
||||||
memcpy(data, &databuf[0], databuf.size());
|
memcpy(data, &databuf[0], databuf.size());
|
||||||
|
|
||||||
// Now copy the data to the EGAHEAD Structure
|
// Now copy the data to the EGAHEAD Structure
|
||||||
@@ -108,10 +109,10 @@ bool CEGAGraphics::loadData()
|
|||||||
|
|
||||||
m_Latch->loadHead(data);
|
m_Latch->loadHead(data);
|
||||||
|
|
||||||
if(m_path[0] == 0)
|
if(m_path == "")
|
||||||
sprintf(buf,"egalatch.ck%hd",m_episode);
|
buf = "egalatch.ck" + itoa(m_episode);
|
||||||
else
|
else
|
||||||
sprintf(buf,"%s/egalatch.ck%hd",m_path,m_episode);
|
buf = m_path + "/egalatch.ck" + itoa(m_episode);
|
||||||
m_Latch->loadData(buf,(compressed>>1)); // The second bit tells, if latch is compressed.
|
m_Latch->loadData(buf,(compressed>>1)); // The second bit tells, if latch is compressed.
|
||||||
|
|
||||||
|
|
||||||
@@ -121,16 +122,14 @@ bool CEGAGraphics::loadData()
|
|||||||
SpriteLocation);
|
SpriteLocation);
|
||||||
m_Sprit->loadHead(data);
|
m_Sprit->loadHead(data);
|
||||||
|
|
||||||
if(m_path[0] == 0)
|
if(m_path == "")
|
||||||
sprintf(buf,"egasprit.ck%hd",m_episode);
|
buf = "egasprit.ck" + itoa(m_episode);
|
||||||
else
|
else
|
||||||
sprintf(buf,"%s/egasprit.ck%hd",m_path,m_episode);
|
buf = m_path + "/egasprit.ck" + itoa(m_episode);
|
||||||
m_Sprit->loadData(buf,(compressed>>1));
|
m_Sprit->loadData(buf,(compressed>>1));
|
||||||
|
|
||||||
chdir("../");
|
chdir("../");
|
||||||
|
|
||||||
delete [] data;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,13 @@
|
|||||||
#ifndef CEGAGRAPHICS_H_
|
#ifndef CEGAGRAPHICS_H_
|
||||||
#define CEGAGRAPHICS_H_
|
#define CEGAGRAPHICS_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include "CEGALatch.h"
|
#include "CEGALatch.h"
|
||||||
#include "CEGASprit.h"
|
#include "CEGASprit.h"
|
||||||
|
|
||||||
class CEGAGraphics {
|
class CEGAGraphics {
|
||||||
public:
|
public:
|
||||||
CEGAGraphics(short episode, const char *path);
|
CEGAGraphics(short episode, const std::string& path);
|
||||||
virtual ~CEGAGraphics();
|
virtual ~CEGAGraphics();
|
||||||
|
|
||||||
bool loadData();
|
bool loadData();
|
||||||
@@ -28,7 +29,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
short m_episode;
|
short m_episode;
|
||||||
char m_path[256];
|
std::string m_path;
|
||||||
|
|
||||||
// Part of the EGAHEAD Data Structure
|
// Part of the EGAHEAD Data Structure
|
||||||
// Section 1:
|
// Section 1:
|
||||||
|
|||||||
@@ -65,12 +65,11 @@ bool CEGALatch::loadHead( char *data )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CEGALatch::loadData(const char *filename, bool compresseddata)
|
bool CEGALatch::loadData(const std::string& filename, bool compresseddata)
|
||||||
{
|
{
|
||||||
FILE* latchfile;
|
|
||||||
char *RawData;
|
char *RawData;
|
||||||
|
|
||||||
latchfile = fopen(filename,"rb");
|
FILE* latchfile = fopen(filename.c_str(),"rb");
|
||||||
|
|
||||||
if(!latchfile)
|
if(!latchfile)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
#ifndef CEGALATCH_H_
|
#ifndef CEGALATCH_H_
|
||||||
#define CEGALATCH_H_
|
#define CEGALATCH_H_
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class CEGALatch {
|
class CEGALatch {
|
||||||
public:
|
public:
|
||||||
@@ -25,7 +26,7 @@ public:
|
|||||||
virtual ~CEGALatch();
|
virtual ~CEGALatch();
|
||||||
|
|
||||||
bool loadHead(char *data );
|
bool loadHead(char *data );
|
||||||
bool loadData(const char *filename, bool compresseddata);
|
bool loadData(const std::string& filename, bool compresseddata);
|
||||||
|
|
||||||
char *RawData;
|
char *RawData;
|
||||||
|
|
||||||
|
|||||||
@@ -71,12 +71,11 @@ bool CEGASprit::loadHead(char *data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CEGASprit::loadData(const char *filename, bool compresseddata)
|
bool CEGASprit::loadData(const std::string& filename, bool compresseddata)
|
||||||
{
|
{
|
||||||
FILE* latchfile;
|
|
||||||
char *RawData;
|
char *RawData;
|
||||||
|
|
||||||
latchfile = fopen(filename,"rb");
|
FILE* latchfile = fopen(filename.c_str(),"rb");
|
||||||
|
|
||||||
if(!latchfile)
|
if(!latchfile)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
#ifndef CEGASPRIT_H_
|
#ifndef CEGASPRIT_H_
|
||||||
#define CEGASPRIT_H_
|
#define CEGASPRIT_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class CEGASprit {
|
class CEGASprit {
|
||||||
public:
|
public:
|
||||||
CEGASprit(int planesize,
|
CEGASprit(int planesize,
|
||||||
@@ -17,7 +19,7 @@ public:
|
|||||||
virtual ~CEGASprit();
|
virtual ~CEGASprit();
|
||||||
|
|
||||||
bool loadHead(char *data);
|
bool loadHead(char *data);
|
||||||
bool loadData(const char *filename, bool compresseddata);
|
bool loadData(const std::string& filename, bool compresseddata);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_numsprites;
|
int m_numsprites;
|
||||||
|
|||||||
@@ -9,9 +9,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
#include <cstring>
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "../keen.h"
|
#include "../keen.h"
|
||||||
#include "../include/menu.h"
|
#include "../include/menu.h"
|
||||||
@@ -20,10 +18,14 @@ using namespace std;
|
|||||||
#include "../sdl/CInput.h"
|
#include "../sdl/CInput.h"
|
||||||
#include "../sdl/CTimer.h"
|
#include "../sdl/CTimer.h"
|
||||||
#include "../CGraphics.h"
|
#include "../CGraphics.h"
|
||||||
|
#include "../StringUtils.h"
|
||||||
|
|
||||||
#define HIGHSCORETABLE_X 1344
|
#define HIGHSCORETABLE_X 1344
|
||||||
#define HIGHSCORETABLE_Y 32
|
#define HIGHSCORETABLE_Y 32
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
CHighScores::CHighScores(stCloneKeenPlus *poutsideCKP) {
|
CHighScores::CHighScores(stCloneKeenPlus *poutsideCKP) {
|
||||||
// Set default Scores
|
// Set default Scores
|
||||||
strcpy(Name[0],"Gerstrong");
|
strcpy(Name[0],"Gerstrong");
|
||||||
@@ -124,8 +126,8 @@ char CHighScores::showHighScore(void)
|
|||||||
|
|
||||||
for( i=0 ; i<7 ; i++ )
|
for( i=0 ; i<7 ; i++ )
|
||||||
{
|
{
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Name[i],40,64+(i<<4),4,7);
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
||||||
if(Extra[i][0] == true)
|
if(Extra[i][0] == true)
|
||||||
g_pGraphics->drawTile(32,90+(i<<4),ItemTiles[0]);
|
g_pGraphics->drawTile(32,90+(i<<4),ItemTiles[0]);
|
||||||
if(Extra[i][1] == true)
|
if(Extra[i][1] == true)
|
||||||
@@ -140,19 +142,19 @@ char CHighScores::showHighScore(void)
|
|||||||
{
|
{
|
||||||
for( i=0 ; i<7 ; i++ )
|
for( i=0 ; i<7 ; i++ )
|
||||||
{
|
{
|
||||||
char buf[2];
|
std::string buf;
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Name[i],40,64+(i<<4),4,7);
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
||||||
sprintf(buf,"%d",Cities[i]);
|
buf = itoa(Cities[i]);
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) buf,250,64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(buf,250,64+(i<<4),4,7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( i=0 ; i<7 ; i++ )
|
for( i=0 ; i<7 ; i++ )
|
||||||
{
|
{
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Name[i],40,64+(i<<4),4,7);
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,19 +247,19 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
|
|||||||
{
|
{
|
||||||
for( i=0 ; i<7 ; i++ )
|
for( i=0 ; i<7 ; i++ )
|
||||||
{
|
{
|
||||||
char buf[2];
|
std::string buf;
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Name[i],40,64+(i<<4),4,7);
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
||||||
sprintf(buf,"%d",Cities[i]);
|
buf = itoa(Cities[i]);
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) buf,250,64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(buf,250,64+(i<<4),4,7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( i=0 ; i<7 ; i++ )
|
for( i=0 ; i<7 ; i++ )
|
||||||
{
|
{
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Name[i],40,64+(i<<4),4,7);
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +313,7 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
|
|||||||
if(g_pInput->getPressedKey(KBCKSPCE) && (WrittenName.length() > 0))
|
if(g_pInput->getPressedKey(KBCKSPCE) && (WrittenName.length() > 0))
|
||||||
{
|
{
|
||||||
memset(buf,0,256);
|
memset(buf,0,256);
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) " ",40,64+(place<<4),4,7);
|
g_pGraphics->sb_color_font_draw(" ",40,64+(place<<4),4,7);
|
||||||
WrittenName.erase(WrittenName.length()-1);
|
WrittenName.erase(WrittenName.length()-1);
|
||||||
WrittenName.copy(buf,WrittenName.length(),0);
|
WrittenName.copy(buf,WrittenName.length(),0);
|
||||||
memset(Name[place],0,16);
|
memset(Name[place],0,16);
|
||||||
@@ -329,10 +331,10 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
|
|||||||
for( i=0 ; i<7 ; i++ )
|
for( i=0 ; i<7 ; i++ )
|
||||||
{
|
{
|
||||||
if(i != place)
|
if(i != place)
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Name[i],40,64+(i<<4),4,7);
|
||||||
else
|
else
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) buf,40,64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(buf,40,64+(i<<4),4,7);
|
||||||
g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
||||||
|
|
||||||
if(pCKP->Control.levelcontrol.episode == 1)
|
if(pCKP->Control.levelcontrol.episode == 1)
|
||||||
{
|
{
|
||||||
@@ -364,9 +366,7 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
|
|||||||
char CHighScores::loadHighScoreTable(void)
|
char CHighScores::loadHighScoreTable(void)
|
||||||
{
|
{
|
||||||
string sBuf;
|
string sBuf;
|
||||||
char chBuf[256];
|
std::string chBuf = itoa(Episode);
|
||||||
|
|
||||||
sprintf(chBuf,"%d",Episode);
|
|
||||||
|
|
||||||
sBuf.append("data/");
|
sBuf.append("data/");
|
||||||
sBuf.append(DataDirectory);
|
sBuf.append(DataDirectory);
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
#ifndef CHIGHSCORES_H_
|
#ifndef CHIGHSCORES_H_
|
||||||
#define CHIGHSCORES_H_
|
#define CHIGHSCORES_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class CHighScores {
|
class CHighScores {
|
||||||
public:
|
public:
|
||||||
CHighScores(stCloneKeenPlus *poutsideCKP);
|
CHighScores(stCloneKeenPlus *poutsideCKP);
|
||||||
@@ -25,7 +27,7 @@ private:
|
|||||||
int ItemTiles[4];
|
int ItemTiles[4];
|
||||||
|
|
||||||
char Episode;
|
char Episode;
|
||||||
char *DataDirectory;
|
std::string DataDirectory;
|
||||||
|
|
||||||
stCloneKeenPlus *pCKP;
|
stCloneKeenPlus *pCKP;
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ bool CMessages::readData(char *buf, int episode, int version)
|
|||||||
// Now read the stuff and store it to a list
|
// Now read the stuff and store it to a list
|
||||||
for(int pos=offset_start ; pos<offset_end ; pos++)
|
for(int pos=offset_start ; pos<offset_end ; pos++)
|
||||||
{
|
{
|
||||||
string Text;
|
std::string Text;
|
||||||
|
|
||||||
while(buf[pos] != 0)
|
while(buf[pos] != 0)
|
||||||
{
|
{
|
||||||
@@ -68,7 +68,7 @@ bool CMessages::readData(char *buf, int episode, int version)
|
|||||||
StringList.push_back(Text);
|
StringList.push_back(Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
list<string> :: iterator i;
|
std::list<std::string> :: iterator i;
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
for(i=StringList.begin() ; i!=StringList.end() ; i++)
|
for(i=StringList.begin() ; i!=StringList.end() ; i++)
|
||||||
|
|||||||
@@ -12,8 +12,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
// TODO: Make the strings a class, but it must read from the exe-files basing on uncompressed buffer
|
// TODO: Make the strings a class, but it must read from the exe-files basing on uncompressed buffer
|
||||||
|
|
||||||
class CMessages {
|
class CMessages {
|
||||||
@@ -25,8 +23,8 @@ public:
|
|||||||
char *getString(const char *IDtext);
|
char *getString(const char *IDtext);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
list<string> StringList;
|
std::list<std::string> StringList;
|
||||||
list<string> StringIDList;
|
std::list<std::string> StringIDList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CMESSAGES_H_ */
|
#endif /* CMESSAGES_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user