While we've made changes that prevent Lives from being lost or gained, they currently still display on the status bar (Though always at 0). In this step of the guide, we'll remove the display. This will free up space on the status bar for other information that you might want to display.
Find the DrawLives() function within WL_AGENT
/*
===============
=
= DrawLives
=
===============
*/
void DrawLives (void)
{
if(viewsize == 21 && ingame) return;
LatchNumber (14,16,1,gamestate.lives);
}
Since we're not displaying Lives, we can just remove this whole function. Now that we've done that, the number of lives will not show up on the status bar, leaving the space blank. However, there are some times in the source code that DrawLives() is called upon. Since it has been removed, we'll need to also remove anything calling on it. If you don't it can cause errors with compiling.
In WL_GAME, there is a function called DrawPlayScreen(). This function makes calls to draw the whole status bar.
/*
===================
=
= DrawPlayScreen
=
===================
*/
void DrawPlayScreen (void)
{
int i,j,p,m;
unsigned temp;
VW_FadeOut ();
temp = bufferofs;
CA_CacheGrChunk (STATUSBARPIC);
for (i=0;i<3;i++)
{
bufferofs = screenloc[i];
DrawPlayBorder ();
VWB_DrawPic (0,200-STATUSLINES,STATUSBARPIC);
}
bufferofs = temp;
UNCACHEGRCHUNK (STATUSBARPIC);
DrawFace ();
DrawHealth ();
DrawLives ();
DrawLevel ();
DrawAmmo ();
DrawKeys ();
DrawWeapon ();
DrawScore ();
}
We'll want to remove the call to DrawLives() here.
...
UNCACHEGRCHUNK (STATUSBARPIC);
DrawFace ();
DrawHealth ();
// Removed DrawLives
DrawLevel ();
DrawAmmo ();
DrawKeys ();
DrawWeapon ();
DrawScore ();
}
If you are working with a version of the source that has Fullscreen capabilities built in (Wolf4SDL typically includes this), below DrawPlayScreen() you may find ShowActStatus(), which needs calls to Lives removed.
void ShowActStatus()
{
// Draw status bar without borders
byte *source = grsegs[STATUSBARPIC];
int picnum = STATUSBARPIC - STARTPICS;
int width = pictable[picnum].width;
int height = pictable[picnum].height;
int destx = (screenWidth-scaleFactor*320)/2 + 9 * scaleFactor;
int desty = screenHeight - (height - 4) * scaleFactor;
VL_MemToScreenScaledCoord(source, width, height, 9, 4, destx, desty, width - 18, height - 7);
ingame = false;
DrawFace ();
DrawHealth ();
// Removed DrawLives
DrawLevel ();
DrawAmmo ();
DrawKeys ();
DrawWeapon ();
DrawScore ();
ingame = true;
}
Then, further down in WL_GAME, we'll need to revisit the Died() function. Right at the bottom, you can see DrawLives() is called, so you'll need to get rid of that.
if (gamestate.lives > -1)
{
gamestate.health = 100;
gamestate.weapon = gamestate.bestweapon
= gamestate.chosenweapon = wp_pistol;
gamestate.ammo = STARTAMMO;
gamestate.keys = 0;
gamestate.attackframe = gamestate.attackcount =
gamestate.weaponframe = 0;
DrawKeys ();
DrawWeapon ();
DrawAmmo ();
DrawHealth ();
DrawFace ();
// Removed DrawLives
}
}
Finally, in WL_MENU, there is a call to DrawLives() within CP_LoadGame(). We remove that, and that will be all instances of DrawLives() covered!
fclose (file);
DrawFace ();
DrawHealth ();
// Removed DrawLives
DrawLevel ();
DrawAmmo ();
DrawKeys ();
DrawWeapon ();
DrawScore ();
ContinueMusic (lastgamemusicoffset);
return 1;
}