Fixed bug where player/player2 pointers are used uninitialised.

All levels now have different music.
This commit is contained in:
Rob Pearce 2016-07-28 08:18:16 +12:00
parent cc14a2194e
commit 21ca78a311
16 changed files with 68 additions and 33 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
*.swp
.DS_Store
scripts/level*.png
*~
# Local work dirs
staging/

BIN
data/music/main2.mod Normal file

Binary file not shown.

BIN
data/music/main3.mod Normal file

Binary file not shown.

BIN
data/music/main4.mod Normal file

Binary file not shown.

BIN
data/music/main5.mod Normal file

Binary file not shown.

BIN
data/music/mainfast2.mod Normal file

Binary file not shown.

BIN
data/music/mainfast3.mod Normal file

Binary file not shown.

BIN
data/music/mainfast4.mod Normal file

Binary file not shown.

BIN
data/music/mainfast5.mod Normal file

Binary file not shown.

4
defs.h
View File

@ -31,6 +31,8 @@
// max number of regrowing tiles
#define MAXREGROW 200
#define MAXWORLDS 5
// time a tile takes to regrow
#define REGROWTIMER_SHORT 350
#define REGROWTIMER_LONG 500
@ -1211,7 +1213,7 @@ extern int toggletimer;
extern TTF_Font *font[];
extern TTF_Font *cardfont;
extern int musicplaying;
extern Mix_Music *music, *normalmusic, *fastmusic, *bossmusic,*hiscoremusic;
extern Mix_Music *music, *normalmusic[], *fastmusic[], *bossmusic,*hiscoremusic;
extern Mix_Chunk *sfx[];
extern int oldexitdir;
extern int levelcomplete;

View File

