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, \
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#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_MOVE 0
|
||||||
#define CMD_WAIT 1
|
#define CMD_WAIT 1
|
||||||
@@ -280,9 +281,9 @@ int eseq1_BackAtHome(stCloneKeenPlus *pCKP)
|
|||||||
{
|
{
|
||||||
/*int draw;*/
|
/*int draw;*/
|
||||||
int i;
|
int i;
|
||||||
char *text[10];
|
std::string text[10];
|
||||||
char strname[40];
|
std::string strname;
|
||||||
char tempbuf[200];
|
std::string tempbuf;
|
||||||
short textline, showtimer;
|
short textline, showtimer;
|
||||||
unsigned short amountshown;
|
unsigned short amountshown;
|
||||||
signed int waittimer;
|
signed int waittimer;
|
||||||
@@ -297,7 +298,7 @@ int dlgX, dlgY, dlgW, dlgH;
|
|||||||
// get pointers to all the strings we're going to be using
|
// get pointers to all the strings we're going to be using
|
||||||
for(i=0;i<8;i++)
|
for(i=0;i<8;i++)
|
||||||
{
|
{
|
||||||
sprintf(strname, "EP1_ESEQ_PART2_PAGE%d", i+1);
|
strname = "EP1_ESEQ_PART2_PAGE" + itoa(i+1);
|
||||||
text[i] = getstring(strname);
|
text[i] = getstring(strname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,9 +335,9 @@ int dlgX, dlgY, dlgW, dlgH;
|
|||||||
sb_dialogbox(dlgX, dlgY, dlgW, dlgH);
|
sb_dialogbox(dlgX, dlgY, dlgW, dlgH);
|
||||||
|
|
||||||
// draw the current text line up to the amount currently shown
|
// draw the current text line up to the amount currently shown
|
||||||
strcpy(tempbuf, text[textline]);
|
tempbuf = text[textline];
|
||||||
tempbuf[amountshown] = 0;
|
tempbuf.erase(amountshown);
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) tempbuf, (dlgX+1)*8, (dlgY+1)*8);
|
g_pGraphics->sb_font_draw( tempbuf, (dlgX+1)*8, (dlgY+1)*8);
|
||||||
|
|
||||||
if (state==STATE_TEXTAPPEARING)
|
if (state==STATE_TEXTAPPEARING)
|
||||||
{
|
{
|
||||||
@@ -344,7 +345,7 @@ int dlgX, dlgY, dlgW, dlgH;
|
|||||||
if (showtimer > LETTER_SHOW_SPD)
|
if (showtimer > LETTER_SHOW_SPD)
|
||||||
{ // it's time to show a new letter
|
{ // it's time to show a new letter
|
||||||
amountshown++;
|
amountshown++;
|
||||||
if (amountshown > strlen(text[textline]))
|
if (amountshown > text[textline].size())
|
||||||
{ // reached end of line
|
{ // reached end of line
|
||||||
state = STATE_WAITASEC;
|
state = STATE_WAITASEC;
|
||||||
// if (textline==8)
|
// if (textline==8)
|
||||||
@@ -359,7 +360,7 @@ int dlgX, dlgY, dlgW, dlgH;
|
|||||||
text[textline][amountshown-1]=='-')
|
text[textline][amountshown-1]=='-')
|
||||||
{
|
{
|
||||||
fullshow: ;
|
fullshow: ;
|
||||||
amountshown = strlen(text[textline]);
|
amountshown = text[textline].size();
|
||||||
state = STATE_WAITASEC;
|
state = STATE_WAITASEC;
|
||||||
waittimer = -BACKHOME_SHORT_WAIT_TIME*3;
|
waittimer = -BACKHOME_SHORT_WAIT_TIME*3;
|
||||||
}
|
}
|
||||||
@@ -413,7 +414,7 @@ int dlgX, dlgY, dlgW, dlgH;
|
|||||||
void eseq_ToBeContinued(stCloneKeenPlus *pCKP)
|
void eseq_ToBeContinued(stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *text;
|
std::string text;
|
||||||
int dlgX, dlgY, dlgW, dlgH;
|
int dlgX, dlgY, dlgW, dlgH;
|
||||||
|
|
||||||
// remove all objects because eseq_showmsg will call drawobjects
|
// remove all objects because eseq_showmsg will call drawobjects
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
#include "include/menu.h"
|
#include "include/menu.h"
|
||||||
#include "include/enemyai.h"
|
#include "include/enemyai.h"
|
||||||
#include "CGraphics.h"
|
#include "CGraphics.h"
|
||||||
|
#include "StringUtils.h"
|
||||||
|
|
||||||
|
|
||||||
#define CMD_MOVE 0
|
#define CMD_MOVE 0
|
||||||
#define CMD_WAIT 1
|
#define CMD_WAIT 1
|
||||||
@@ -354,12 +356,12 @@ int x,y,w,h;
|
|||||||
#define HEADSFOREARTH_W 33
|
#define HEADSFOREARTH_W 33
|
||||||
#define HEADSFOREARTH_H 8
|
#define HEADSFOREARTH_H 8
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
//int draw;
|
//int draw;
|
||||||
//int i;
|
//int i;
|
||||||
|
|
||||||
char tempbuf[1024];
|
std::string tempbuf;
|
||||||
char textline, showtimer;
|
char textline, showtimer;
|
||||||
unsigned int amountshown;
|
unsigned int amountshown;
|
||||||
int waittimer;
|
int waittimer;
|
||||||
@@ -380,17 +382,17 @@ int cancel, lastcancelstate;
|
|||||||
cancel = (g_pInput->getPressedCommand(KENTER) || g_pInput->getPressedCommand(KCTRL) || g_pInput->getPressedCommand(KALT));
|
cancel = (g_pInput->getPressedCommand(KENTER) || g_pInput->getPressedCommand(KCTRL) || g_pInput->getPressedCommand(KALT));
|
||||||
|
|
||||||
// draw the text up to the amount currently shown
|
// draw the text up to the amount currently shown
|
||||||
strcpy(tempbuf, text);
|
tempbuf = text;
|
||||||
tempbuf[amountshown] = 0;
|
tempbuf.erase(amountshown);
|
||||||
sb_dialogbox(boxleft,boxtop,boxwidth,boxheight);
|
sb_dialogbox(boxleft,boxtop,boxwidth,boxheight);
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*)tempbuf, (boxleft+1)*8, (boxtop+1+textline)*8);
|
g_pGraphics->sb_font_draw( tempbuf, (boxleft+1)*8, (boxtop+1+textline)*8);
|
||||||
|
|
||||||
gamedo_frameskipping_blitonly();
|
gamedo_frameskipping_blitonly();
|
||||||
gamedo_render_eraseobjects();
|
gamedo_render_eraseobjects();
|
||||||
|
|
||||||
if (showtimer > LETTER_SHOW_SPD)
|
if (showtimer > LETTER_SHOW_SPD)
|
||||||
{ // it's time to show a new letter
|
{ // it's time to show a new letter
|
||||||
if (amountshown < strlen(text))
|
if (amountshown < text.size())
|
||||||
{
|
{
|
||||||
amountshown++;
|
amountshown++;
|
||||||
}
|
}
|
||||||
@@ -400,9 +402,9 @@ int cancel, lastcancelstate;
|
|||||||
// user pressed enter or some other key
|
// user pressed enter or some other key
|
||||||
if (cancel && !lastcancelstate)
|
if (cancel && !lastcancelstate)
|
||||||
{
|
{
|
||||||
if (amountshown < strlen(text))
|
if (amountshown < text.size())
|
||||||
{
|
{
|
||||||
amountshown = strlen(text);
|
amountshown = text.size();
|
||||||
}
|
}
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
@@ -410,7 +412,7 @@ int cancel, lastcancelstate;
|
|||||||
// when all text is shown wait a sec then return
|
// when all text is shown wait a sec then return
|
||||||
if (autodismiss)
|
if (autodismiss)
|
||||||
{
|
{
|
||||||
if (amountshown >= strlen(text))
|
if (amountshown >= text.size())
|
||||||
{
|
{
|
||||||
if (waittimer > HEADFOREARTH_WAIT_TIME) return;
|
if (waittimer > HEADFOREARTH_WAIT_TIME) return;
|
||||||
waittimer++;
|
waittimer++;
|
||||||
@@ -671,8 +673,8 @@ int eseq2_SnowedOutside(stCloneKeenPlus *pCKP)
|
|||||||
{
|
{
|
||||||
int curpage;
|
int curpage;
|
||||||
int lastpage;
|
int lastpage;
|
||||||
char tempstr[80];
|
std::string tempstr;
|
||||||
char *text;
|
std::string text;
|
||||||
//int enter, lastenterstate;
|
//int enter, lastenterstate;
|
||||||
int dlgX, dlgY, dlgW, dlgH;
|
int dlgX, dlgY, dlgW, dlgH;
|
||||||
|
|
||||||
@@ -693,7 +695,7 @@ int dlgX, dlgY, dlgW, dlgH;
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
sprintf(tempstr, "EP2_ESEQ_PART3_PAGE%d", curpage);
|
tempstr = "EP2_ESEQ_PART3_PAGE" + itoa(curpage);
|
||||||
text = getstring(tempstr);
|
text = getstring(tempstr);
|
||||||
dlgX = GetStringAttribute(tempstr, "LEFT");
|
dlgX = GetStringAttribute(tempstr, "LEFT");
|
||||||
dlgY = GetStringAttribute(tempstr, "TOP");
|
dlgY = GetStringAttribute(tempstr, "TOP");
|
||||||
|
|||||||
161
src/fileio.cpp
161
src/fileio.cpp
@@ -17,6 +17,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#include "StringUtils.h"
|
||||||
|
|
||||||
extern CPlayer *Player;
|
extern CPlayer *Player;
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ void addmaptile(unsigned int t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool renameFilenamesLowerCase(const char *dir_name)
|
bool renameFilenamesLowerCase(const std::string& dir_name)
|
||||||
{
|
{
|
||||||
#ifdef TARGET_WIN32
|
#ifdef TARGET_WIN32
|
||||||
return true;
|
return true;
|
||||||
@@ -46,7 +47,7 @@ bool renameFilenamesLowerCase(const char *dir_name)
|
|||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
|
|
||||||
memset(newname,0,256);
|
memset(newname,0,256);
|
||||||
strcpy(buf,dir_name);
|
strcpy(buf,dir_name.c_str());
|
||||||
|
|
||||||
if(buf[0] == '\0')
|
if(buf[0] == '\0')
|
||||||
strcpy(buf,"./");
|
strcpy(buf,"./");
|
||||||
@@ -92,39 +93,38 @@ short checkConsistencyofGameData(stGameData *p_GameData)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
// Let's define which files need to be read!
|
// Let's define which files need to be read!
|
||||||
memset(p_GameData->FileList,0,MAX_NUMBER_OF_FILES*MAX_STRING_LENGTH);
|
|
||||||
if(p_GameData->Episode >= 1 && p_GameData->Episode <= 3)
|
if(p_GameData->Episode >= 1 && p_GameData->Episode <= 3)
|
||||||
{
|
{
|
||||||
sprintf(p_GameData->FileList[1],"keen%d.exe",p_GameData->Episode);
|
p_GameData->FileList[1] = "keen" + itoa(p_GameData->Episode) + ".exe";
|
||||||
sprintf(p_GameData->FileList[2],"egahead.ck%d",p_GameData->Episode);
|
p_GameData->FileList[2] = "egahead.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[3],"egasprit.ck%d",p_GameData->Episode);
|
p_GameData->FileList[3] = "egasprit.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[4],"egalatch.ck%d",p_GameData->Episode);
|
p_GameData->FileList[4] = "egalatch.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[5],"finale.ck%d",p_GameData->Episode);
|
p_GameData->FileList[5] = "finale.ck" + itoa(p_GameData->Episode);
|
||||||
|
|
||||||
// Levels!
|
// Levels!
|
||||||
sprintf(p_GameData->FileList[6],"level01.ck%d",p_GameData->Episode);
|
p_GameData->FileList[6] = "level01.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[7],"level02.ck%d",p_GameData->Episode);
|
p_GameData->FileList[7] = "level02.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[8],"level03.ck%d",p_GameData->Episode);
|
p_GameData->FileList[8] = "level03.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[9],"level04.ck%d",p_GameData->Episode);
|
p_GameData->FileList[9] = "level04.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[10],"level05.ck%d",p_GameData->Episode);
|
p_GameData->FileList[10] = "level05.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[11],"level06.ck%d",p_GameData->Episode);
|
p_GameData->FileList[11] = "level06.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[12],"level07.ck%d",p_GameData->Episode);
|
p_GameData->FileList[12] = "level07.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[13],"level08.ck%d",p_GameData->Episode);
|
p_GameData->FileList[13] = "level08.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[14],"level09.ck%d",p_GameData->Episode);
|
p_GameData->FileList[14] = "level09.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[15],"level10.ck%d",p_GameData->Episode);
|
p_GameData->FileList[15] = "level10.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[16],"level11.ck%d",p_GameData->Episode);
|
p_GameData->FileList[16] = "level11.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[17],"level12.ck%d",p_GameData->Episode);
|
p_GameData->FileList[17] = "level12.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[18],"level13.ck%d",p_GameData->Episode);
|
p_GameData->FileList[18] = "level13.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[19],"level14.ck%d",p_GameData->Episode);
|
p_GameData->FileList[19] = "level14.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[20],"level15.ck%d",p_GameData->Episode);
|
p_GameData->FileList[20] = "level15.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[21],"level16.ck%d",p_GameData->Episode);
|
p_GameData->FileList[21] = "level16.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[22],"level80.ck%d",p_GameData->Episode);
|
p_GameData->FileList[22] = "level80.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[23],"level81.ck%d",p_GameData->Episode);
|
p_GameData->FileList[23] = "level81.ck" + itoa(p_GameData->Episode);
|
||||||
sprintf(p_GameData->FileList[24],"level90.ck%d",p_GameData->Episode);
|
p_GameData->FileList[24] = "level90.ck" + itoa(p_GameData->Episode);
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
if(p_GameData->Episode == 1)
|
if(p_GameData->Episode == 1)
|
||||||
sprintf(p_GameData->FileList[24],"sounds.ck%d",p_GameData->Episode);
|
p_GameData->FileList[24] = "sounds.ck" + itoa(p_GameData->Episode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rename all the the files in the directory to lower case
|
// Rename all the the files in the directory to lower case
|
||||||
@@ -135,27 +135,24 @@ short checkConsistencyofGameData(stGameData *p_GameData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finally check if they really exist!
|
// Finally check if they really exist!
|
||||||
char buf[MAX_STRING_LENGTH];
|
|
||||||
int c=0;
|
int c=0;
|
||||||
for(c = 0 ; c < MAX_NUMBER_OF_FILES ; c++)
|
for(c = 0 ; c < MAX_NUMBER_OF_FILES ; c++)
|
||||||
{
|
{
|
||||||
if(p_GameData->FileList[c][0] == 0) // If there are no more files!
|
if(p_GameData->FileList[c][0] == 0) // If there are no more files!
|
||||||
break;
|
break;
|
||||||
|
|
||||||
memset(buf,0,MAX_STRING_LENGTH*sizeof(char));
|
std::string buf = "data/" + p_GameData->DataDirectory;
|
||||||
strcat(buf,"data/");
|
if(p_GameData->DataDirectory != "")
|
||||||
strcat(buf,p_GameData->DataDirectory);
|
buf += "/";
|
||||||
if(*(p_GameData->DataDirectory) != 0)
|
buf += p_GameData->FileList[c];
|
||||||
strcat(buf,"/");
|
|
||||||
strcat(buf,p_GameData->FileList[c]);
|
|
||||||
|
|
||||||
if((fp = fopen(buf,"r")) != NULL)
|
if((fp = fopen(buf.c_str(),"r")) != NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_pLogFile->ftextOut("Error! File \"%s\" was not found! Please add it to the configured directory.<br>", p_GameData->FileList[c]);
|
g_pLogFile->ftextOut("Error! File \"%s\" was not found! Please add it to the configured directory.<br>", p_GameData->FileList[c].c_str());
|
||||||
p_GameData->Episode = -1;
|
p_GameData->Episode = -1;
|
||||||
ok++;
|
ok++;
|
||||||
}
|
}
|
||||||
@@ -526,10 +523,9 @@ unsigned int temp1, temp2, temp3, temp4;
|
|||||||
return (temp4<<24) | (temp3<<16) | (temp2<<8) | temp1;
|
return (temp4<<24) | (temp3<<16) | (temp2<<8) | temp1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int loadmap(char filename[MAX_STRING_LENGTH], char *path, int lvlnum, int isworldmap, stCloneKeenPlus *pCKP)
|
unsigned int loadmap(const std::string& filename, const std::string& path, int lvlnum, int isworldmap, stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char fname[256];
|
|
||||||
int t;
|
int t;
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
int numruns = 0;
|
int numruns = 0;
|
||||||
@@ -539,20 +535,17 @@ int resetcnt, resetpt;
|
|||||||
NessieAlreadySpawned = 0;
|
NessieAlreadySpawned = 0;
|
||||||
map.isworldmap = isworldmap;
|
map.isworldmap = isworldmap;
|
||||||
|
|
||||||
char buffer[256];
|
std::string buffer = formatPathString(path);
|
||||||
|
std::string fname = buffer + filename;
|
||||||
formatPathString(buffer, path);
|
fp = fopen(fname.c_str(), "rb");
|
||||||
|
|
||||||
sprintf(fname, "%s%s", buffer, filename);
|
|
||||||
fp = fopen(fname, "rb");
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
// only record this error message on build platforms that log errors
|
// only record this error message on build platforms that log errors
|
||||||
// to a file and not to the screen.
|
// to a file and not to the screen.
|
||||||
g_pLogFile->ftextOut("loadmap(): unable to open file %s<br>", fname);
|
g_pLogFile->ftextOut("loadmap(): unable to open file %s<br>", fname.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
g_pLogFile->ftextOut("loadmap(): file %s opened. Loading...<br>", fname);
|
g_pLogFile->ftextOut("loadmap(): file %s opened. Loading...<br>", fname.c_str());
|
||||||
|
|
||||||
// decompress map RLEW data
|
// decompress map RLEW data
|
||||||
curmapx = curmapy = mapdone = 0;
|
curmapx = curmapy = mapdone = 0;
|
||||||
@@ -562,7 +555,7 @@ int resetcnt, resetpt;
|
|||||||
|
|
||||||
if(filebuf == NULL)
|
if(filebuf == NULL)
|
||||||
{
|
{
|
||||||
g_pLogFile->ftextOut("loadmap(): unable to allocate memory for unpacking the level file<br>", fname);
|
g_pLogFile->ftextOut("loadmap(): unable to allocate memory for unpacking the level file<br>", fname.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,6 +633,7 @@ int resetcnt, resetpt;
|
|||||||
|
|
||||||
if((fp=fopen("data/hqp/music/table.cfg","rt")) != NULL)
|
if((fp=fopen("data/hqp/music/table.cfg","rt")) != NULL)
|
||||||
{
|
{
|
||||||
|
static const int MAX_STRING_LENGTH = 256;
|
||||||
char buf1[MAX_STRING_LENGTH];
|
char buf1[MAX_STRING_LENGTH];
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
@@ -650,7 +644,7 @@ int resetcnt, resetpt;
|
|||||||
{
|
{
|
||||||
fscanf(fp,"%s",buf1);
|
fscanf(fp,"%s",buf1);
|
||||||
|
|
||||||
if(strcmp(buf1,filename) == 0)
|
if(strcmp(buf1,filename.c_str()) == 0)
|
||||||
{
|
{
|
||||||
fscanf(fp,"%s",buf2);
|
fscanf(fp,"%s",buf2);
|
||||||
break;
|
break;
|
||||||
@@ -761,16 +755,14 @@ char loadstrings(const char *fname)
|
|||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char state;
|
char state;
|
||||||
unsigned char stName[80];
|
char stName[80];
|
||||||
unsigned char stString[1024];
|
char stString[1024];
|
||||||
unsigned char stAttr[80];
|
char stAttr[80];
|
||||||
int i,c;
|
int i,c;
|
||||||
int nameIndex, stringIndex;
|
int nameIndex, stringIndex;
|
||||||
int attrIndex=0;
|
int attrIndex=0;
|
||||||
int waitChar, gotoState;
|
int waitChar, gotoState;
|
||||||
char highlight;
|
char highlight;
|
||||||
int RAMSize;
|
|
||||||
char *RAMPtr;
|
|
||||||
|
|
||||||
#define STSTATE_WAITCHAR 0
|
#define STSTATE_WAITCHAR 0
|
||||||
#define STSTATE_READNAME 1
|
#define STSTATE_READNAME 1
|
||||||
@@ -789,8 +781,8 @@ g_pLogFile->ftextOut("loadstrings(): Opening string file '%s'.<br>", fname);
|
|||||||
// let us know which ones are in use (and need to be free()d at shutdown)
|
// let us know which ones are in use (and need to be free()d at shutdown)
|
||||||
for(i=0;i<MAX_STRINGS;i++)
|
for(i=0;i<MAX_STRINGS;i++)
|
||||||
{
|
{
|
||||||
strings[i].name = NULL;
|
strings[i].name = "";
|
||||||
strings[i].stringptr = NULL;
|
strings[i].stringptr = "";
|
||||||
strings[i].numAttributes = 0;
|
strings[i].numAttributes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -913,24 +905,9 @@ g_pLogFile->ftextOut("loadstrings(): Opening string file '%s'.<br>", fname);
|
|||||||
|
|
||||||
/* save the string to the strings[] structure */
|
/* save the string to the strings[] structure */
|
||||||
|
|
||||||
// we're going to malloc() an area and copy the name, then the string,
|
|
||||||
// into it. We'll need room for both the name and the string, plus
|
|
||||||
// null-terminators for each.
|
|
||||||
RAMSize = strlen( (char*) stName) + strlen((char*)stString) + 2;
|
|
||||||
RAMPtr = (char*) malloc(RAMSize);
|
|
||||||
if (!RAMPtr)
|
|
||||||
{
|
|
||||||
g_pLogFile->ftextOut(RED,"loadstrings(): Could not allocate memory for string '%s'<br>", stName);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// assign our pointers
|
|
||||||
strings[numStrings].name = (unsigned char*) &RAMPtr[0];
|
|
||||||
strings[numStrings].stringptr = (unsigned char*) &RAMPtr[strlen((char*)stName)+1];
|
|
||||||
|
|
||||||
// copy the string info to the newly malloc()'d memory area
|
// copy the string info to the newly malloc()'d memory area
|
||||||
memcpy(strings[numStrings].name, stName, strlen((char*)stName)+1);
|
strings[numStrings].name = stName;
|
||||||
memcpy(strings[numStrings].stringptr, stString, strlen((char*)stString)+1);
|
strings[numStrings].stringptr = stString;
|
||||||
|
|
||||||
numStrings++;
|
numStrings++;
|
||||||
// read the name of the next string
|
// read the name of the next string
|
||||||
@@ -956,11 +933,8 @@ int NumStringsFreed;
|
|||||||
NumStringsFreed = 0;
|
NumStringsFreed = 0;
|
||||||
for(i=0;i<MAX_STRINGS;i++)
|
for(i=0;i<MAX_STRINGS;i++)
|
||||||
{
|
{
|
||||||
if (strings[i].name)
|
if (strings[i].name != "")
|
||||||
{
|
{
|
||||||
// free the string name
|
|
||||||
free(strings[i].name);
|
|
||||||
strings[i].name = strings[i].stringptr = NULL;
|
|
||||||
// free all attribute names
|
// free all attribute names
|
||||||
for(j=0;j<strings[i].numAttributes;j++)
|
for(j=0;j<strings[i].numAttributes;j++)
|
||||||
{
|
{
|
||||||
@@ -978,49 +952,34 @@ int NumStringsFreed;
|
|||||||
const char *MissingString = "MISSING STRING!";
|
const char *MissingString = "MISSING STRING!";
|
||||||
|
|
||||||
// returns a pointer to the string with name 'name'
|
// returns a pointer to the string with name 'name'
|
||||||
char* getstring(const char *name)
|
std::string getstring(const std::string& name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<numStrings;i++)
|
for(i=0;i<numStrings;i++)
|
||||||
{
|
{
|
||||||
if (!strcmp((char*) name, (char*) strings[i].name))
|
if (name == strings[i].name)
|
||||||
{
|
{
|
||||||
return (char*) strings[i].stringptr;
|
return strings[i].stringptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (char*) MissingString;
|
return MissingString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// because windows and linux read files differently, these is to function to get them correctly
|
// because windows and linux read files differently, these is to function to get them correctly
|
||||||
void formatPathString(char *output, const char *path)
|
std::string formatPathString(const std::string& path)
|
||||||
{
|
{
|
||||||
char *buf;
|
size_t p = path.find('\r');
|
||||||
|
return "data/" + path.substr(0,p) + "/";
|
||||||
strcpy(output,"data");
|
|
||||||
|
|
||||||
strcat(output,"/");
|
|
||||||
|
|
||||||
buf = strchr(path,'\r');
|
|
||||||
|
|
||||||
if(buf)
|
|
||||||
*buf=0; // Trim return caret
|
|
||||||
|
|
||||||
if(path[0] != 0 )
|
|
||||||
{
|
|
||||||
strcat(output,path);
|
|
||||||
strcat(output,"/");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns attribute attrname of string stringname, or -1 if it doesn't exist.
|
// returns attribute attrname of string stringname, or -1 if it doesn't exist.
|
||||||
int GetStringAttribute(const char *stringName, const char *attrName)
|
int GetStringAttribute(const std::string& stringName, const char *attrName)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
for(i=0;i<numStrings;i++)
|
for(i=0;i<numStrings;i++)
|
||||||
{
|
{
|
||||||
if (!strcmp((char*) stringName, (char*) strings[i].name))
|
if (stringName == strings[i].name)
|
||||||
{
|
{
|
||||||
// we found the string, now find the requested attribute
|
// we found the string, now find the requested attribute
|
||||||
for(j=0;j<strings[i].numAttributes;j++)
|
for(j=0;j<strings[i].numAttributes;j++)
|
||||||
|
|||||||
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!
|
||||||
|
|||||||
@@ -69,24 +69,22 @@ int mask;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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];
|
|
||||||
|
|
||||||
|
|
||||||
formatPathString(buffer,path);
|
std::string buffer = formatPathString(path);
|
||||||
|
|
||||||
|
|
||||||
map_unregister_all_animtiles();
|
map_unregister_all_animtiles();
|
||||||
|
|
||||||
sprintf(fname, "%s%s", buffer,filename);
|
std::string fname = buffer + filename;
|
||||||
fp = fopen(fname, "rb");
|
fp = fopen(fname.c_str(), "rb");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
crashflag = 1;
|
crashflag = 1;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*check if the compiler is of C++*/
|
|
||||||
#ifdef __cplusplus
|
#ifndef __CG_FUNCDEFS_H__
|
||||||
extern "C" {
|
#define __CG_FUNCDEFS_H__
|
||||||
#endif
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
// gamedo.c
|
// gamedo.c
|
||||||
int gamedo_ScrollTriggers(int theplayer);
|
int gamedo_ScrollTriggers(int theplayer);
|
||||||
@@ -113,8 +114,8 @@ void sb_font_draw_inverse(unsigned char *text, int xoff, int yoff);
|
|||||||
|
|
||||||
bool loadtileattributes(int episode, int version, unsigned char *filebuf);
|
bool loadtileattributes(int episode, int version, unsigned char *filebuf);
|
||||||
int freestrings(void);
|
int freestrings(void);
|
||||||
char* getstring(const char *name);
|
std::string getstring(const std::string& name);
|
||||||
int GetStringAttribute(const char *stringName, const char *attrName);
|
int GetStringAttribute(const std::string& stringName, const char *attrName);
|
||||||
|
|
||||||
// keydrv.c
|
// keydrv.c
|
||||||
char KeyDrv_Start(void);
|
char KeyDrv_Start(void);
|
||||||
@@ -152,12 +153,10 @@ unsigned char sgrle_get_next_byte(FILE *fp);
|
|||||||
char lz_decompress(FILE *lzfile, unsigned char *outbuffer);
|
char lz_decompress(FILE *lzfile, unsigned char *outbuffer);
|
||||||
|
|
||||||
// finale.c
|
// finale.c
|
||||||
void finale_draw(const char *filename, const char *path);
|
void finale_draw(const std::string& filename, const std::string& path);
|
||||||
|
|
||||||
// scalerx.c
|
// scalerx.c
|
||||||
//void scale2x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height);
|
//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
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "CGraphics.h"
|
#include "CGraphics.h"
|
||||||
#include "vorticon/CPlayer.h"
|
#include "vorticon/CPlayer.h"
|
||||||
#include "keenext.h"
|
#include "keenext.h"
|
||||||
|
#include "StringUtils.h"
|
||||||
|
|
||||||
#include "include/enemyai.h"
|
#include "include/enemyai.h"
|
||||||
|
|
||||||
@@ -401,7 +402,7 @@ void gamedo_render_drawdebug(void)
|
|||||||
{
|
{
|
||||||
int tl,y;
|
int tl,y;
|
||||||
/*int h;*/
|
/*int h;*/
|
||||||
char debugmsg[80];
|
std::string debugmsg;
|
||||||
|
|
||||||
if (debugmode)
|
if (debugmode)
|
||||||
{
|
{
|
||||||
@@ -411,23 +412,23 @@ char debugmsg[80];
|
|||||||
saveh = 80;
|
saveh = 80;
|
||||||
g_pGraphics->saveArea(4,4,savew,saveh);
|
g_pGraphics->saveArea(4,4,savew,saveh);
|
||||||
y = 5-8;
|
y = 5-8;
|
||||||
sprintf(debugmsg, "p1x/y: %ld/%d", player[0].x, player[0].y);
|
debugmsg = "p1x/y: " + itoa(player[0].x) + "/" + itoa(player[0].y);
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8);
|
g_pGraphics->sb_font_draw( debugmsg, 5, y+=8);
|
||||||
sprintf(debugmsg, "p2x/y: %ld/%d", player[1].x, player[1].y);
|
debugmsg = "p2x/y: " + itoa(player[1].x) + "/" + itoa(player[1].y);
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8);
|
g_pGraphics->sb_font_draw( debugmsg, 5, y+=8);
|
||||||
sprintf(debugmsg, "scroll_x/y = %d/%d", (unsigned int)scroll_x, (unsigned int)scroll_y);
|
debugmsg = "scroll_x/y = " + itoa(scroll_x) + "/" + itoa(scroll_y);
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8);
|
g_pGraphics->sb_font_draw( debugmsg, 5, y+=8);
|
||||||
sprintf(debugmsg, "scrollbuf_x/y: %d/%d", scrollx_buf, scrolly_buf);
|
debugmsg = "scrollbuf_x/y: " + itoa(scrollx_buf) + "/" + itoa(scrolly_buf);
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8);
|
g_pGraphics->sb_font_draw( debugmsg, 5, y+=8);
|
||||||
sprintf(debugmsg, "iw,pw: %d/%d", player[0].inhibitwalking, player[0].pwalking);
|
debugmsg = "iw,pw: " + itoa(player[0].inhibitwalking) + "/" + itoa(player[0].pwalking);
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8);
|
g_pGraphics->sb_font_draw( debugmsg, 5, y+=8);
|
||||||
sprintf(debugmsg, "pinertia_x: %d", player[0].pinertia_x);
|
debugmsg = "pinertia_x: " + itoa(player[0].pinertia_x);
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8);
|
g_pGraphics->sb_font_draw( debugmsg, 5, y+=8);
|
||||||
sprintf(debugmsg, "psupt: (%d,%d)", player[0].psupportingtile, player[0].psupportingobject);
|
debugmsg = "psupt: (" + itoa(player[0].psupportingtile) + "," + itoa(player[0].psupportingobject) + ")";
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8);
|
g_pGraphics->sb_font_draw( debugmsg, 5, y+=8);
|
||||||
|
|
||||||
sprintf(debugmsg, "lvl,tile = %d,%d", getlevelat((player[0].x>>CSF)+4, (player[0].y>>CSF)+9), tl);
|
debugmsg = "lvl,tile = " + itoa(getlevelat((player[0].x>>CSF)+4, (player[0].y>>CSF)+9)) + "," + itoa(tl);
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8);
|
g_pGraphics->sb_font_draw( debugmsg, 5, y+=8);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
sprintf(debugmsg, "NOH=%d", NessieObjectHandle);
|
sprintf(debugmsg, "NOH=%d", NessieObjectHandle);
|
||||||
@@ -566,6 +567,7 @@ int i;
|
|||||||
|
|
||||||
for(i=0;i<4;i++)
|
for(i=0;i<4;i++)
|
||||||
{
|
{
|
||||||
|
static const int MAX_STRING_LENGTH = 256;
|
||||||
text[i]= (char*) malloc(MAX_STRING_LENGTH*sizeof(char));
|
text[i]= (char*) malloc(MAX_STRING_LENGTH*sizeof(char));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,6 +610,7 @@ int i;
|
|||||||
|
|
||||||
text = (char**) malloc(sizeof(char*));
|
text = (char**) malloc(sizeof(char*));
|
||||||
|
|
||||||
|
static const int MAX_STRING_LENGTH = 256;
|
||||||
text[0]= (char*) malloc(MAX_STRING_LENGTH*sizeof(char));
|
text[0]= (char*) malloc(MAX_STRING_LENGTH*sizeof(char));
|
||||||
|
|
||||||
if (player[0].godmode)
|
if (player[0].godmode)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
14
src/keen.h
14
src/keen.h
@@ -1,6 +1,6 @@
|
|||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
|
|
||||||
#ifdef TARGET_DOS
|
#ifdef TARGET_DOS
|
||||||
#include <dpmi.h>
|
#include <dpmi.h>
|
||||||
@@ -158,15 +158,15 @@ typedef struct stInventory
|
|||||||
// for strings loaded from "strings.dat"
|
// for strings loaded from "strings.dat"
|
||||||
#define MAX_STRINGS 100
|
#define MAX_STRINGS 100
|
||||||
#define MAX_ATTRIBUTES 16
|
#define MAX_ATTRIBUTES 16
|
||||||
typedef struct stString
|
struct stString
|
||||||
{
|
{
|
||||||
unsigned char *name; // pointer to malloc'd area containing string name
|
std::string name; // pointer to malloc'd area containing string name
|
||||||
unsigned char *stringptr; // pointer to malloc'd area containing string
|
std::string stringptr; // pointer to malloc'd area containing string
|
||||||
|
|
||||||
int numAttributes;
|
int numAttributes;
|
||||||
unsigned char *attrnames[MAX_ATTRIBUTES+1];
|
unsigned char *attrnames[MAX_ATTRIBUTES+1];
|
||||||
unsigned int attrvalues[MAX_ATTRIBUTES+1];
|
unsigned int attrvalues[MAX_ATTRIBUTES+1];
|
||||||
} stString;
|
};
|
||||||
|
|
||||||
/* Structs used for different enemies data, these are in a union */
|
/* Structs used for different enemies data, these are in a union */
|
||||||
typedef struct stYorpData
|
typedef struct stYorpData
|
||||||
|
|||||||
@@ -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];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
163
src/misc.cpp
163
src/misc.cpp
@@ -24,6 +24,7 @@
|
|||||||
#include "include/gamedo.h"
|
#include "include/gamedo.h"
|
||||||
#include "CLogFile.h"
|
#include "CLogFile.h"
|
||||||
#include "CGraphics.h"
|
#include "CGraphics.h"
|
||||||
|
#include "StringUtils.h"
|
||||||
|
|
||||||
void banner(void)
|
void banner(void)
|
||||||
{
|
{
|
||||||
@@ -194,7 +195,7 @@ int i;
|
|||||||
twirlY = GetStringAttribute(strname, "TWIRLY");
|
twirlY = GetStringAttribute(strname, "TWIRLY");
|
||||||
|
|
||||||
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
g_pGraphics->drawFont((unsigned char*) getstring(strname), (dlgX+1)<<3, (dlgY+1)<<3,0);
|
g_pGraphics->drawFont(getstring(strname), (dlgX+1)<<3, (dlgY+1)<<3,0);
|
||||||
|
|
||||||
twirlframe = 0;
|
twirlframe = 0;
|
||||||
twirltimer = twirl_speed+1;
|
twirltimer = twirl_speed+1;
|
||||||
@@ -265,7 +266,7 @@ void VorticonElder(int mpx, int mpy, stCloneKeenPlus *pCKP)
|
|||||||
twirlY = GetStringAttribute(strName, "TWIRLY");
|
twirlY = GetStringAttribute(strName, "TWIRLY");
|
||||||
|
|
||||||
dialogbox(dlgX, dlgY, dlgW, dlgH);
|
dialogbox(dlgX, dlgY, dlgW, dlgH);
|
||||||
g_pGraphics->drawFont( (unsigned char*) getstring(strName), (dlgX+1)<<3, (dlgY+1)<<3,0);
|
g_pGraphics->drawFont( getstring(strName), (dlgX+1)<<3, (dlgY+1)<<3,0);
|
||||||
|
|
||||||
twirlframe = 0;
|
twirlframe = 0;
|
||||||
twirltimer = twirl_speed+1;
|
twirltimer = twirl_speed+1;
|
||||||
@@ -297,7 +298,7 @@ void VorticonElder(int mpx, int mpy, stCloneKeenPlus *pCKP)
|
|||||||
void inventory_draw_ep1(int p)
|
void inventory_draw_ep1(int p)
|
||||||
{
|
{
|
||||||
int x,t,i,j;
|
int x,t,i,j;
|
||||||
char tempbuf[40];
|
std::string tempbuf;
|
||||||
int dlgX,dlgY,dlgW,dlgH;
|
int dlgX,dlgY,dlgW,dlgH;
|
||||||
|
|
||||||
dlgX = GetStringAttribute("EP1_StatusBox", "LEFT");
|
dlgX = GetStringAttribute("EP1_StatusBox", "LEFT");
|
||||||
@@ -306,7 +307,7 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
dlgH = GetStringAttribute("EP1_StatusBox", "HEIGHT");
|
dlgH = GetStringAttribute("EP1_StatusBox", "HEIGHT");
|
||||||
|
|
||||||
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
g_pGraphics->drawFont( (unsigned char*) getstring("EP1_StatusBox"), (dlgX+1)<<3, (dlgY+1)<<3, 0);
|
g_pGraphics->drawFont( getstring("EP1_StatusBox"), (dlgX+1)<<3, (dlgY+1)<<3, 0);
|
||||||
|
|
||||||
// fill in what we have
|
// fill in what we have
|
||||||
// 321: joystick/battery/vacuum/fuel not gotten
|
// 321: joystick/battery/vacuum/fuel not gotten
|
||||||
@@ -323,9 +324,8 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
g_pGraphics->drawTile_direct((dlgX+21)<<3, ((dlgY+8)<<3)+3, 424);
|
g_pGraphics->drawTile_direct((dlgX+21)<<3, ((dlgY+8)<<3)+3, 424);
|
||||||
if(player[p].inventory.HasCardYellow > 1)
|
if(player[p].inventory.HasCardYellow > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardYellow);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardYellow);
|
g_pGraphics->drawFont(buf,(dlgX+20)<<3,((dlgY+8)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*)buf,(dlgX+20)<<3,((dlgY+8)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player[p].inventory.HasCardRed)
|
if (player[p].inventory.HasCardRed)
|
||||||
@@ -333,9 +333,8 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
g_pGraphics->drawTile_direct((dlgX+25)<<3, ((dlgY+8)<<3)+3, 425);
|
g_pGraphics->drawTile_direct((dlgX+25)<<3, ((dlgY+8)<<3)+3, 425);
|
||||||
if(player[p].inventory.HasCardRed > 1)
|
if(player[p].inventory.HasCardRed > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardRed);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardRed);
|
g_pGraphics->drawFont(buf,(dlgX+24)<<3,((dlgY+8)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*) buf,(dlgX+24)<<3,((dlgY+8)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player[p].inventory.HasCardGreen)
|
if (player[p].inventory.HasCardGreen)
|
||||||
@@ -344,9 +343,8 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
|
|
||||||
if (player[p].inventory.HasCardGreen > 1)
|
if (player[p].inventory.HasCardGreen > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardGreen);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardGreen);
|
g_pGraphics->drawFont(buf,(dlgX+20)<<3,((dlgY+10)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*) buf,(dlgX+20)<<3,((dlgY+10)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player[p].inventory.HasCardBlue)
|
if (player[p].inventory.HasCardBlue)
|
||||||
@@ -354,9 +352,8 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
g_pGraphics->drawTile_direct((dlgX+25)<<3, ((dlgY+10)<<3)+4, 427);
|
g_pGraphics->drawTile_direct((dlgX+25)<<3, ((dlgY+10)<<3)+4, 427);
|
||||||
if(player[p].inventory.HasCardBlue > 1)
|
if(player[p].inventory.HasCardBlue > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardBlue);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardBlue);
|
g_pGraphics->drawFont(buf,(dlgX+24)<<3,((dlgY+10)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*) buf,(dlgX+24)<<3,((dlgY+10)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ship parts
|
// ship parts
|
||||||
@@ -371,17 +368,17 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
// ray gun charges
|
// ray gun charges
|
||||||
i = player[p].inventory.charges;
|
i = player[p].inventory.charges;
|
||||||
if (i>999) i=999;
|
if (i>999) i=999;
|
||||||
sprintf(tempbuf, "%d", i);
|
tempbuf = itoa(i);
|
||||||
g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+4)<<3, (dlgY+12)<<3, 0);
|
g_pGraphics->drawFont( tempbuf, (dlgX+4)<<3, (dlgY+12)<<3, 0);
|
||||||
|
|
||||||
// score
|
// score
|
||||||
i = player[p].inventory.score;
|
i = player[p].inventory.score;
|
||||||
sprintf(tempbuf, "%d", i);
|
tempbuf = itoa(i);
|
||||||
g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+12-strlen(tempbuf))<<3, (dlgY+2)<<3, 0);
|
g_pGraphics->drawFont( tempbuf, (dlgX+12-tempbuf.size())<<3, (dlgY+2)<<3, 0);
|
||||||
// extra life at
|
// extra life at
|
||||||
i = player[p].inventory.extralifeat;
|
i = player[p].inventory.extralifeat;
|
||||||
sprintf(tempbuf, "%d", i);
|
tempbuf = itoa(i);
|
||||||
g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+28-strlen(tempbuf))<<3, (dlgY+2)<<3, 0);
|
g_pGraphics->drawFont( tempbuf, (dlgX+28-tempbuf.size())<<3, (dlgY+2)<<3, 0);
|
||||||
// lives
|
// lives
|
||||||
i = player[p].inventory.lives;
|
i = player[p].inventory.lives;
|
||||||
x = ((dlgX+1)<<3)+4;
|
x = ((dlgX+1)<<3)+4;
|
||||||
@@ -396,7 +393,7 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
void inventory_draw_ep2(int p, stCloneKeenPlus *pCKP)
|
void inventory_draw_ep2(int p, stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
int x,/*y,t,*/i,j;
|
int x,/*y,t,*/i,j;
|
||||||
char tempbuf[40];
|
std::string tempbuf;
|
||||||
int dlgX,dlgY,dlgW,dlgH;
|
int dlgX,dlgY,dlgW,dlgH;
|
||||||
|
|
||||||
stLevelControl *p_levelcontrol;
|
stLevelControl *p_levelcontrol;
|
||||||
@@ -409,7 +406,7 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
dlgH = GetStringAttribute("EP2_StatusBox", "HEIGHT");
|
dlgH = GetStringAttribute("EP2_StatusBox", "HEIGHT");
|
||||||
|
|
||||||
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
g_pGraphics->drawFont( (unsigned char*) getstring("EP2_StatusBox"), (dlgX+1)<<3, (dlgY+1)<<3, 0);
|
g_pGraphics->drawFont( getstring("EP2_StatusBox"), (dlgX+1)<<3, (dlgY+1)<<3, 0);
|
||||||
|
|
||||||
// cards
|
// cards
|
||||||
if (player[p].inventory.HasCardYellow)
|
if (player[p].inventory.HasCardYellow)
|
||||||
@@ -417,9 +414,8 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
g_pGraphics->drawTile_direct(((dlgX+21)<<3)-4, ((dlgY+8)<<3)+3, 424);
|
g_pGraphics->drawTile_direct(((dlgX+21)<<3)-4, ((dlgY+8)<<3)+3, 424);
|
||||||
if(player[p].inventory.HasCardYellow > 1)
|
if(player[p].inventory.HasCardYellow > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardYellow);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardYellow);
|
g_pGraphics->drawFont(buf,(dlgX+20)<<3,((dlgY+8)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*)buf,(dlgX+20)<<3,((dlgY+8)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player[p].inventory.HasCardRed)
|
if (player[p].inventory.HasCardRed)
|
||||||
@@ -427,9 +423,8 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
g_pGraphics->drawTile_direct(((dlgX+25)<<3)-4, ((dlgY+8)<<3)+3, 425);
|
g_pGraphics->drawTile_direct(((dlgX+25)<<3)-4, ((dlgY+8)<<3)+3, 425);
|
||||||
if(player[p].inventory.HasCardRed > 1)
|
if(player[p].inventory.HasCardRed > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardRed);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardRed);
|
g_pGraphics->drawFont(buf,(dlgX+24)<<3,((dlgY+8)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*)buf,(dlgX+24)<<3,((dlgY+8)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player[p].inventory.HasCardGreen)
|
if (player[p].inventory.HasCardGreen)
|
||||||
@@ -437,9 +432,8 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
g_pGraphics->drawTile_direct(((dlgX+21)<<3)-4, ((dlgY+10)<<3)+4, 426);
|
g_pGraphics->drawTile_direct(((dlgX+21)<<3)-4, ((dlgY+10)<<3)+4, 426);
|
||||||
if(player[p].inventory.HasCardGreen > 1)
|
if(player[p].inventory.HasCardGreen > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardGreen);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardGreen);
|
g_pGraphics->drawFont(buf,(dlgX+20)<<3,((dlgY+10)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*)buf,(dlgX+20)<<3,((dlgY+10)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player[p].inventory.HasCardBlue)
|
if (player[p].inventory.HasCardBlue)
|
||||||
@@ -447,20 +441,19 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
g_pGraphics->drawTile_direct(((dlgX+25)<<3)-4, ((dlgY+10)<<3)+4, 427);
|
g_pGraphics->drawTile_direct(((dlgX+25)<<3)-4, ((dlgY+10)<<3)+4, 427);
|
||||||
if(player[p].inventory.HasCardBlue > 1)
|
if(player[p].inventory.HasCardBlue > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardBlue);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardBlue);
|
g_pGraphics->drawFont(buf,(dlgX+24)<<3,((dlgY+10)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*)buf,(dlgX+24)<<3,((dlgY+10)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cities saved
|
// cities saved
|
||||||
if (p_levelcontrol->levels_completed[4]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL4_TargetName"), (dlgX+1)<<3, (dlgY+8)<<3, 0);
|
if (p_levelcontrol->levels_completed[4]) g_pGraphics->drawFont( getstring("EP2_LVL4_TargetName"), (dlgX+1)<<3, (dlgY+8)<<3, 0);
|
||||||
if (p_levelcontrol->levels_completed[6]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL6_TargetName"), (dlgX+8)<<3, (dlgY+8)<<3, 0);
|
if (p_levelcontrol->levels_completed[6]) g_pGraphics->drawFont( getstring("EP2_LVL6_TargetName"), (dlgX+8)<<3, (dlgY+8)<<3, 0);
|
||||||
if (p_levelcontrol->levels_completed[7]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL7_TargetName"), (dlgX+1)<<3, (dlgY+9)<<3, 0);
|
if (p_levelcontrol->levels_completed[7]) g_pGraphics->drawFont( getstring("EP2_LVL7_TargetName"), (dlgX+1)<<3, (dlgY+9)<<3, 0);
|
||||||
if (p_levelcontrol->levels_completed[13]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL13_TargetName"), (dlgX+8)<<3, (dlgY+9)<<3, 0);
|
if (p_levelcontrol->levels_completed[13]) g_pGraphics->drawFont( getstring("EP2_LVL13_TargetName"), (dlgX+8)<<3, (dlgY+9)<<3, 0);
|
||||||
if (p_levelcontrol->levels_completed[11]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL11_TargetName"), (dlgX+1)<<3, (dlgY+10)<<3, 0);
|
if (p_levelcontrol->levels_completed[11]) g_pGraphics->drawFont( getstring("EP2_LVL11_TargetName"), (dlgX+1)<<3, (dlgY+10)<<3, 0);
|
||||||
if (p_levelcontrol->levels_completed[9]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL9_TargetName"), (dlgX+8)<<3, (dlgY+10)<<3, 0);
|
if (p_levelcontrol->levels_completed[9]) g_pGraphics->drawFont( getstring("EP2_LVL9_TargetName"), (dlgX+8)<<3, (dlgY+10)<<3, 0);
|
||||||
if (p_levelcontrol->levels_completed[15]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL15_TargetName"), (dlgX+1)<<3, (dlgY+11)<<3, 0);
|
if (p_levelcontrol->levels_completed[15]) g_pGraphics->drawFont( getstring("EP2_LVL15_TargetName"), (dlgX+1)<<3, (dlgY+11)<<3, 0);
|
||||||
if (p_levelcontrol->levels_completed[16]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL16_TargetName"), (dlgX+8)<<3, (dlgY+11)<<3, 0);
|
if (p_levelcontrol->levels_completed[16]) g_pGraphics->drawFont( getstring("EP2_LVL16_TargetName"), (dlgX+8)<<3, (dlgY+11)<<3, 0);
|
||||||
|
|
||||||
// raygun icon
|
// raygun icon
|
||||||
g_pGraphics->drawTile_direct((dlgX+20)<<3, ((dlgY+5)<<3)-5, 414);
|
g_pGraphics->drawTile_direct((dlgX+20)<<3, ((dlgY+5)<<3)-5, 414);
|
||||||
@@ -468,17 +461,17 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
// ray gun charges text
|
// ray gun charges text
|
||||||
i = player[p].inventory.charges;
|
i = player[p].inventory.charges;
|
||||||
if (i>999) i=999;
|
if (i>999) i=999;
|
||||||
sprintf(tempbuf, "%d", i);
|
tempbuf = itoa(i);
|
||||||
g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+27-strlen( (char*) tempbuf))<<3, ((dlgY+5)<<3)-1, 0);
|
g_pGraphics->drawFont( tempbuf, (dlgX+27-tempbuf.size())<<3, ((dlgY+5)<<3)-1, 0);
|
||||||
|
|
||||||
// score
|
// score
|
||||||
i = player[p].inventory.score;
|
i = player[p].inventory.score;
|
||||||
sprintf(tempbuf, "%d", i);
|
tempbuf = itoa(i);
|
||||||
g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+12-strlen( (char*) tempbuf))<<3, (dlgY+2)<<3, 0);
|
g_pGraphics->drawFont( tempbuf, (dlgX+12-tempbuf.size())<<3, (dlgY+2)<<3, 0);
|
||||||
// extra life at
|
// extra life at
|
||||||
i = player[p].inventory.extralifeat;
|
i = player[p].inventory.extralifeat;
|
||||||
sprintf(tempbuf, "%d", i);
|
tempbuf = itoa(i);
|
||||||
g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+28-strlen( (char*) tempbuf))<<3, (dlgY+2)<<3, 0);
|
g_pGraphics->drawFont( tempbuf, (dlgX+28-tempbuf.size())<<3, (dlgY+2)<<3, 0);
|
||||||
// lives
|
// lives
|
||||||
i = player[p].inventory.lives;
|
i = player[p].inventory.lives;
|
||||||
x = ((dlgX + 1)<<3)+4;
|
x = ((dlgX + 1)<<3)+4;
|
||||||
@@ -496,7 +489,7 @@ void inventory_draw_ep3(int p)
|
|||||||
//int x,y,t,i,j;
|
//int x,y,t,i,j;
|
||||||
int i,j,x;
|
int i,j,x;
|
||||||
int ankhtimepercent;
|
int ankhtimepercent;
|
||||||
char tempbuf[40];
|
std::string tempbuf;
|
||||||
int dlgX,dlgY,dlgW,dlgH;
|
int dlgX,dlgY,dlgW,dlgH;
|
||||||
|
|
||||||
dlgX = GetStringAttribute("EP3_StatusBox", "LEFT");
|
dlgX = GetStringAttribute("EP3_StatusBox", "LEFT");
|
||||||
@@ -505,14 +498,14 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
dlgH = GetStringAttribute("EP3_StatusBox", "HEIGHT");
|
dlgH = GetStringAttribute("EP3_StatusBox", "HEIGHT");
|
||||||
|
|
||||||
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
g_pGraphics->drawFont( (unsigned char*) getstring("EP3_StatusBox"), (dlgX+1)<<3, (dlgY+1)<<3, 0);
|
g_pGraphics->drawFont( getstring("EP3_StatusBox"), (dlgX+1)<<3, (dlgY+1)<<3, 0);
|
||||||
|
|
||||||
// calculate % ankh time left
|
// calculate % ankh time left
|
||||||
ankhtimepercent = (int)((float)player[p].ankhtime / (PLAY_ANKH_TIME/100));
|
ankhtimepercent = (int)((float)player[p].ankhtime / (PLAY_ANKH_TIME/100));
|
||||||
// ankh time
|
// ankh time
|
||||||
g_pGraphics->drawTile_direct((dlgX+4)<<3, ((dlgY+8)<<3)+3, 214);
|
g_pGraphics->drawTile_direct((dlgX+4)<<3, ((dlgY+8)<<3)+3, 214);
|
||||||
sprintf(tempbuf, "%d", ankhtimepercent);
|
tempbuf = itoa(ankhtimepercent);
|
||||||
g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+8)<<3, ((dlgY+8)<<3)+7, 0);
|
g_pGraphics->drawFont( tempbuf, (dlgX+8)<<3, ((dlgY+8)<<3)+7, 0);
|
||||||
|
|
||||||
// raygun icon
|
// raygun icon
|
||||||
g_pGraphics->drawTile_direct((dlgX+23)<<3, ((dlgY+5)<<3)-5, 216);
|
g_pGraphics->drawTile_direct((dlgX+23)<<3, ((dlgY+5)<<3)-5, 216);
|
||||||
@@ -520,8 +513,8 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
// ray gun charges text
|
// ray gun charges text
|
||||||
i = player[p].inventory.charges;
|
i = player[p].inventory.charges;
|
||||||
if (i>999) i=999;
|
if (i>999) i=999;
|
||||||
sprintf(tempbuf, "%d", i);
|
tempbuf = itoa(i);
|
||||||
g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+26)<<3, ((dlgY+5)<<3)-1, 0);
|
g_pGraphics->drawFont( tempbuf, (dlgX+26)<<3, ((dlgY+5)<<3)-1, 0);
|
||||||
|
|
||||||
// cards
|
// cards
|
||||||
if (player[p].inventory.HasCardYellow)
|
if (player[p].inventory.HasCardYellow)
|
||||||
@@ -529,9 +522,8 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
g_pGraphics->drawTile_direct(((dlgX+14)<<3)+4, ((dlgY+8)<<3)+4, 217);
|
g_pGraphics->drawTile_direct(((dlgX+14)<<3)+4, ((dlgY+8)<<3)+4, 217);
|
||||||
if(player[p].inventory.HasCardYellow > 1)
|
if(player[p].inventory.HasCardYellow > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardYellow);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardYellow);
|
g_pGraphics->drawFont(buf,(dlgX+13)<<3,((dlgY+8)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*)buf,(dlgX+13)<<3,((dlgY+8)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player[p].inventory.HasCardRed)
|
if (player[p].inventory.HasCardRed)
|
||||||
@@ -539,9 +531,8 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
g_pGraphics->drawTile_direct(((dlgX+18)<<3)+4, ((dlgY+8)<<3)+4, 218);
|
g_pGraphics->drawTile_direct(((dlgX+18)<<3)+4, ((dlgY+8)<<3)+4, 218);
|
||||||
if(player[p].inventory.HasCardRed > 1)
|
if(player[p].inventory.HasCardRed > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardRed);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardRed);
|
g_pGraphics->drawFont(buf,(dlgX+17)<<3,((dlgY+8)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*)buf,(dlgX+17)<<3,((dlgY+8)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player[p].inventory.HasCardGreen)
|
if (player[p].inventory.HasCardGreen)
|
||||||
@@ -549,9 +540,8 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
g_pGraphics->drawTile_direct(((dlgX+22)<<3)+4, ((dlgY+8)<<3)+4, 219);
|
g_pGraphics->drawTile_direct(((dlgX+22)<<3)+4, ((dlgY+8)<<3)+4, 219);
|
||||||
if(player[p].inventory.HasCardGreen > 1)
|
if(player[p].inventory.HasCardGreen > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardGreen);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardGreen);
|
g_pGraphics->drawFont(buf,(dlgX+21)<<3,((dlgY+8)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*)buf,(dlgX+21)<<3,((dlgY+8)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player[p].inventory.HasCardBlue)
|
if (player[p].inventory.HasCardBlue)
|
||||||
@@ -559,20 +549,19 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
g_pGraphics->drawTile_direct(((dlgX+26)<<3)+4, ((dlgY+8)<<3)+4, 220);
|
g_pGraphics->drawTile_direct(((dlgX+26)<<3)+4, ((dlgY+8)<<3)+4, 220);
|
||||||
if(player[p].inventory.HasCardBlue > 1)
|
if(player[p].inventory.HasCardBlue > 1)
|
||||||
{
|
{
|
||||||
char buf[10];
|
std::string buf = itoa(player[p].inventory.HasCardBlue);
|
||||||
sprintf(buf,"%d",player[p].inventory.HasCardBlue);
|
g_pGraphics->drawFont(buf,(dlgX+25)<<3,((dlgY+8)<<3)+3,0);
|
||||||
g_pGraphics->drawFont((unsigned char*)buf,(dlgX+25)<<3,((dlgY+8)<<3)+3,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// score
|
// score
|
||||||
i = player[p].inventory.score;
|
i = player[p].inventory.score;
|
||||||
sprintf(tempbuf, "%d", i);
|
tempbuf = itoa(i);
|
||||||
g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+12-strlen(tempbuf))<<3, (dlgY+2)<<3, 0);
|
g_pGraphics->drawFont( tempbuf, (dlgX+12-tempbuf.size())<<3, (dlgY+2)<<3, 0);
|
||||||
// extra life at
|
// extra life at
|
||||||
i = player[p].inventory.extralifeat;
|
i = player[p].inventory.extralifeat;
|
||||||
sprintf(tempbuf, "%d", i);
|
tempbuf = itoa(i);
|
||||||
g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+28-strlen(tempbuf))<<3, (dlgY+2)<<3, 0);
|
g_pGraphics->drawFont( tempbuf, (dlgX+28-tempbuf.size())<<3, (dlgY+2)<<3, 0);
|
||||||
// lives
|
// lives
|
||||||
i = player[p].inventory.lives;
|
i = player[p].inventory.lives;
|
||||||
x = ((dlgX+1)<<3)+4;
|
x = ((dlgX+1)<<3)+4;
|
||||||
@@ -667,7 +656,7 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
|
|
||||||
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
|
|
||||||
g_pGraphics->drawFont( (unsigned char*) getstring("EP1_SHIP"), (dlgX+1)<<3, (dlgY+1)<<3,0);
|
g_pGraphics->drawFont( getstring("EP1_SHIP"), (dlgX+1)<<3, (dlgY+1)<<3,0);
|
||||||
|
|
||||||
// draw needed parts
|
// draw needed parts
|
||||||
if (!player[cp].inventory.HasJoystick)
|
if (!player[cp].inventory.HasJoystick)
|
||||||
@@ -713,7 +702,7 @@ const int twirlspeed = 100;
|
|||||||
twirlY = GetStringAttribute(strname, "TWIRLY");
|
twirlY = GetStringAttribute(strname, "TWIRLY");
|
||||||
|
|
||||||
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
g_pGraphics->drawFont( (unsigned char*) getstring(strname), (dlgX+1)<<3, (dlgY+1)<<3,0);
|
g_pGraphics->drawFont( getstring(strname), (dlgX+1)<<3, (dlgY+1)<<3,0);
|
||||||
|
|
||||||
g_pVideoDriver->update_screen();
|
g_pVideoDriver->update_screen();
|
||||||
|
|
||||||
@@ -882,7 +871,7 @@ char save_slot_box(int issave, stCloneKeenPlus *pCKP)
|
|||||||
{
|
{
|
||||||
char saveslot;
|
char saveslot;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char fname[40];
|
std::string fname;
|
||||||
char slotexists;
|
char slotexists;
|
||||||
int x, bmnum;
|
int x, bmnum;
|
||||||
int dlgX,dlgY,dlgW,dlgH;
|
int dlgX,dlgY,dlgW,dlgH;
|
||||||
@@ -919,11 +908,11 @@ top: ;
|
|||||||
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
if (issave)
|
if (issave)
|
||||||
{
|
{
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) getstring("WhichSlotSave"),(dlgX+1)<<3,(dlgY+1)<<3);
|
g_pGraphics->sb_font_draw( getstring("WhichSlotSave"),(dlgX+1)<<3,(dlgY+1)<<3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) getstring("WhichSlotLoad"),(dlgX+1)<<3,(dlgY+1)<<3);
|
g_pGraphics->sb_font_draw( getstring("WhichSlotLoad"),(dlgX+1)<<3,(dlgY+1)<<3);
|
||||||
gamedo_AnimatedTiles();
|
gamedo_AnimatedTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -941,9 +930,13 @@ top: ;
|
|||||||
} while(!g_pInput->getPressedKey(KQUIT) && !saveslot);
|
} while(!g_pInput->getPressedKey(KQUIT) && !saveslot);
|
||||||
|
|
||||||
/* check if the selected save file exists */
|
/* check if the selected save file exists */
|
||||||
sprintf(fname, "ep%csave%c.dat", p_levelcontrol->episode+'0', saveslot+'0');
|
fname = "ep";
|
||||||
|
fname += p_levelcontrol->episode+'0';
|
||||||
|
fname += "save";
|
||||||
|
fname += saveslot+'0';
|
||||||
|
fname += ".dat";
|
||||||
slotexists = 0;
|
slotexists = 0;
|
||||||
fp = fopen(fname, "rb");
|
fp = fopen(fname.c_str(), "rb");
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@@ -981,7 +974,7 @@ top: ;
|
|||||||
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
if (issave)
|
if (issave)
|
||||||
{
|
{
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) getstring("SaveSlotOverwrite"),(dlgX+1)<<3,(dlgY+1)<<3);
|
g_pGraphics->sb_font_draw( getstring("SaveSlotOverwrite"),(dlgX+1)<<3,(dlgY+1)<<3);
|
||||||
if (g_pInput->getPressedKey(KN))
|
if (g_pInput->getPressedKey(KN))
|
||||||
{
|
{
|
||||||
map_redraw();
|
map_redraw();
|
||||||
@@ -995,7 +988,7 @@ top: ;
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) getstring("LoadNoSuchSlot"),(dlgX+1)<<3,(dlgY+1)<<3);
|
g_pGraphics->sb_font_draw( getstring("LoadNoSuchSlot"),(dlgX+1)<<3,(dlgY+1)<<3);
|
||||||
|
|
||||||
if (g_pInput->getPressedAnyKey())
|
if (g_pInput->getPressedAnyKey())
|
||||||
{
|
{
|
||||||
@@ -1046,7 +1039,7 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
gamedo_render_drawobjects(pCKP);
|
gamedo_render_drawobjects(pCKP);
|
||||||
|
|
||||||
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) getstring("GameSaveSuccess"),(dlgX+1)<<3,(dlgY+1)<<3);
|
g_pGraphics->sb_font_draw( getstring("GameSaveSuccess"),(dlgX+1)<<3,(dlgY+1)<<3);
|
||||||
|
|
||||||
g_pVideoDriver->sb_blit();
|
g_pVideoDriver->sb_blit();
|
||||||
gamedo_render_eraseobjects();
|
gamedo_render_eraseobjects();
|
||||||
@@ -1061,7 +1054,7 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
int VerifyQuit(stCloneKeenPlus *pCKP)
|
int VerifyQuit(stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
int dlgX,dlgY,dlgW,dlgH;
|
int dlgX,dlgY,dlgW,dlgH;
|
||||||
char *text;
|
std::string text;
|
||||||
|
|
||||||
if (fade.mode==FADE_GO) return NO_QUIT;
|
if (fade.mode==FADE_GO) return NO_QUIT;
|
||||||
|
|
||||||
@@ -1079,7 +1072,7 @@ char *text;
|
|||||||
gamedo_AnimatedTiles();
|
gamedo_AnimatedTiles();
|
||||||
|
|
||||||
sb_dialogbox(dlgX, dlgY, dlgW, dlgH);
|
sb_dialogbox(dlgX, dlgY, dlgW, dlgH);
|
||||||
g_pGraphics->sb_font_draw( (unsigned char*) text, (dlgX+1)<<3, (dlgY+1)<<3);
|
g_pGraphics->sb_font_draw( text, (dlgX+1)<<3, (dlgY+1)<<3);
|
||||||
if (g_pInput->getPressedKey(KQ))
|
if (g_pInput->getPressedKey(KQ))
|
||||||
{
|
{
|
||||||
map_redraw();
|
map_redraw();
|
||||||
@@ -1347,7 +1340,7 @@ void showTextMB(int lines, char **text, stCloneKeenPlus *pCKP)
|
|||||||
|
|
||||||
for(i=0;i<lines;i++)
|
for(i=0;i<lines;i++)
|
||||||
{
|
{
|
||||||
g_pGraphics->drawFont((unsigned char*) text[i], (dlgX+1)<<3, (dlgY+1+i)<<3,0);
|
g_pGraphics->drawFont(text[i], (dlgX+1)<<3, (dlgY+1+i)<<3,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
twirlframe = 0;
|
twirlframe = 0;
|
||||||
|
|||||||
@@ -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);
|
|
||||||
|
|
||||||
sprintf(buf,"keen%d.exe",Episode);
|
buf = "keen" + itoa(Episode) + ".exe";
|
||||||
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);
|
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());
|
||||||
extractOfExeFile(buffer, Episode);
|
extractOfExeFile(formatPathString(path), 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)
|
||||||
|
// TODO: print error
|
||||||
|
return;
|
||||||
|
curTextList = curTextList->nextElement;
|
||||||
|
}
|
||||||
|
|
||||||
for(i=0 ; i<pos ; i++)
|
curTextList->text = text;
|
||||||
curTextList = (stTextList*) curTextList->nextElement;
|
|
||||||
|
|
||||||
memset(curTextList->text,0,TEXT_LENGTH);
|
|
||||||
strcpy(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