I probaly adding a Screenlock function as in Shadow Genesis,but not work.
WL_DEF.H:
WL_MAIN.CPP:
WL_GAME.CPP:
WL_STATE.CPP:
WL_DEF.H:
- Code:
//---------------
//
// gamestate structure
//
//---------------
typedef struct
{
short difficulty;
short mapon;
int32_t oldscore,score,nextextra;
short lives;
short health;
short ammo;
short keys;
weapontype bestweapon,weapon,chosenweapon;
short faceframe;
short attackframe,attackcount,weaponframe;
short episode,secretcount,treasurecount,killcount,
secrettotal,treasuretotal,killtotal;
int32_t TimeCount;
int32_t killx,killy;
boolean danger;
boolean danger1;
boolean danger2;
boolean danger3;
boolean victoryflag; // set during victory animations
} gametype;
void KillActor (objtype *ob);
void DamageActor (objtype *ob, unsigned damage);
void Danger (objtype *ob);
WL_MAIN.CPP:
- Code:
/*
=====================
=
= NewGame
=
= Set up new game to start from the beginning
=
=====================
*/
void NewGame (int difficulty,int episode)
{
memset (&gamestate,0,sizeof(gamestate));
gamestate.difficulty = difficulty;
gamestate.weapon = gamestate.bestweapon
= gamestate.chosenweapon = wp_pistol;
gamestate.health = 100;
gamestate.ammo = STARTAMMO;
gamestate.lives = 3;
gamestate.nextextra = EXTRAPOINTS;
gamestate.episode=episode;
gamestate.danger = true;
startgame = true;
}
WL_GAME.CPP:
- Code:
gamestate.lives--;
if (gamestate.lives > -1)
{
gamestate.health = 100;
gamestate.weapon = gamestate.bestweapon
= gamestate.chosenweapon = wp_pistol;
gamestate.ammo = STARTAMMO;
gamestate.keys = 0;
pwallstate = pwallpos = 0;
gamestate.attackframe = gamestate.attackcount =
gamestate.weaponframe = 0;
gamestate.danger = true;
if(viewsize != 21)
{
DrawKeys ();
DrawWeapon ();
DrawAmmo ();
DrawHealth ();
DrawFace ();
DrawLives ();
}
}
}
WL_STATE.CPP:
- Code:
/*
===============
=
= Danger
=
===============
*/
void StatusDrawPic2 (unsigned x, unsigned y, unsigned picnum)
{
LatchDrawPicScaledCoord ((screenWidth-scaleFactor*320)/16 + scaleFactor*x,
screenHeight-scaleFactor*(STATUSLINES-y),picnum);
}
void Danger (objtype *ob)
{
gamestate.danger;
{
FirstSighting (ob);
gamestate.danger = false;
}
{
}
gamestate.danger1;
{
FirstSighting (ob);
gamestate.danger = true;
if(viewsize == 21 && ingame) return;
StatusDrawPic2 (3,4,GOLDKEYPIC+gamestate.danger1);
}
{
}
gamestate.danger2;
{
FirstSighting (ob);
gamestate.danger = true;
if(viewsize == 21 && ingame) return;
StatusDrawPic2 (3,4,SILVERKEYPIC+gamestate.danger2);
}
{
}
gamestate.danger3;
{
FirstSighting (ob);
gamestate.danger = true;
if(viewsize == 21 && ingame) return;
StatusDrawPic2 (3,4,NOKEYPIC+gamestate.danger3);
}
}