@ -1,6 +1,22 @@
snorewalk.mod = in-game music
by Deelite
beach - **wltrs_-_bliss.xm
**By woolters
sandborn.mod
By fingal
kitchen - *black_missisipi
*JosSs
flip-flap
By x-ceed / appendix
ice - snowflox
by MELOMANIAC/VTY
castle - whats_the_catch
by BeaT
this_wonderful_life.mod = boss music
by Teo / Fatal Rage
@ -8,4 +24,5 @@ prosynt6.mod = hiscores music
by Jess
(http://amp.dascene.net/detail.php?detail=modules&view=8491)
Original font: bluestone

View File

@ -50,7 +50,7 @@ sprite_t *lastsprite; // tail of sprite linked list
sprite_t *player, *player2; // pointer to the player's sprite
sprite_t *boss; // point to current boss on level (normally NULL)
Mix_Music *music, *fastmusic, *normalmusic,*bossmusic,*hiscoremusic;
Mix_Music *music, *normalmusic[MAXWORLDS+1], *fastmusic[MAXWORLDS+1], *bossmusic,*hiscoremusic;
Mix_Chunk *sfx[MAXFX];
text_t *text, *lasttext;

65
rc.c
View File

@ -503,6 +503,9 @@ int main (int argc, char **argv) {
wanthiscores = B_TRUE;
}
player = NULL;
player2 = NULL;
// outside loop
while (1) {
// title screen
@ -1626,6 +1629,8 @@ void nextlevel(void) {
char msg[SMALLBUFLEN];
sprite_t *cloudp;
int x,y;
int curworld;
// remove the players
if (!firstlevel) {
@ -1656,9 +1661,10 @@ void nextlevel(void) {
curlevelnum++;
}
if (!musicplaying || (curmusic == fastmusic)) {
curworld = getcurworld();
if (!musicplaying || (curmusic == fastmusic[curworld])) {
if (curlevelnum != INTRO_LEVELNUM) {
playmusic(normalmusic);
playmusic(normalmusic[curworld]);
}
}
@ -1755,9 +1761,9 @@ void nextlevel(void) {
playmusic(bossmusic);
} else {
if (curlevelnum != INTRO_LEVELNUM) {
if (curmusic != normalmusic) {
if (curmusic != normalmusic[curworld]) {
stopmusic();
playmusic(normalmusic);
playmusic(normalmusic[curworld]);
}
}
}
@ -2085,6 +2091,8 @@ void die(sprite_t *s) {
return;
} else {
int tnum;
int curworld;
curworld = getcurworld();
if (globpowerup == PW_CLOCK) {
Mix_ResumeMusic();
@ -2119,8 +2127,8 @@ void die(sprite_t *s) {
s->umbrella = B_FALSE;
resethurryup(curlevel);
if (curmusic == fastmusic) {
playmusic(normalmusic);
if (curmusic == fastmusic[curworld]) {
playmusic(normalmusic[curworld]);
}
// mark sprite as dead
@ -10373,18 +10381,21 @@ int initsound(void) {
Mix_ChannelFinished(channeldone);
// load music
sprintf(filename, "%s/music/main.mod",datadir);
normalmusic = Mix_LoadMUS(filename);
if (!normalmusic) {
printf("can't load music: %s\n", Mix_GetError());
return B_TRUE;
}
for (i = 1; i <= MAXWORLDS; i++) {
sprintf(filename, "%s/music/main%d.mod",datadir, i);
normalmusic[i] = Mix_LoadMUS(filename);
if (!normalmusic[i]) {
printf("can't load music: %s\n", Mix_GetError());
return B_TRUE;
}
sprintf(filename, "%s/music/mainfast.mod",datadir);
fastmusic = Mix_LoadMUS(filename);
if (!fastmusic) {
printf("can't load fast music\n");
return B_TRUE;
sprintf(filename, "%s/music/mainfast%d.mod",datadir,i);
fastmusic[i] = Mix_LoadMUS(filename);
if (!fastmusic[i]) {
printf("can't load fast music\n");
return B_TRUE;
}
}
sprintf(filename, "%s/music/boss.mod",datadir);
@ -10446,7 +10457,7 @@ void stopmusic(void) {
void channeldone(int channel) {
if (channel == CH_HURRYUP) {
// start fast music
playmusic(fastmusic);
playmusic(fastmusic[getcurworld()]);
}
}
@ -13555,26 +13566,40 @@ void drawgamecredits(void) {
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Code:", &white, &grey2);
x += indent;
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Rob Pearce", &red, &red2);
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Rob", &red, &red2);
x = sx;
y += TEXTSIZE_CREDITS;
y += (TEXTSIZE_CREDITS/2);
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Graphics:", &white, &grey2);
x += indent;
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Rob Pearce", &red, &red2);
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Rob", &red, &red2);
x = sx;
y += TEXTSIZE_CREDITS;
y += (TEXTSIZE_CREDITS/2);
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Music:", &white, &grey2);
x += indent;
// ingame
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Deelite", &red, &red2);
y += TEXTSIZE_CREDITS;
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "fingal", &red, &red2);
y += TEXTSIZE_CREDITS;
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "x-ceed", &red, &red2);
y += TEXTSIZE_CREDITS;
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "MELOMANIAC/VTY", &red, &red2);
y += TEXTSIZE_CREDITS;
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "BeaT", &red, &red2);
y += TEXTSIZE_CREDITS;
// boss
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Teo / Fatal Rage", &red, &red2);
y += TEXTSIZE_CREDITS;
// hiscores
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Jess", &red, &red2);
y += TEXTSIZE_CREDITS;
y += (TEXTSIZE_CREDITS/2);
x = sx;

12
todo
View File

@ -1,19 +1,8 @@
- Half time between switching views in title screen
- Credits
- giant cookie = karen
- code = rob
- graphics = rob
- music = ???
- animate players hanging from umbrellas ?
- sometimes when falling on to a trampoline at an angle, I teleport up to the top of the screen.
- make points worth chasing for something more than a high schore
- bonus level teleport appears on next level once you
reach a certain amount of points ?
@ -98,6 +87,7 @@
- Shot of castle with "king cat and rats" flag flying.
- Compose original music tracks.
- ingame (plus fast version)
- Diff styles for diff levels?