Help can now be disbled/enabled independantly from the game mode (easy/normal)

This commit is contained in:
Rob Pearce 2008-10-31 00:41:33 +00:00
parent e153579ad1
commit 6036625699
4 changed files with 56 additions and 2 deletions

1
defs.h
View File

@ -817,6 +817,7 @@ extern tiletype_t fakeblock;
extern int gtime;
extern int timer;
extern int gamemode;
extern int showhelp;
extern SDL_Color red;
extern SDL_Color black;
extern SDL_Color blue;

View File

@ -10,6 +10,7 @@ int numlevels;
int maxlevid;
int gamemode; // easy or hard?
int showhelp; // show help text?
spriteinfo_t spriteinfo[MAXPTYPES];

53
rc.c
View File

@ -329,6 +329,7 @@ int main (int argc, char **argv) {
gamemode = GM_NORM; // default
showhelp = B_TRUE; // default
// try to get hiscores
@ -7813,6 +7814,7 @@ void dotitlescreen(void) {
char svnver[MIDBUFLEN];
SDL_Surface *titlebg;
SDL_Surface *cointext, *text, *text2, *easy, *norm, *ver;
SDL_Surface *help, *helpon, *helpoff;
SDL_Event event;
SDL_Rect area;
int timer = 0;
@ -7838,6 +7840,9 @@ void dotitlescreen(void) {
text2 = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "Select game mode:", red);
easy = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "Easy Mode", red2);
norm = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "Normal Mode", red2);
help = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "Hints:", green);
helpoff = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "Off", green2);
helpon = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "On", green2);
sprintf(svnver, "v0.%d",REV);
ver = TTF_RenderText_Solid(font[TEXTSIZE_VER], svnver, greenish);
@ -7980,6 +7985,48 @@ void dotitlescreen(void) {
}
SDL_BlitSurface(norm, NULL, screen, &area);
// help on/off
area.x = 320 - 100 +2;
area.y = 480 - 50 +2;
SDL_SetColors(help, &black, 1, 1);
SDL_BlitSurface(help, NULL, screen, &area);
area.x -= 2; area.y -= 2;
SDL_SetColors(help, &red, 1, 1);
SDL_BlitSurface(help, NULL, screen, &area);
// "on"
area.x += (help->w+10)+2;
area.y = 480 - 50 +2;
SDL_SetColors(helpon, &black, 1, 1);
SDL_BlitSurface(helpon, NULL, screen, &area);
area.x -= 2; area.y -= 2;
if ((showhelp == B_FALSE) || (texton)) { // on not blinking
// normal
SDL_SetColors(helpon, &red2, 1, 1);
} else {
// white
SDL_SetColors(helpon, &white, 1, 1);
}
SDL_BlitSurface(helpon, NULL, screen, &area);
// "off"
area.x += (helpon->w+10)+2;
area.y = 480 - 50 +2;
SDL_SetColors(helpoff, &black, 1, 1);
SDL_BlitSurface(helpoff, NULL, screen, &area);
area.x -= 2; area.y -= 2;
if ((showhelp == B_TRUE) || (texton)) { // off not blinking
// normal
SDL_SetColors(helpoff, &red2, 1, 1);
} else {
// white
SDL_SetColors(helpoff, &white, 1, 1);
}
SDL_BlitSurface(helpoff, NULL, screen, &area);
// level description
if (gamemode == GM_EASY) {
int x,y;
@ -7987,7 +8034,7 @@ void dotitlescreen(void) {
desc = TTF_RenderText_Solid(font[TEXTSIZE_TITLE2], "Permenant armour and extra time (-50% score penalty)", black);
startx = 320 - (desc->w/2);
starty = 240 + (desc->h)*3;
starty = 240 + (desc->h)*2;
for (x = startx-1 ; x <= startx+1; x++) {
for (y = starty-1 ; y <= starty+1; y++) {
area.x = x; area.y = y;
@ -8219,6 +8266,10 @@ void handletitleinput(int key) {
gamemode = GM_EASY;
} else if (key == SDLK_DOWN) {
gamemode = GM_NORM;
} else if (key == SDLK_LEFT) {
showhelp = B_TRUE;
} else if (key == SDLK_RIGHT) {
showhelp = B_FALSE;
} else if ((key == SDLK_z) || (key == SDLK_RETURN)) {
playfx(FX_1UP);
titledone = B_TRUE;

View File

@ -502,7 +502,8 @@ int loadlevel(int wnum, int lnum, int wantmonsters) {
int delay;
if (level->initm[i].id == P_HELP) {
if (gamemode != GM_EASY) continue;
// is help disabled?
if (showhelp == B_FALSE ) continue;
strncpy(name, level->initm[i].help, MIDBUFLEN);
} else {
sprintf(name, "Monster-%d",i);