This commit is contained in:
Paul 2001-05-09 20:15:01 +00:00
parent 5f86af045b
commit 84cc92f6e4
7 changed files with 89 additions and 22 deletions

View file

@ -88,10 +88,10 @@ void CGameSlotManager::setActiveSlot(unsigned int _slot)
Params:
Returns:
---------------------------------------------------------------------- */
CGameSlotManager::GameSlot CGameSlotManager::getSlotData()
CGameSlotManager::GameSlot *CGameSlotManager::getSlotData()
{
ASSERT(s_currentGameSlot!=0);
return *s_currentGameSlot;
return s_currentGameSlot;
}
@ -119,6 +119,7 @@ void CGameSlotManager::eraseGameSlot(unsigned int _slot)
ASSERT(_slot<=NUM_GAME_SLOTS);
GameSlot *slot;
int i,j;
slot=&s_gameSlots[_slot];
@ -126,6 +127,13 @@ void CGameSlotManager::eraseGameSlot(unsigned int _slot)
slot->m_lives=INITIAL_LIVES;
slot->m_continues=INITIAL_CONTINUES;
slot->m_maxLevelCompleted=0;
for(i=0;i<NUM_CHAPTERS*NUM_LEVELS;i++)
{
for(j=0;j<8;j++)
{
slot->m_spatulaCollectedFlags[i][j]=0;
}
}
}

View file

@ -38,34 +38,62 @@ public:
INITIAL_CONTINUES=3,
NUM_GAME_SLOTS=4,
NUM_CHAPTERS=5,
NUM_LEVELS=6,
};
typedef struct
{
int m_isInUse;
int m_lives;
int m_continues;
int m_maxLevelCompleted;
unsigned char m_isInUse;
unsigned char m_lives;
unsigned char m_continues;
unsigned char m_maxLevelCompleted;
unsigned char m_spatulaCollectedFlags[NUM_CHAPTERS*NUM_LEVELS][8]; // Enuf space for 64 spats per level
int getSpatulaCollectedCount(int _chapter,int _level)
{
int i,j,count;
count=0;
for(i=0;i<8;i++)
{
unsigned char flags=m_spatulaCollectedFlags[(_chapter*NUM_LEVELS)+_level][i];
for(j=0;j<8;j++)
{
if(flags&1)count++;
flags>>=1;
}
}
return count;
}
void collectSpatula(int _chapter,int _level,int _spat)
{
m_spatulaCollectedFlags[(_chapter*NUM_LEVELS)+_level][_spat>>3]|=1<<(_spat&7);
}
int isSpatulaUncollected(int _chapter,int _level,int _spat)
{
return (m_spatulaCollectedFlags[(_chapter*NUM_LEVELS)+_level][_spat>>3]>>(_spat&7))&1?false:true;
}
} GameSlot;
static void init();
static void init();
static void setActiveSlot(unsigned int _slot);
static GameSlot *getSlotData();
static void setSlotData(GameSlot *_data);
static void setActiveSlot(unsigned int _slot);
static GameSlot getSlotData();
static void setSlotData(GameSlot *_data);
static void eraseGameSlot(unsigned int _slot);
static void copyGameSlot(unsigned int _src,unsigned int _dest);
static void eraseGameSlot(unsigned int _slot);
static void copyGameSlot(unsigned int _src,unsigned int _dest);
private:
static GameSlot s_gameSlots[NUM_GAME_SLOTS];
static GameSlot *s_currentGameSlot;
static GameSlot s_gameSlots[NUM_GAME_SLOTS];
static GameSlot *s_currentGameSlot;
// These allow the CSaveLoadDatabase total access to the game slots
static void setSlotData(int _slot,GameSlot *_data);
static GameSlot getSlotData(int _slot);
static void setSlotData(int _slot,GameSlot *_data);
static GameSlot getSlotData(int _slot);
friend class CSaveLoadDatabase;