Remove unused code. Make some variables static.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3889 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
2465552376
commit
70483d1c82
109
src/levels.c
109
src/levels.c
|
@ -43,18 +43,12 @@
|
||||||
#include "lib/ivis_common/piestate.h"
|
#include "lib/ivis_common/piestate.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "lib/ivis_common/ivi.h"
|
#include "lib/ivis_common/ivi.h"
|
||||||
|
|
||||||
//#ifdef DEBUG
|
|
||||||
#include "lib/script/script.h"
|
#include "lib/script/script.h"
|
||||||
#include "scripttabs.h"
|
#include "scripttabs.h"
|
||||||
//#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// minimum type number for a type instruction
|
// minimum type number for a type instruction
|
||||||
#define MULTI_TYPE_START 10
|
#define MULTI_TYPE_START 10
|
||||||
|
|
||||||
|
|
||||||
// block ID number start for the current level data (as opposed to a dataset)
|
// block ID number start for the current level data (as opposed to a dataset)
|
||||||
#define CURRENT_DATAID LEVEL_MAXFILES
|
#define CURRENT_DATAID LEVEL_MAXFILES
|
||||||
|
|
||||||
|
@ -64,11 +58,11 @@ static char currentLevelName[32];
|
||||||
LEVEL_DATASET *psLevels;
|
LEVEL_DATASET *psLevels;
|
||||||
|
|
||||||
// the currently loaded data set
|
// the currently loaded data set
|
||||||
LEVEL_DATASET *psBaseData;
|
static LEVEL_DATASET *psBaseData;
|
||||||
LEVEL_DATASET *psCurrLevel;
|
static LEVEL_DATASET *psCurrLevel;
|
||||||
|
|
||||||
// dummy level data for single WRF loads
|
// dummy level data for single WRF loads
|
||||||
LEVEL_DATASET sSingleWRF;
|
static LEVEL_DATASET sSingleWRF;
|
||||||
|
|
||||||
// return values from the lexer
|
// return values from the lexer
|
||||||
char *pLevToken;
|
char *pLevToken;
|
||||||
|
@ -88,18 +82,6 @@ enum
|
||||||
LP_GAME, // game token received
|
LP_GAME, // game token received
|
||||||
};
|
};
|
||||||
|
|
||||||
/*// the current data file to parse
|
|
||||||
static UBYTE *pDataFile;
|
|
||||||
static SDWORD dataFileSize;
|
|
||||||
|
|
||||||
// the current position in the data file
|
|
||||||
static UBYTE *pDataPtr;
|
|
||||||
static SDWORD levLine;
|
|
||||||
|
|
||||||
// the token buffer
|
|
||||||
#define TOKEN_MAX 255
|
|
||||||
static char aTokenBuff[TOKEN_MAX];
|
|
||||||
*/
|
|
||||||
|
|
||||||
// initialise the level system
|
// initialise the level system
|
||||||
BOOL levInitialise(void)
|
BOOL levInitialise(void)
|
||||||
|
@ -573,64 +555,6 @@ static BOOL levLoadSingleWRF(char *pName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// load up the base data set for a level (used by savegames)
|
|
||||||
BOOL levLoadBaseData(char *pName)
|
|
||||||
{
|
|
||||||
LEVEL_DATASET *psNewLevel, *psBaseData;
|
|
||||||
SDWORD i;
|
|
||||||
|
|
||||||
debug(LOG_WZ, "Loading base data for level %s", pName);
|
|
||||||
|
|
||||||
// find the level dataset
|
|
||||||
if (!levFindDataSet(pName, &psNewLevel))
|
|
||||||
{
|
|
||||||
debug( LOG_ERROR, "levLoadBaseData: couldn't find level data" );
|
|
||||||
abort();
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (psNewLevel->type != LDS_CAMSTART &&
|
|
||||||
psNewLevel->type != LDS_MKEEP
|
|
||||||
&& psNewLevel->type != LDS_EXPAND &&
|
|
||||||
psNewLevel->type != LDS_MCLEAR &&
|
|
||||||
psNewLevel->type != LDS_EXPAND_LIMBO &&
|
|
||||||
psNewLevel->type != LDS_MKEEP_LIMBO
|
|
||||||
)
|
|
||||||
{
|
|
||||||
debug( LOG_ERROR, "levLoadBaseData: incorect level type" );
|
|
||||||
abort();
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// clear all the old data
|
|
||||||
levReleaseAll();
|
|
||||||
|
|
||||||
// initialise
|
|
||||||
if (!stageOneInitialise())
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// load up the base dataset
|
|
||||||
psBaseData = psNewLevel->psBaseData;
|
|
||||||
for(i=0; i<LEVEL_MAXFILES; i++)
|
|
||||||
{
|
|
||||||
if (psBaseData->apDataFiles[i])
|
|
||||||
{
|
|
||||||
// load the data
|
|
||||||
debug(LOG_WZ, "levLoadBaseData: Loading %s", psBaseData->apDataFiles[i]);
|
|
||||||
if (!resLoad(psBaseData->apDataFiles[i], i))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
psCurrLevel = psNewLevel;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *getLevelName( void )
|
char *getLevelName( void )
|
||||||
{
|
{
|
||||||
return(currentLevelName);
|
return(currentLevelName);
|
||||||
|
@ -645,9 +569,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
BOOL bCamChangeSaveGame;
|
BOOL bCamChangeSaveGame;
|
||||||
|
|
||||||
debug(LOG_WZ, "Loading level %s (%s)", pName, pSaveName);
|
debug(LOG_WZ, "Loading level %s (%s)", pName, pSaveName);
|
||||||
// reset fog
|
|
||||||
// fogStatus = 0;
|
|
||||||
// pie_EnableFog(FALSE);//removed, always set by script or save game
|
|
||||||
|
|
||||||
levelLoadType = saveType;
|
levelLoadType = saveType;
|
||||||
|
|
||||||
|
@ -847,12 +768,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//we now need to go to the next level
|
|
||||||
//psNewLevel = psChangeLevel;
|
|
||||||
//psChangeLevel = NULL;
|
|
||||||
|
|
||||||
//stageTwoShutDown??
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -893,12 +808,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (saveType == GTYPE_SAVE_START)
|
|
||||||
{
|
|
||||||
// do not load any more data
|
|
||||||
break;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pSaveName == NULL) ||
|
if ((pSaveName == NULL) ||
|
||||||
|
@ -911,7 +820,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
case LDS_COMPLETE:
|
case LDS_COMPLETE:
|
||||||
case LDS_CAMSTART:
|
case LDS_CAMSTART:
|
||||||
debug(LOG_WZ, "levLoadData: LDS_COMPLETE / LDS_CAMSTART");
|
debug(LOG_WZ, "levLoadData: LDS_COMPLETE / LDS_CAMSTART");
|
||||||
//if (!startMission(MISSION_CAMPSTART, psNewLevel->apDataFiles[i]))
|
|
||||||
if (!startMission(LDS_CAMSTART, psNewLevel->apDataFiles[i]))
|
if (!startMission(LDS_CAMSTART, psNewLevel->apDataFiles[i]))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -927,7 +835,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
|
|
||||||
case LDS_MKEEP:
|
case LDS_MKEEP:
|
||||||
debug(LOG_WZ, "levLoadData: LDS_MKEEP");
|
debug(LOG_WZ, "levLoadData: LDS_MKEEP");
|
||||||
//if (!startMission(MISSION_OFFKEEP, psNewLevel->apDataFiles[i]))
|
|
||||||
if (!startMission(LDS_MKEEP, psNewLevel->apDataFiles[i]))
|
if (!startMission(LDS_MKEEP, psNewLevel->apDataFiles[i]))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -935,7 +842,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
break;
|
break;
|
||||||
case LDS_CAMCHANGE:
|
case LDS_CAMCHANGE:
|
||||||
debug(LOG_WZ, "levLoadData: LDS_CAMCHANGE");
|
debug(LOG_WZ, "levLoadData: LDS_CAMCHANGE");
|
||||||
//if (!startMission(MISSION_CAMPSTART, psNewLevel->apDataFiles[i]))
|
|
||||||
if (!startMission(LDS_CAMCHANGE, psNewLevel->apDataFiles[i]))
|
if (!startMission(LDS_CAMCHANGE, psNewLevel->apDataFiles[i]))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -944,7 +850,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
|
|
||||||
case LDS_EXPAND:
|
case LDS_EXPAND:
|
||||||
debug(LOG_WZ, "levLoadData: LDS_EXPAND");
|
debug(LOG_WZ, "levLoadData: LDS_EXPAND");
|
||||||
//if (!startMission(MISSION_CAMPEXPAND, psNewLevel->apDataFiles[i]))
|
|
||||||
if (!startMission(LDS_EXPAND, psNewLevel->apDataFiles[i]))
|
if (!startMission(LDS_EXPAND, psNewLevel->apDataFiles[i]))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -952,7 +857,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
break;
|
break;
|
||||||
case LDS_EXPAND_LIMBO:
|
case LDS_EXPAND_LIMBO:
|
||||||
debug(LOG_WZ, "levLoadData: LDS_LIMBO");
|
debug(LOG_WZ, "levLoadData: LDS_LIMBO");
|
||||||
//if (!startMission(MISSION_CAMPEXPAND, psNewLevel->apDataFiles[i]))
|
|
||||||
if (!startMission(LDS_EXPAND_LIMBO, psNewLevel->apDataFiles[i]))
|
if (!startMission(LDS_EXPAND_LIMBO, psNewLevel->apDataFiles[i]))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -961,7 +865,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
|
|
||||||
case LDS_MCLEAR:
|
case LDS_MCLEAR:
|
||||||
debug(LOG_WZ, "levLoadData: LDS_MCLEAR");
|
debug(LOG_WZ, "levLoadData: LDS_MCLEAR");
|
||||||
//if (!startMission(MISSION_OFFCLEAR, psNewLevel->apDataFiles[i]))
|
|
||||||
if (!startMission(LDS_MCLEAR, psNewLevel->apDataFiles[i]))
|
if (!startMission(LDS_MCLEAR, psNewLevel->apDataFiles[i]))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -970,7 +873,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
case LDS_MKEEP_LIMBO:
|
case LDS_MKEEP_LIMBO:
|
||||||
debug(LOG_WZ, "levLoadData: LDS_MKEEP_LIMBO");
|
debug(LOG_WZ, "levLoadData: LDS_MKEEP_LIMBO");
|
||||||
debug( LOG_NEVER, "MKEEP_LIMBO\n" );
|
debug( LOG_NEVER, "MKEEP_LIMBO\n" );
|
||||||
//if (!startMission(MISSION_OFFKEEP, psNewLevel->apDataFiles[i]))
|
|
||||||
if (!startMission(LDS_MKEEP_LIMBO, psNewLevel->apDataFiles[i]))
|
if (!startMission(LDS_MKEEP_LIMBO, psNewLevel->apDataFiles[i]))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -980,7 +882,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
ASSERT( psNewLevel->type >= MULTI_TYPE_START,
|
ASSERT( psNewLevel->type >= MULTI_TYPE_START,
|
||||||
"levLoadData: Unexpected mission type" );
|
"levLoadData: Unexpected mission type" );
|
||||||
debug(LOG_WZ, "levLoadData: default (MULTIPLAYER)");
|
debug(LOG_WZ, "levLoadData: default (MULTIPLAYER)");
|
||||||
//if (!startMission(MISSION_CAMPSTART, psNewLevel->apDataFiles[i]))
|
|
||||||
if (!startMission(LDS_CAMSTART, psNewLevel->apDataFiles[i]))
|
if (!startMission(LDS_CAMSTART, psNewLevel->apDataFiles[i]))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1002,7 +903,6 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
|
|
||||||
dataClearSaveFlag();
|
dataClearSaveFlag();
|
||||||
|
|
||||||
//if (pSaveName != NULL && saveType == GTYPE_SAVE_MIDMISSION)
|
|
||||||
if (pSaveName != NULL)
|
if (pSaveName != NULL)
|
||||||
{
|
{
|
||||||
//load MidMission Extras
|
//load MidMission Extras
|
||||||
|
@ -1028,15 +928,12 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//want to test with release build too
|
|
||||||
//#ifdef DEBUG
|
|
||||||
//this enables us to to start cam2/cam3 without going via a save game and get the extra droids
|
//this enables us to to start cam2/cam3 without going via a save game and get the extra droids
|
||||||
//in from the script-controlled Transporters
|
//in from the script-controlled Transporters
|
||||||
if (!pSaveName && psNewLevel->type == LDS_CAMSTART)
|
if (!pSaveName && psNewLevel->type == LDS_CAMSTART)
|
||||||
{
|
{
|
||||||
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_NO_REINFORCEMENTS_LEFT);
|
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_NO_REINFORCEMENTS_LEFT);
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
|
|
||||||
//restore the level name for comparisons on next mission load up
|
//restore the level name for comparisons on next mission load up
|
||||||
if (psChangeLevel == NULL)
|
if (psChangeLevel == NULL)
|
||||||
|
|
|
@ -85,9 +85,6 @@ extern void levShutDown(void);
|
||||||
|
|
||||||
extern BOOL levInitialise(void);
|
extern BOOL levInitialise(void);
|
||||||
|
|
||||||
// load up the base data set for a level (used by savegames)
|
|
||||||
extern BOOL levLoadBaseData(char *pName);
|
|
||||||
|
|
||||||
// load up the data for a level
|
// load up the data for a level
|
||||||
extern BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType);
|
extern BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue