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 *.swp
.DS_Store .DS_Store
scripts/level*.png scripts/level*.png
*~
# Local work dirs # Local work dirs
staging/ 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 // max number of regrowing tiles
#define MAXREGROW 200 #define MAXREGROW 200
#define MAXWORLDS 5
// time a tile takes to regrow // time a tile takes to regrow
#define REGROWTIMER_SHORT 350 #define REGROWTIMER_SHORT 350
#define REGROWTIMER_LONG 500 #define REGROWTIMER_LONG 500
@ -1211,7 +1213,7 @@ extern int toggletimer;
extern TTF_Font *font[]; extern TTF_Font *font[];
extern TTF_Font *cardfont; extern TTF_Font *cardfont;
extern int musicplaying; extern int musicplaying;
extern Mix_Music *music, *normalmusic, *fastmusic, *bossmusic,*hiscoremusic; extern Mix_Music *music, *normalmusic[], *fastmusic[], *bossmusic,*hiscoremusic;
extern Mix_Chunk *sfx[]; extern Mix_Chunk *sfx[];
extern int oldexitdir; extern int oldexitdir;
extern int levelcomplete; extern int levelcomplete;

View File

@ -1,5 +1,21 @@
snorewalk.mod = in-game music snorewalk.mod = in-game music
by Deelite 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 this_wonderful_life.mod = boss music
by Teo / Fatal Rage by Teo / Fatal Rage
@ -8,4 +24,5 @@ prosynt6.mod = hiscores music
by Jess by Jess
(http://amp.dascene.net/detail.php?detail=modules&view=8491) (http://amp.dascene.net/detail.php?detail=modules&view=8491)
Original font: bluestone 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 *player, *player2; // pointer to the player's sprite
sprite_t *boss; // point to current boss on level (normally NULL) 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]; Mix_Chunk *sfx[MAXFX];
text_t *text, *lasttext; text_t *text, *lasttext;

65
rc.c
View File

@ -502,6 +502,9 @@ int main (int argc, char **argv) {
printf("Hiscores successfully downloaded.\n"); printf("Hiscores successfully downloaded.\n");
wanthiscores = B_TRUE; wanthiscores = B_TRUE;
} }
player = NULL;
player2 = NULL;
// outside loop // outside loop
while (1) { while (1) {
@ -1626,6 +1629,8 @@ void nextlevel(void) {
char msg[SMALLBUFLEN]; char msg[SMALLBUFLEN];
sprite_t *cloudp; sprite_t *cloudp;
int x,y; int x,y;
int curworld;
// remove the players // remove the players
if (!firstlevel) { if (!firstlevel) {
@ -1656,9 +1661,10 @@ void nextlevel(void) {
curlevelnum++; curlevelnum++;
} }
if (!musicplaying || (curmusic == fastmusic)) { curworld = getcurworld();
if (!musicplaying || (curmusic == fastmusic[curworld])) {
if (curlevelnum != INTRO_LEVELNUM) { if (curlevelnum != INTRO_LEVELNUM) {
playmusic(normalmusic); playmusic(normalmusic[curworld]);
} }
} }
@ -1755,9 +1761,9 @@ void nextlevel(void) {
playmusic(bossmusic); playmusic(bossmusic);
} else { } else {
if (curlevelnum != INTRO_LEVELNUM) { if (curlevelnum != INTRO_LEVELNUM) {
if (curmusic != normalmusic) { if (curmusic != normalmusic[curworld]) {
stopmusic(); stopmusic();
playmusic(normalmusic); playmusic(normalmusic[curworld]);
} }
} }
} }
@ -2085,6 +2091,8 @@ void die(sprite_t *s) {
return; return;
} else { } else {
int tnum; int tnum;
int curworld;
curworld = getcurworld();
if (globpowerup == PW_CLOCK) { if (globpowerup == PW_CLOCK) {
Mix_ResumeMusic(); Mix_ResumeMusic();
@ -2119,8 +2127,8 @@ void die(sprite_t *s) {
s->umbrella = B_FALSE; s->umbrella = B_FALSE;
resethurryup(curlevel); resethurryup(curlevel);
if (curmusic == fastmusic) { if (curmusic == fastmusic[curworld]) {
playmusic(normalmusic); playmusic(normalmusic[curworld]);
} }
// mark sprite as dead // mark sprite as dead
@ -10373,18 +10381,21 @@ int initsound(void) {
Mix_ChannelFinished(channeldone); Mix_ChannelFinished(channeldone);
// load music // load music
sprintf(filename, "%s/music/main.mod",datadir); for (i = 1; i <= MAXWORLDS; i++) {
normalmusic = Mix_LoadMUS(filename); sprintf(filename, "%s/music/main%d.mod",datadir, i);
if (!normalmusic) { normalmusic[i] = Mix_LoadMUS(filename);
printf("can't load music: %s\n", Mix_GetError()); if (!normalmusic[i]) {
return B_TRUE; printf("can't load music: %s\n", Mix_GetError());
} return B_TRUE;
}
sprintf(filename, "%s/music/mainfast.mod",datadir);
fastmusic = Mix_LoadMUS(filename); sprintf(filename, "%s/music/mainfast%d.mod",datadir,i);
if (!fastmusic) { fastmusic[i] = Mix_LoadMUS(filename);
printf("can't load fast music\n"); if (!fastmusic[i]) {
return B_TRUE; printf("can't load fast music\n");
return B_TRUE;
}
} }
sprintf(filename, "%s/music/boss.mod",datadir); sprintf(filename, "%s/music/boss.mod",datadir);
@ -10446,7 +10457,7 @@ void stopmusic(void) {
void channeldone(int channel) { void channeldone(int channel) {
if (channel == CH_HURRYUP) { if (channel == CH_HURRYUP) {
// start fast music // start fast music
playmusic(fastmusic); playmusic(fastmusic[getcurworld()]);
} }
} }
@ -13555,26 +13566,40 @@ void drawgamecredits(void) {
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Code:", &white, &grey2); drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Code:", &white, &grey2);
x += indent; x += indent;
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Rob Pearce", &red, &red2); drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Rob", &red, &red2);
x = sx; x = sx;
y += TEXTSIZE_CREDITS; y += TEXTSIZE_CREDITS;
y += (TEXTSIZE_CREDITS/2); y += (TEXTSIZE_CREDITS/2);
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Graphics:", &white, &grey2); drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Graphics:", &white, &grey2);
x += indent; x += indent;
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Rob Pearce", &red, &red2); drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Rob", &red, &red2);
x = sx; x = sx;
y += TEXTSIZE_CREDITS; y += TEXTSIZE_CREDITS;
y += (TEXTSIZE_CREDITS/2); y += (TEXTSIZE_CREDITS/2);
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Music:", &white, &grey2); drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Music:", &white, &grey2);
x += indent; x += indent;
// ingame
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Deelite", &red, &red2); drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Deelite", &red, &red2);
y += TEXTSIZE_CREDITS; 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); drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Teo / Fatal Rage", &red, &red2);
y += TEXTSIZE_CREDITS; y += TEXTSIZE_CREDITS;
// hiscores
drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Jess", &red, &red2); drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Jess", &red, &red2);
y += TEXTSIZE_CREDITS; y += TEXTSIZE_CREDITS;
y += (TEXTSIZE_CREDITS/2); y += (TEXTSIZE_CREDITS/2);
x = sx; 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 ? - animate players hanging from umbrellas ?
- sometimes when falling on to a trampoline at an angle, I teleport up to the top of the screen. - 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 - make points worth chasing for something more than a high schore
- bonus level teleport appears on next level once you - bonus level teleport appears on next level once you
reach a certain amount of points ? reach a certain amount of points ?
@ -98,6 +87,7 @@
- Shot of castle with "king cat and rats" flag flying. - Shot of castle with "king cat and rats" flag flying.
- Compose original music tracks. - Compose original music tracks.
- ingame (plus fast version) - ingame (plus fast version)
- Diff styles for diff levels? - Diff styles for diff levels?