SBSPSS/source/game/gameslot.cpp

183 lines
4.0 KiB
C++
Raw Normal View History

2001-01-10 22:43:17 +01:00
/*=========================================================================
gameslot.cpp
Author: PKG
Created:
Project: Spongebob
Purpose:
2001-01-10 23:03:20 +01:00
Copyright (c) 2001 Climax Development Ltd
2001-01-10 22:43:17 +01:00
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
#include "game\gameslot.h"
#ifndef __SYSTEM_DBG_H__
#include "system\dbg.h"
#endif
/* Std Lib
------- */
/* Data
---- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
CGameSlotManager::GameSlot CGameSlotManager::s_gameSlots[4];
CGameSlotManager::GameSlot *CGameSlotManager::s_currentGameSlot=0;
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGameSlotManager::init()
{
int i;
for(i=0;i<NUM_GAME_SLOTS;i++)
{
eraseGameSlot(i);
}
setActiveSlot(0);
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGameSlotManager::setActiveSlot(unsigned int _slot)
{
ASSERT(_slot<=NUM_GAME_SLOTS);
s_currentGameSlot=&s_gameSlots[_slot];
2001-01-11 16:51:31 +01:00
s_currentGameSlot->m_isInUse=true;
2001-01-10 22:43:17 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-05-09 22:15:01 +02:00
CGameSlotManager::GameSlot *CGameSlotManager::getSlotData()
2001-01-10 22:43:17 +01:00
{
ASSERT(s_currentGameSlot!=0);
2001-05-09 22:15:01 +02:00
return s_currentGameSlot;
2001-01-10 22:43:17 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGameSlotManager::setSlotData(GameSlot *_data)
{
ASSERT(s_currentGameSlot!=0);
*s_currentGameSlot=*_data;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGameSlotManager::eraseGameSlot(unsigned int _slot)
{
ASSERT(_slot<=NUM_GAME_SLOTS);
GameSlot *slot;
2001-05-09 22:15:01 +02:00
int i,j;
2001-01-10 22:43:17 +01:00
slot=&s_gameSlots[_slot];
2001-01-11 16:51:31 +01:00
slot->m_isInUse=false;
2001-01-10 22:43:17 +01:00
slot->m_lives=INITIAL_LIVES;
slot->m_continues=INITIAL_CONTINUES;
slot->m_maxLevelCompleted=0;
2001-05-09 22:15:01 +02:00
for(i=0;i<NUM_CHAPTERS*NUM_LEVELS;i++)
{
for(j=0;j<8;j++)
{
slot->m_spatulaCollectedFlags[i][j]=0;
}
}
2001-01-10 22:43:17 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGameSlotManager::copyGameSlot(unsigned int _src,unsigned int _dest)
{
ASSERT(_src<=NUM_GAME_SLOTS);
ASSERT(_dest<=NUM_GAME_SLOTS);
s_gameSlots[_dest]=s_gameSlots[_src];
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGameSlotManager::setSlotData(int _slot,GameSlot *_data)
{
ASSERT(_slot<=NUM_GAME_SLOTS);
s_gameSlots[_slot]=*_data;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
CGameSlotManager::GameSlot CGameSlotManager::getSlotData(int _slot)
{
ASSERT(_slot<=NUM_GAME_SLOTS);
return s_gameSlots[_slot];
}
/*===========================================================================
end */