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: case L_BUTTON:
bookMark--; bookMark--;
if (bookMark == -1) if (bookMark == -1)
bookMark = 1; bookMark = 9;
while (!spellKnowledge[bookMark])
{
bookMark--;
}
break; break;
case R_BUTTON: case R_BUTTON:
bookMark++; bookMark++;
if (bookMark == 2) if (bookMark == 10)
bookMark = 0; bookMark = 0;
while (!spellKnowledge[bookMark])
{
bookMark++;
if (bookMark == 10)
bookMark = 0;
}
break; break;
case PAUSE_BUTTON: case PAUSE_BUTTON:
pausemenu(); pausemenu();

View file

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

2
main.c
View file

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