cleanup
git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@142 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
@@ -291,8 +291,6 @@ void CGame::preallocateCKP(stCloneKeenPlus *pCKP)
|
||||
demomode = DEMO_NODEMO;
|
||||
current_demo = 1;
|
||||
|
||||
memset(&pCKP->Control, 0, sizeof(stControl));
|
||||
|
||||
pCKP->Joystick = NULL;
|
||||
|
||||
acceleratemode = 0;
|
||||
|
||||
@@ -48,7 +48,7 @@ bool CGraphics::allocScrollBufmem(void)
|
||||
if (g_pVideoDriver->getZoomValue() > 1)
|
||||
{
|
||||
g_pLogFile->ftextOut("allocmem(): allocating %d bytes for blit buffer...", blitbuf_memsize);
|
||||
blitbuffer = (unsigned char*) malloc(blitbuf_memsize);
|
||||
blitbuffer = new unsigned char[blitbuf_memsize];
|
||||
if (!blitbuffer)
|
||||
{
|
||||
g_pLogFile->ftextOut(RED,"Failure<br>");
|
||||
@@ -63,12 +63,12 @@ void CGraphics::freemem(void)
|
||||
{
|
||||
if (scrollbuffer)
|
||||
{
|
||||
delete[] scrollbuffer;
|
||||
delete[] scrollbuffer; scrollbuffer = NULL;
|
||||
g_pLogFile->ftextOut(BLACK,true," Scrollbuffer memory released to system.<br>");
|
||||
}
|
||||
if (blitbuffer)
|
||||
{
|
||||
free(blitbuffer);
|
||||
delete[] blitbuffer; blitbuffer = NULL;
|
||||
g_pLogFile->ftextOut(BLACK,true," Blitbuffer memory released to system.<br>");
|
||||
}
|
||||
}
|
||||
|
||||
2977
src/game.cpp
2977
src/game.cpp
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <SDL.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#define MAX_COMMANDS 8
|
||||
#define MAX_SOUND_LENGTH 1024
|
||||
@@ -11,7 +12,7 @@
|
||||
|
||||
#define MAX_NUMBER_OF_FILES 100
|
||||
|
||||
typedef struct stDisplay
|
||||
struct stDisplay
|
||||
{
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
@@ -21,15 +22,18 @@ typedef struct stDisplay
|
||||
short Filtermode;
|
||||
short Zoom;
|
||||
unsigned short FrameSkip;
|
||||
} stDisplay;
|
||||
|
||||
// as long as we only have POD
|
||||
stDisplay() { memset(this, 0, sizeof(stDisplay)); }
|
||||
};
|
||||
|
||||
typedef struct stDevice
|
||||
struct stDevice
|
||||
{
|
||||
SDL_Joystick *Joystick;
|
||||
SDL_Event Event;
|
||||
} stDevice;
|
||||
};
|
||||
|
||||
typedef struct stLevelControl
|
||||
struct stLevelControl
|
||||
{
|
||||
// level control
|
||||
int command; // used to give a command to playgame_levelmanager()
|
||||
@@ -57,18 +61,23 @@ typedef struct stLevelControl
|
||||
unsigned int level_done, level_done_timer;
|
||||
unsigned int level_finished_by; // index of player that finished level
|
||||
unsigned int exitXpos;
|
||||
} stLevelControl;
|
||||
|
||||
// as long as we only have POD
|
||||
stLevelControl() { memset(this, 0, sizeof(stLevelControl)); }
|
||||
};
|
||||
|
||||
|
||||
typedef struct stControl
|
||||
struct stControl
|
||||
{
|
||||
short eseq; // see only the ending sequence
|
||||
short dtm; // go direct to map.
|
||||
short storyboard; // go to storyboard
|
||||
short skipstarting; // Skip Startmenu, Intro and Mainmenu.
|
||||
bool eseq; // see only the ending sequence
|
||||
bool dtm; // go direct to map.
|
||||
bool storyboard; // go to storyboard
|
||||
bool skipstarting; // Skip Startmenu, Intro and Mainmenu.
|
||||
|
||||
stLevelControl levelcontrol;
|
||||
} stControl;
|
||||
|
||||
stControl() : eseq(false), dtm(false), storyboard(false), skipstarting(false) {}
|
||||
};
|
||||
|
||||
struct stGameData
|
||||
{
|
||||
|
||||
@@ -8,50 +8,52 @@
|
||||
* Author: gerstrong
|
||||
*/
|
||||
|
||||
#ifndef __CG_DIALIG_H__
|
||||
#define __CG_DIALIG_H__
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#define STARTER_SAVE 1
|
||||
#define STARTER_ESCAPE 2
|
||||
#define STARTER_SOUNDOPT 3
|
||||
#define STARTER_DISPLAYOPT 4
|
||||
#define STARTER_GAMEOPT 5
|
||||
|
||||
typedef struct stTextLine
|
||||
struct stTextLine
|
||||
{
|
||||
char *Text;
|
||||
std::string Text;
|
||||
short ID; // items are orded by ID
|
||||
} stTextLine;
|
||||
};
|
||||
|
||||
typedef struct stSeparator
|
||||
struct stSeparator
|
||||
{
|
||||
short ID; // items are orded by ID
|
||||
} stSeparator;
|
||||
};
|
||||
|
||||
|
||||
typedef struct stOptionSwitch
|
||||
struct stOptionSwitch
|
||||
{
|
||||
char *Name;
|
||||
char **Option;
|
||||
short selected;
|
||||
short numSel;
|
||||
short ID; // items are orded by ID
|
||||
} stOptionSwitch;
|
||||
};
|
||||
|
||||
typedef struct stStarterSwitch
|
||||
struct stStarterSwitch
|
||||
{
|
||||
char *Name;
|
||||
std::string Name;
|
||||
int numFunctionToLaunch;
|
||||
short ID; // items are sorted by IDs
|
||||
} stStarterSwitch;
|
||||
};
|
||||
|
||||
typedef struct stDlgStruct // imagine every substructure as typical control
|
||||
struct stDlgStruct // imagine every substructure as typical control
|
||||
{
|
||||
stTextLine *TextLine;
|
||||
stOptionSwitch *OptionSwitch;
|
||||
stStarterSwitch *StarterSwitch;
|
||||
stSeparator *Separator;
|
||||
std::vector<std::string> TextLine;
|
||||
std::vector<stOptionSwitch> OptionSwitch;
|
||||
std::vector<stStarterSwitch> StarterSwitch;
|
||||
std::vector<stSeparator> Separator;
|
||||
};
|
||||
|
||||
short num_TextLines;
|
||||
short num_OptionSwitches;
|
||||
short num_StarterSwitch;
|
||||
short num_Separators;
|
||||
|
||||
} stDlgStruct;
|
||||
#endif
|
||||
|
||||
104
src/keen.h
104
src/keen.h
@@ -119,15 +119,15 @@ typedef struct stMap
|
||||
#define BDOWN 4
|
||||
#define BLEFT 5
|
||||
|
||||
typedef struct stBitmap
|
||||
struct stBitmap
|
||||
{
|
||||
int xsize;
|
||||
int ysize;
|
||||
unsigned char *bmptr;
|
||||
char name[9];
|
||||
} stBitmap;
|
||||
};
|
||||
|
||||
typedef struct stSprite
|
||||
struct stSprite
|
||||
{
|
||||
char xsize, ysize;
|
||||
unsigned char imgdata[64][64];
|
||||
@@ -135,9 +135,9 @@ typedef struct stSprite
|
||||
// bounding box for hit detection
|
||||
unsigned int bboxX1, bboxY1;
|
||||
unsigned int bboxX2, bboxY2;
|
||||
} stSprite;
|
||||
};
|
||||
|
||||
typedef struct stInventory
|
||||
struct stInventory
|
||||
{
|
||||
unsigned long score;
|
||||
unsigned long extralifeat;
|
||||
@@ -153,7 +153,7 @@ typedef struct stInventory
|
||||
unsigned char HasFuel;
|
||||
unsigned char HasBattery;
|
||||
unsigned char HasVacuum;
|
||||
} stInventory;
|
||||
};
|
||||
|
||||
// for strings loaded from "strings.dat"
|
||||
#define MAX_STRINGS 100
|
||||
@@ -169,7 +169,7 @@ struct stString
|
||||
};
|
||||
|
||||
/* Structs used for different enemies data, these are in a union */
|
||||
typedef struct stYorpData
|
||||
struct stYorpData
|
||||
{
|
||||
unsigned char state;
|
||||
|
||||
@@ -180,8 +180,9 @@ typedef struct stYorpData
|
||||
signed int yorpdie_inertia_y;
|
||||
|
||||
unsigned char movedir;
|
||||
} stYorpData;
|
||||
typedef struct stGargData
|
||||
};
|
||||
|
||||
struct stGargData
|
||||
{
|
||||
unsigned char state;
|
||||
|
||||
@@ -194,8 +195,9 @@ typedef struct stGargData
|
||||
|
||||
unsigned char movedir;
|
||||
unsigned char detectedPlayer, detectedPlayerIndex;
|
||||
} stGargData;
|
||||
typedef struct stVortData
|
||||
};
|
||||
|
||||
struct stVortData
|
||||
{
|
||||
unsigned char state;
|
||||
|
||||
@@ -218,8 +220,9 @@ typedef struct stVortData
|
||||
int JumpLeftFrame;
|
||||
int DyingFrame;
|
||||
int DeadFrame;
|
||||
} stVortData;
|
||||
typedef struct stBearData
|
||||
};
|
||||
|
||||
struct stBearData
|
||||
{
|
||||
unsigned char state;
|
||||
|
||||
@@ -232,8 +235,9 @@ typedef struct stBearData
|
||||
unsigned int running;
|
||||
|
||||
int dist_traveled;
|
||||
} stBearData;
|
||||
typedef struct stButlerData
|
||||
};
|
||||
|
||||
struct stButlerData
|
||||
{
|
||||
unsigned char state;
|
||||
unsigned char timer,animtimer;
|
||||
@@ -241,8 +245,9 @@ typedef struct stButlerData
|
||||
unsigned int dist_traveled;
|
||||
|
||||
unsigned char movedir;
|
||||
} stButlerData;
|
||||
typedef struct stTankData
|
||||
};
|
||||
|
||||
struct stTankData
|
||||
{
|
||||
unsigned char state;
|
||||
|
||||
@@ -264,8 +269,9 @@ typedef struct stTankData
|
||||
unsigned int firetimes;
|
||||
unsigned int timetillcanfire;
|
||||
unsigned int timetillcanfirecauseonsamelevel;
|
||||
} stTankData;
|
||||
typedef struct stRayData
|
||||
};
|
||||
|
||||
struct stRayData
|
||||
{
|
||||
char state;
|
||||
char direction;
|
||||
@@ -280,20 +286,23 @@ typedef struct stRayData
|
||||
|
||||
// for earth chunks
|
||||
int baseframe;
|
||||
} stRayData;
|
||||
typedef struct stDoorData
|
||||
};
|
||||
|
||||
struct stDoorData
|
||||
{
|
||||
char timer;
|
||||
char distance_traveled;
|
||||
} stDoorData;
|
||||
typedef struct stIceChunk
|
||||
};
|
||||
|
||||
struct stIceChunk
|
||||
{
|
||||
char movedir;
|
||||
char state;
|
||||
unsigned int originalX, originalY;
|
||||
int timer;
|
||||
} stIceChunk;
|
||||
typedef struct stTeleportData
|
||||
};
|
||||
|
||||
struct stTeleportData
|
||||
{
|
||||
char animtimer;
|
||||
char animframe;
|
||||
@@ -312,17 +321,18 @@ typedef struct stTeleportData
|
||||
|
||||
char fadeamt;
|
||||
char fadetimer;
|
||||
} stTeleportData;
|
||||
typedef struct stRopeData
|
||||
};
|
||||
|
||||
struct stRopeData
|
||||
{
|
||||
char state;
|
||||
int droptimer;
|
||||
int droptimes;
|
||||
int stoneX, stoneY;
|
||||
int vortboss;
|
||||
} stRopeData;
|
||||
};
|
||||
|
||||
typedef struct stWalkerData
|
||||
struct stWalkerData
|
||||
{
|
||||
unsigned char state;
|
||||
|
||||
@@ -333,9 +343,9 @@ typedef struct stWalkerData
|
||||
|
||||
unsigned char walkdir;
|
||||
unsigned char kickedplayer[MAX_PLAYERS];
|
||||
} stWalkerData;
|
||||
};
|
||||
|
||||
typedef struct stPlatformData
|
||||
struct stPlatformData
|
||||
{
|
||||
unsigned char state;
|
||||
unsigned char animframe;
|
||||
@@ -344,9 +354,9 @@ typedef struct stPlatformData
|
||||
|
||||
unsigned char movedir;
|
||||
unsigned char kickedplayer[MAX_PLAYERS];
|
||||
} stPlatformData;
|
||||
};
|
||||
|
||||
typedef struct stSEData
|
||||
struct stSEData
|
||||
{
|
||||
unsigned int type;
|
||||
|
||||
@@ -360,9 +370,9 @@ typedef struct stSEData
|
||||
unsigned int frame;
|
||||
int mx,my;
|
||||
int blowx,blowy;
|
||||
} stSEData;
|
||||
};
|
||||
|
||||
typedef struct stBabyData
|
||||
struct stBabyData
|
||||
{
|
||||
char state;
|
||||
char dir;
|
||||
@@ -373,9 +383,9 @@ typedef struct stBabyData
|
||||
|
||||
char walkframe;
|
||||
int walktimer;
|
||||
} stBabyData;
|
||||
};
|
||||
|
||||
typedef struct stFoobData
|
||||
struct stFoobData
|
||||
{
|
||||
char state;
|
||||
char dir;
|
||||
@@ -385,9 +395,9 @@ typedef struct stFoobData
|
||||
int OffOfSameLevelTime;
|
||||
int spooktimer;
|
||||
int SpookedByWho;
|
||||
} stFoobData;
|
||||
};
|
||||
|
||||
typedef struct stNinjaData
|
||||
struct stNinjaData
|
||||
{
|
||||
char state;
|
||||
char dir;
|
||||
@@ -401,7 +411,7 @@ typedef struct stNinjaData
|
||||
int KickMoveTimer;
|
||||
int isdying;
|
||||
int dietimer;
|
||||
} stNinjaData;
|
||||
};
|
||||
|
||||
typedef struct stMotherData
|
||||
{
|
||||
@@ -644,7 +654,7 @@ typedef struct stAnimTile
|
||||
#define SCROLLTRIGGERDOWN 114
|
||||
|
||||
// this structure contains all the variables used by a player
|
||||
typedef struct stPlayer
|
||||
struct stPlayer
|
||||
{
|
||||
// these coordinates are CSFed
|
||||
unsigned long x;
|
||||
@@ -726,7 +736,9 @@ typedef struct stPlayer
|
||||
unsigned int ankhtime, ankhshieldobject;
|
||||
|
||||
stInventory inventory;
|
||||
} stPlayer;
|
||||
|
||||
stPlayer() { memset(this, 0, sizeof(stPlayer)); }
|
||||
};
|
||||
|
||||
typedef struct stShipQueue
|
||||
{
|
||||
@@ -845,7 +857,7 @@ typedef struct stShipQueue
|
||||
#include "keenext.h"
|
||||
#include "sdl/CSettings.h"
|
||||
|
||||
typedef struct stCloneKeenPlus
|
||||
struct stCloneKeenPlus
|
||||
{
|
||||
stCommand Command[MAX_COMMANDS];
|
||||
SDL_Joystick *Joystick;
|
||||
@@ -857,7 +869,11 @@ typedef struct stCloneKeenPlus
|
||||
stOption Option[NUM_OPTIONS];
|
||||
unsigned short numGames;
|
||||
unsigned short shutdown;
|
||||
}stCloneKeenPlus;
|
||||
|
||||
stCloneKeenPlus() : Joystick(NULL), GameData(NULL), numGames(0), shutdown(SHUTDOWN_NONE) {
|
||||
memset(&Event, 0, sizeof(Event));
|
||||
}
|
||||
};
|
||||
|
||||
// keen.c
|
||||
void playgame_levelmanager(stCloneKeenPlus *pCKP);
|
||||
|
||||
@@ -360,14 +360,6 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
|
||||
return selection;
|
||||
}
|
||||
|
||||
void initialiazeDlgStruct(stDlgStruct *pDlgStruct)
|
||||
{
|
||||
pDlgStruct->OptionSwitch = (stOptionSwitch*) malloc(pDlgStruct->num_OptionSwitches*sizeof(stOptionSwitch));
|
||||
pDlgStruct->Separator = (stSeparator*) malloc(pDlgStruct->num_Separators*sizeof(stSeparator));
|
||||
pDlgStruct->StarterSwitch = (stStarterSwitch*) malloc(pDlgStruct->num_StarterSwitch*sizeof(stStarterSwitch));
|
||||
pDlgStruct->TextLine = (stTextLine*) malloc(pDlgStruct->num_TextLines*sizeof(stTextLine));
|
||||
}
|
||||
|
||||
int getDifficulty(stCloneKeenPlus *pCKP)
|
||||
{
|
||||
CDialog *DifficultyMenu;
|
||||
|
||||
Reference in New Issue
Block a user