spellKnowledge is an array of booleans instead of a product of primes; scrolling through spell list handles empty slots in spellKnowledge

This commit is contained in:
Iris Lightshard 2018-12-16 04:18:26 -08:00
parent a2a4722f33
commit 5089841175
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
3 changed files with 14 additions and 4 deletions

View file

@ -122,12 +122,22 @@ void interact()
case L_BUTTON:
bookMark--;
if (bookMark == -1)
bookMark = 1;
bookMark = 9;
while (!spellKnowledge[bookMark])
{
bookMark--;
}
break;
case R_BUTTON:
bookMark++;
if (bookMark == 2)
if (bookMark == 10)
bookMark = 0;
while (!spellKnowledge[bookMark])
{
bookMark++;
if (bookMark == 10)
bookMark = 0;
}
break;
case PAUSE_BUTTON:
pausemenu();

View file

@ -18,7 +18,7 @@ extern int kaosFlag;
extern int spellFlag;
extern long long int savestate;
extern int spellKnowledge;
extern int spellKnowledge[10];
extern int bookMark;
extern Room* menuBG;

2
main.c
View file

@ -50,7 +50,7 @@ Room* menuBG = NULL;
Mix_Music* menuBGM = NULL;
long long int savestate = 2;
int spellKnowledge = 2;
int spellKnowledge[10] = {1,1,0,0,0,0,0,0,0,0};
int bookMark = 0;
Room** mapData = NULL;