Added intro sequence
|
@ -0,0 +1,107 @@
|
||||||
|
bgfile sky1.png
|
||||||
|
bg 0
|
||||||
|
hurryup 30
|
||||||
|
help
|
||||||
|
endhelp
|
||||||
|
monsters
|
||||||
|
0 5 15
|
||||||
|
134 23 15
|
||||||
|
23 36 20
|
||||||
|
2 7 15
|
||||||
|
2 19 15
|
||||||
|
9 14 15
|
||||||
|
9 8 15
|
||||||
|
141 10 15
|
||||||
|
143 12 15
|
||||||
|
10 15 15
|
||||||
|
11 17 15
|
||||||
|
11 13 15
|
||||||
|
140 16 15
|
||||||
|
140 9 15
|
||||||
|
142 11 15
|
||||||
|
142 18 15
|
||||||
|
143 21 15
|
||||||
|
141 20 15
|
||||||
|
15 37 12
|
||||||
|
15 39 12
|
||||||
|
endmonsters
|
||||||
|
exitdir 1
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,74,0,74,0,74,0,74,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,74,0,74,0,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,74,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,74,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,74,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,74,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,74,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,74,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,0,0,0,0,0,0,0,0,0,35,1,1,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,74,0,0,0,0,0,0,0,0,0,0,42,4,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,75,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
74,74,74,74,74,74,74,74,74,74,74,74,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
layer2
|
||||||
|
0,3,74
|
||||||
|
0,4,74
|
||||||
|
0,5,74
|
||||||
|
0,6,74
|
||||||
|
1,6,19
|
||||||
|
14,6,80
|
||||||
|
26,6,18
|
||||||
|
0,7,74
|
||||||
|
14,7,80
|
||||||
|
0,8,74
|
||||||
|
11,8,82
|
||||||
|
12,8,82
|
||||||
|
13,8,82
|
||||||
|
14,8,81
|
||||||
|
15,8,82
|
||||||
|
16,8,82
|
||||||
|
17,8,82
|
||||||
|
0,9,74
|
||||||
|
0,10,74
|
||||||
|
6,10,82
|
||||||
|
22,10,82
|
||||||
|
0,11,74
|
||||||
|
0,12,74
|
||||||
|
0,16,74
|
||||||
|
1,16,74
|
||||||
|
5,16,78
|
||||||
|
7,16,64
|
||||||
|
8,16,62
|
||||||
|
9,16,62
|
||||||
|
10,16,62
|
||||||
|
11,16,62
|
||||||
|
12,16,62
|
||||||
|
13,16,62
|
||||||
|
14,16,62
|
||||||
|
15,16,62
|
||||||
|
16,16,62
|
||||||
|
17,16,62
|
||||||
|
18,16,62
|
||||||
|
19,16,62
|
||||||
|
20,16,62
|
||||||
|
21,16,63
|
||||||
|
23,16,79
|
||||||
|
0,17,74
|
||||||
|
1,17,74
|
||||||
|
5,17,76
|
||||||
|
8,17,77
|
||||||
|
20,17,77
|
||||||
|
23,17,76
|
|
@ -55,3 +55,4 @@
|
||||||
109,level109.dat,THE END SO FAR
|
109,level109.dat,THE END SO FAR
|
||||||
99,level99.dat,TEST LEVEL
|
99,level99.dat,TEST LEVEL
|
||||||
417,level417.dat,NEW LEVEL
|
417,level417.dat,NEW LEVEL
|
||||||
|
0,intro.dat,INTRO
|
||||||
|
|
After Width: | Height: | Size: 921 B |
After Width: | Height: | Size: 797 B |
After Width: | Height: | Size: 588 B |
After Width: | Height: | Size: 587 B |
After Width: | Height: | Size: 609 B |
After Width: | Height: | Size: 428 B |
After Width: | Height: | Size: 759 B |
After Width: | Height: | Size: 749 B |
After Width: | Height: | Size: 410 B |
|
@ -487,3 +487,57 @@ file crightr0.png crightr1.png crightr2.png crightr3.png
|
||||||
animspeed 4
|
animspeed 4
|
||||||
animsync
|
animsync
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tile castle
|
||||||
|
id 4
|
||||||
|
solid 1
|
||||||
|
file newtiles/castle.png
|
||||||
|
end
|
||||||
|
|
||||||
|
tile castleback
|
||||||
|
id 5
|
||||||
|
solid 0
|
||||||
|
file newtiles/castleback.png
|
||||||
|
end
|
||||||
|
|
||||||
|
tile chairlegs
|
||||||
|
id 17
|
||||||
|
solid 2
|
||||||
|
file newtiles/chairlegs.png
|
||||||
|
end
|
||||||
|
|
||||||
|
tile tableleg
|
||||||
|
id 5
|
||||||
|
solid 0
|
||||||
|
file newtiles/tableleg.png
|
||||||
|
end
|
||||||
|
|
||||||
|
tile chairbackl
|
||||||
|
id 5
|
||||||
|
solid 0
|
||||||
|
file newtiles/chairbackl.png
|
||||||
|
end
|
||||||
|
|
||||||
|
tile chairbackr
|
||||||
|
id 5
|
||||||
|
solid 0
|
||||||
|
file newtiles/chairbackr.png
|
||||||
|
end
|
||||||
|
|
||||||
|
tile cord
|
||||||
|
id 5
|
||||||
|
solid 0
|
||||||
|
file newtiles/cord.png
|
||||||
|
end
|
||||||
|
|
||||||
|
tile light
|
||||||
|
id 5
|
||||||
|
solid 0
|
||||||
|
file newtiles/light.png
|
||||||
|
end
|
||||||
|
|
||||||
|
tile light2
|
||||||
|
id 5
|
||||||
|
solid 0
|
||||||
|
file newtiles/light2.png
|
||||||
|
end
|
||||||
|
|
23
defs.h
|
@ -59,6 +59,7 @@
|
||||||
#define TEXTSIZE_TITLE2 16
|
#define TEXTSIZE_TITLE2 16
|
||||||
#define TEXTSIZE_CREDIT 14
|
#define TEXTSIZE_CREDIT 14
|
||||||
#define TEXTSIZE_LEVEL2 22
|
#define TEXTSIZE_LEVEL2 22
|
||||||
|
#define TEXTSIZE_YUM 24
|
||||||
#define TEXTSIZE_BIFF 26
|
#define TEXTSIZE_BIFF 26
|
||||||
#define TEXTSIZE_MULTI 26
|
#define TEXTSIZE_MULTI 26
|
||||||
#define TEXTSIZE_LEVEL 32
|
#define TEXTSIZE_LEVEL 32
|
||||||
|
@ -75,7 +76,23 @@
|
||||||
#define TT_NORM 0
|
#define TT_NORM 0
|
||||||
#define TT_HELP 1
|
#define TT_HELP 1
|
||||||
#define TT_HELPSHADOW 2
|
#define TT_HELPSHADOW 2
|
||||||
#define TT_GAMEOVER 3
|
#define TT_INTROTEXT 3
|
||||||
|
#define TT_GAMEOVER 4
|
||||||
|
|
||||||
|
|
||||||
|
// intro states
|
||||||
|
#define IS_START 0
|
||||||
|
#define IS_YUM 1
|
||||||
|
#define IS_YUMWAIT 2
|
||||||
|
#define IS_JUMP 3
|
||||||
|
#define IS_RATS 4
|
||||||
|
#define IS_RATS2 5
|
||||||
|
#define IS_FINISH 6
|
||||||
|
|
||||||
|
// intro variables
|
||||||
|
#define INTRO_RATSPEED 12
|
||||||
|
#define INTRO_LEVELNUM 101
|
||||||
|
|
||||||
|
|
||||||
#define GAMEOVERWAIT 3 // # of seconds to wait before going back to title
|
#define GAMEOVERWAIT 3 // # of seconds to wait before going back to title
|
||||||
|
|
||||||
|
@ -89,6 +106,7 @@
|
||||||
#define HURRYDELAY 50
|
#define HURRYDELAY 50
|
||||||
#define LIFEDELAY 50
|
#define LIFEDELAY 50
|
||||||
#define CLOVERDELAY 50
|
#define CLOVERDELAY 50
|
||||||
|
#define YUMDELAY 80
|
||||||
#define POKERMSGDELAY 80
|
#define POKERMSGDELAY 80
|
||||||
#define LEVELWINDELAY 80
|
#define LEVELWINDELAY 80
|
||||||
#define DIEDELAY 80
|
#define DIEDELAY 80
|
||||||
|
@ -207,7 +225,7 @@
|
||||||
|
|
||||||
|
|
||||||
// Limits
|
// Limits
|
||||||
#define MAXLEVELS 100
|
#define MAXLEVELS 102
|
||||||
#define MAXMAPPINGS 50
|
#define MAXMAPPINGS 50
|
||||||
#define MAXMONSTERSPERLEVEL 60
|
#define MAXMONSTERSPERLEVEL 60
|
||||||
#define MAXLETTERHEIGHT 100
|
#define MAXLETTERHEIGHT 100
|
||||||
|
@ -865,6 +883,7 @@ typedef struct sprite_s {
|
||||||
|
|
||||||
// player and monster
|
// player and monster
|
||||||
struct sprite_s *onplatform;// are we on platform?
|
struct sprite_s *onplatform;// are we on platform?
|
||||||
|
int antigrav; // don't fall
|
||||||
int lives; // only for player and bosses
|
int lives; // only for player and bosses
|
||||||
int swimming; // are we in the water?
|
int swimming; // are we in the water?
|
||||||
int falling; // are we falling?
|
int falling; // are we falling?
|
||||||
|
|
6
edit.c
|
@ -26,6 +26,8 @@ int selsprite = -1;
|
||||||
|
|
||||||
int modified = B_FALSE; // has the current level been modified since last save?
|
int modified = B_FALSE; // has the current level been modified since last save?
|
||||||
|
|
||||||
|
int allowfruits = B_FALSE;
|
||||||
|
|
||||||
|
|
||||||
int curlevelnum;
|
int curlevelnum;
|
||||||
|
|
||||||
|
@ -92,6 +94,9 @@ int main (int argc, char **argv) {
|
||||||
} else if (!strcmp(argv[i], "-dump")) {
|
} else if (!strcmp(argv[i], "-dump")) {
|
||||||
dumpinfo();
|
dumpinfo();
|
||||||
exit(1);
|
exit(1);
|
||||||
|
} else if (!strcmp(argv[i], "-c")) {
|
||||||
|
printf("allowing fruits\n");
|
||||||
|
allowfruits = B_TRUE;
|
||||||
} else if (!strcmp(argv[i], "-l")) {
|
} else if (!strcmp(argv[i], "-l")) {
|
||||||
if (++i >= argc) {
|
if (++i >= argc) {
|
||||||
printf("Missing level number.\n");
|
printf("Missing level number.\n");
|
||||||
|
@ -1134,6 +1139,7 @@ int isplacablesprite(int sid) {
|
||||||
if (sid == P_POWERUPPOS) return B_TRUE;
|
if (sid == P_POWERUPPOS) return B_TRUE;
|
||||||
if (ismonster(sid) && (sid != P_BLACKCLOUD)) return B_TRUE;
|
if (ismonster(sid) && (sid != P_BLACKCLOUD)) return B_TRUE;
|
||||||
if (isfruit(sid) == FT_GEM) return B_TRUE;
|
if (isfruit(sid) == FT_GEM) return B_TRUE;
|
||||||
|
if (allowfruits && (isfruit(sid) == FT_FRUIT)) return B_TRUE;
|
||||||
|
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
471
rc.c
|
@ -36,6 +36,8 @@ SDL_Surface *credittext;
|
||||||
int globpowerup;
|
int globpowerup;
|
||||||
int globtimer;
|
int globtimer;
|
||||||
|
|
||||||
|
int introstate;
|
||||||
|
|
||||||
TTF_Font *font[MAXLETTERHEIGHT];
|
TTF_Font *font[MAXLETTERHEIGHT];
|
||||||
|
|
||||||
char hiscoreserver[BUFLEN];
|
char hiscoreserver[BUFLEN];
|
||||||
|
@ -514,6 +516,14 @@ int main (int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************
|
||||||
|
* Intro sequence
|
||||||
|
*/
|
||||||
|
if (inintro()) {
|
||||||
|
dointroseq();
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************
|
/**********************************************
|
||||||
* Move onscreen text
|
* Move onscreen text
|
||||||
*/
|
*/
|
||||||
|
@ -697,8 +707,10 @@ int main (int argc, char **argv) {
|
||||||
// draw text
|
// draw text
|
||||||
drawtext();
|
drawtext();
|
||||||
|
|
||||||
// draw score
|
if (!inintro()) {
|
||||||
drawscore();
|
// draw score
|
||||||
|
drawscore();
|
||||||
|
}
|
||||||
|
|
||||||
// draw boss health
|
// draw boss health
|
||||||
if (boss) {
|
if (boss) {
|
||||||
|
@ -1104,10 +1116,22 @@ void nextlevel(void) {
|
||||||
/* in case we skipped the level due to a powerup etc */
|
/* in case we skipped the level due to a powerup etc */
|
||||||
levelcomplete = LV_NEXTLEV;
|
levelcomplete = LV_NEXTLEV;
|
||||||
|
|
||||||
|
|
||||||
/* go to next level */
|
/* go to next level */
|
||||||
curlevelnum++;
|
// this won't trigger on the first load of the intro
|
||||||
|
// becasue curlevelnum is decremented before this function
|
||||||
|
// is called. When the intro ENDs, the next line will
|
||||||
|
// be true.
|
||||||
|
if (curlevelnum == INTRO_LEVELNUM) {
|
||||||
|
curlevelnum = 1;
|
||||||
|
} else {
|
||||||
|
curlevelnum++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!musicplaying || (curmusic == fastmusic)) {
|
if (!musicplaying || (curmusic == fastmusic)) {
|
||||||
playmusic(normalmusic);
|
if (curlevelnum != INTRO_LEVELNUM) {
|
||||||
|
playmusic(normalmusic);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't want the player flashing while scrolling
|
// don't want the player flashing while scrolling
|
||||||
|
@ -1150,8 +1174,10 @@ void nextlevel(void) {
|
||||||
drawlevel();
|
drawlevel();
|
||||||
|
|
||||||
// now the player gets invincibility
|
// now the player gets invincibility
|
||||||
makeinvuln(player);
|
if (!inintro()) {
|
||||||
makeinvuln(player2);
|
makeinvuln(player);
|
||||||
|
makeinvuln(player2);
|
||||||
|
}
|
||||||
|
|
||||||
// phone is cancelled on boss levels
|
// phone is cancelled on boss levels
|
||||||
if (haspowerupany(PW_PHONE)) {
|
if (haspowerupany(PW_PHONE)) {
|
||||||
|
@ -1195,21 +1221,24 @@ void nextlevel(void) {
|
||||||
stopmusic();
|
stopmusic();
|
||||||
playmusic(bossmusic);
|
playmusic(bossmusic);
|
||||||
} else {
|
} else {
|
||||||
if (curmusic != normalmusic) {
|
if (curlevelnum != INTRO_LEVELNUM) {
|
||||||
stopmusic();
|
if (curmusic != normalmusic) {
|
||||||
playmusic(normalmusic);
|
stopmusic();
|
||||||
|
playmusic(normalmusic);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
level->iced = ICE_NONE;
|
level->iced = ICE_NONE;
|
||||||
level->icey = -1;
|
level->icey = -1;
|
||||||
|
|
||||||
sprintf(msg, "Level %d-%d",getcurworld(), getcurlevel());
|
if (!inintro()) {
|
||||||
addoutlinetext(320,240-18,TEXTSIZE_LEVEL,msg,&white,&black,LEVELDELAY, TT_NORM);
|
sprintf(msg, "Level %d-%d",getcurworld(), getcurlevel());
|
||||||
|
addoutlinetext(320,240-18,TEXTSIZE_LEVEL,msg,&white,&black,LEVELDELAY, TT_NORM);
|
||||||
|
|
||||||
|
sprintf(msg, "\"%s\"", curlevel->name);
|
||||||
sprintf(msg, "\"%s\"", curlevel->name);
|
addoutlinetext(320,240+18,TEXTSIZE_LEVEL2,msg,&cyan,&black,LEVELDELAY, TT_NORM);
|
||||||
addoutlinetext(320,240+18,TEXTSIZE_LEVEL2,msg,&cyan,&black,LEVELDELAY, TT_NORM);
|
}
|
||||||
|
|
||||||
/* reset player stats */
|
/* reset player stats */
|
||||||
if (player && player->lives > 0) {
|
if (player && player->lives > 0) {
|
||||||
|
@ -1600,6 +1629,8 @@ void die(sprite_t *s) {
|
||||||
void checklevelend(void) {
|
void checklevelend(void) {
|
||||||
sprite_t *s2;
|
sprite_t *s2;
|
||||||
int mcount;
|
int mcount;
|
||||||
|
|
||||||
|
if (inintro()) return;
|
||||||
|
|
||||||
if (!levelcomplete) {
|
if (!levelcomplete) {
|
||||||
mcount = 0;
|
mcount = 0;
|
||||||
|
@ -1945,6 +1976,12 @@ void checkcollide(sprite_t *s) {
|
||||||
s2->willbecome = P_DIAMOND;
|
s2->willbecome = P_DIAMOND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (inintro() && (s->id == P_RAT)) {
|
||||||
|
// collect fruits
|
||||||
|
if (isfruit(s2->id)) {
|
||||||
|
s2->dead = D_FINAL;
|
||||||
|
puffin(-1, s2->x, s2->y, "nothing", 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end for each sprite
|
} // end for each sprite
|
||||||
|
@ -2715,104 +2752,113 @@ printf("jumping: %0.2f\n",s->jumpdir);
|
||||||
s->dir = s->owner->dir;
|
s->dir = s->owner->dir;
|
||||||
}
|
}
|
||||||
} else if (s->id == P_RAT) {
|
} else if (s->id == P_RAT) {
|
||||||
if (!s->falling) {
|
if (inintro()) {
|
||||||
int move = B_FALSE;
|
// move right FAST
|
||||||
int xdiff ,absxdiff;
|
double xpoint;
|
||||||
tiletype_t *tunder;
|
xpoint = (curlevel->powerupx * TILEW) + (TILEW/2);
|
||||||
|
if (s->x <= xpoint) {
|
||||||
|
movex(s, s->speed);
|
||||||
|
}
|
||||||
|
} else { // not in intro sequence
|
||||||
|
if (!s->falling) {
|
||||||
|
int move = B_FALSE;
|
||||||
|
int xdiff ,absxdiff;
|
||||||
|
tiletype_t *tunder;
|
||||||
|
|
||||||
|
|
||||||
/* distance to closest player */
|
/* distance to closest player */
|
||||||
xdiff = getxdisttoplayer(s);
|
xdiff = getxdisttoplayer(s);
|
||||||
absxdiff = abs(xdiff);
|
absxdiff = abs(xdiff);
|
||||||
|
|
||||||
// tile in front and below
|
// tile in front and below
|
||||||
tt = gettileat(s->x + s->dir*getspeed(s) + (s->dir * (s->img->w/2)),s->y + (TILEH/2),NULL,NULL);
|
tt = gettileat(s->x + s->dir*getspeed(s) + (s->dir * (s->img->w/2)),s->y + (TILEH/2),NULL,NULL);
|
||||||
// tile below
|
// tile below
|
||||||
tunder = gettileat(s->x ,s->y + 1,NULL,NULL);
|
tunder = gettileat(s->x ,s->y + 1,NULL,NULL);
|
||||||
/* if there's a hole in front of us and below*/
|
/* if there's a hole in front of us and below*/
|
||||||
if (tt->solid == S_NOTSOLID) {
|
if (tt->solid == S_NOTSOLID) {
|
||||||
// we're on a slope
|
// we're on a slope
|
||||||
if (tunder->solid == S_SLOPE) {
|
if (tunder->solid == S_SLOPE) {
|
||||||
move = B_TRUE;
|
move = B_TRUE;
|
||||||
} else {
|
} else {
|
||||||
if (s->angry || boss) {
|
if (s->angry || boss) {
|
||||||
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
|
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
|
||||||
/* if player is below, fall off */
|
/* if player is below, fall off */
|
||||||
if (xdiff <= (TILEW*8)) {
|
if (xdiff <= (TILEW*8)) {
|
||||||
|
move = B_TRUE;
|
||||||
|
}
|
||||||
|
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
|
||||||
|
/* if player is at same level and close, jump */
|
||||||
|
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
|
||||||
|
jump(s,D_RIGHT);
|
||||||
|
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
|
||||||
|
jump(s,D_LEFT);
|
||||||
|
}
|
||||||
|
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
||||||
|
// if near bottom of the screen and can fall through...
|
||||||
move = B_TRUE;
|
move = B_TRUE;
|
||||||
}
|
}
|
||||||
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
|
|
||||||
/* if player is at same level and close, jump */
|
|
||||||
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
|
|
||||||
jump(s,D_RIGHT);
|
|
||||||
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
|
|
||||||
jump(s,D_LEFT);
|
|
||||||
}
|
|
||||||
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
|
||||||
// if near bottom of the screen and can fall through...
|
|
||||||
move = B_TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
move = B_TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
move = B_TRUE;
|
/* either move or turn around */
|
||||||
}
|
if (move) {
|
||||||
|
rv = movex(s, s->dir*getspeed(s));
|
||||||
/* either move or turn around */
|
if (rv) {
|
||||||
if (move) {
|
/* if we couldn't move (hit a wall), turn */
|
||||||
rv = movex(s, s->dir*getspeed(s));
|
s->dir = -s->dir;
|
||||||
if (rv) {
|
}
|
||||||
/* if we couldn't move (hit a wall), turn */
|
} else {
|
||||||
s->dir = -s->dir;
|
s->dir = -s->dir;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
s->dir = -s->dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((s->angry) || (boss)) {
|
if ((s->angry) || (boss)) {
|
||||||
if ((!s->jumping) && (!s->jumptimer)) {
|
if ((!s->jumping) && (!s->jumptimer)) {
|
||||||
|
|
||||||
/* if player is above us, jump */
|
/* if player is above us, jump */
|
||||||
if ( (player && (!player->dead) && (player->y < s->y)) ||
|
if ( (player && (!player->dead) && (player->y < s->y)) ||
|
||||||
(player2 && (!player2->dead) && (player2->y < s->y))) {
|
(player2 && (!player2->dead) && (player2->y < s->y))) {
|
||||||
if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) {
|
if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) {
|
||||||
/* jump right */
|
/* jump right */
|
||||||
jump(s, 1);
|
jump(s, 1);
|
||||||
} else if ((xdiff <= -(TILEW*2)) && (xdiff >= -(TILEW*3))) {
|
} else if ((xdiff <= -(TILEW*2)) && (xdiff >= -(TILEW*3))) {
|
||||||
/* jump left */
|
/* jump left */
|
||||||
jump(s, -1);
|
jump(s, -1);
|
||||||
} else if ((player && (s->y - player->y <= (TILEH*6))) ||
|
} else if ((player && (s->y - player->y <= (TILEH*6))) ||
|
||||||
(player2 && (s->y - player2->y <= (TILEH*6)))) {
|
(player2 && (s->y - player2->y <= (TILEH*6)))) {
|
||||||
if ((xdiff >= 0) && (xdiff < (TILEW*2))) {
|
if ((xdiff >= 0) && (xdiff < (TILEW*2))) {
|
||||||
/* jump up */
|
/* jump up */
|
||||||
jump(s, 0);
|
jump(s, 0);
|
||||||
} else if ((xdiff <= 0) && (xdiff > -(TILEW*2))) {
|
} else if ((xdiff <= 0) && (xdiff > -(TILEW*2))) {
|
||||||
/* jump up */
|
/* jump up */
|
||||||
jump(s, 0);
|
jump(s, 0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* jump whichever way we're facing */
|
||||||
|
/*
|
||||||
|
s->jumpdir = s->dir;
|
||||||
|
s->jumping = 1;
|
||||||
|
s->jumpspeed = 5;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* jump whichever way we're facing */
|
|
||||||
/*
|
|
||||||
s->jumpdir = s->dir;
|
|
||||||
s->jumping = 1;
|
|
||||||
s->jumpspeed = 5;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else { // falling
|
||||||
} else { // falling
|
tiletype_t *tunder, *t2under;
|
||||||
tiletype_t *tunder, *t2under;
|
|
||||||
|
|
||||||
// tile below
|
// tile below
|
||||||
tunder = gettileat(s->x ,s->y,NULL,NULL);
|
tunder = gettileat(s->x ,s->y,NULL,NULL);
|
||||||
t2under = gettileat(s->x ,s->y+s->img->h,NULL,NULL);
|
t2under = gettileat(s->x ,s->y+s->img->h,NULL,NULL);
|
||||||
if ((tunder->solid == S_SLOPE) || (t2under->solid == S_SLOPE)) {
|
if ((tunder->solid == S_SLOPE) || (t2under->solid == S_SLOPE)) {
|
||||||
movex(s, s->dir*getspeed(s));
|
movex(s, s->dir*getspeed(s));
|
||||||
} else if (s->jumpdir) {
|
} else if (s->jumpdir) {
|
||||||
movex(s, s->jumpdir*getspeed(s));
|
movex(s, s->jumpdir*getspeed(s));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} // end if inintro
|
||||||
} else if (s->id == P_SNAIL) {
|
} else if (s->id == P_SNAIL) {
|
||||||
if (!s->falling) {
|
if (!s->falling) {
|
||||||
int move = B_FALSE;
|
int move = B_FALSE;
|
||||||
|
@ -4504,7 +4550,7 @@ void drawlevel(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw player
|
// draw player
|
||||||
if (curlevelnum != 1) {
|
if (curlevelnum != INTRO_LEVELNUM) {
|
||||||
if (player && player->lives > 0) {
|
if (player && player->lives > 0) {
|
||||||
drawsprite(player);
|
drawsprite(player);
|
||||||
drawsprite(cloud);
|
drawsprite(cloud);
|
||||||
|
@ -4521,7 +4567,7 @@ void drawlevel(void) {
|
||||||
SDL_framerateDelay(&manager);
|
SDL_framerateDelay(&manager);
|
||||||
|
|
||||||
// remove players
|
// remove players
|
||||||
if (curlevelnum != 1) {
|
if (curlevelnum != INTRO_LEVELNUM) {
|
||||||
if (player && player->lives > 0) {
|
if (player && player->lives > 0) {
|
||||||
area.x = player->x - player->img->w/2;
|
area.x = player->x - player->img->w/2;
|
||||||
area.y = player->y - player->img->h;
|
area.y = player->y - player->img->h;
|
||||||
|
@ -4603,7 +4649,7 @@ void drawlevel(void) {
|
||||||
|
|
||||||
|
|
||||||
// draw player
|
// draw player
|
||||||
if (curlevelnum != 1) {
|
if (curlevelnum != INTRO_LEVELNUM) {
|
||||||
if (player && player->lives > 0) {
|
if (player && player->lives > 0) {
|
||||||
drawsprite(player);
|
drawsprite(player);
|
||||||
drawsprite(cloud);
|
drawsprite(cloud);
|
||||||
|
@ -4620,7 +4666,7 @@ void drawlevel(void) {
|
||||||
SDL_framerateDelay(&manager);
|
SDL_framerateDelay(&manager);
|
||||||
|
|
||||||
// remove players
|
// remove players
|
||||||
if (curlevelnum != 1) {
|
if (curlevelnum != INTRO_LEVELNUM) {
|
||||||
if (player && player->lives > 0) {
|
if (player && player->lives > 0) {
|
||||||
area.x = player->x - player->img->w/2;
|
area.x = player->x - player->img->w/2;
|
||||||
area.y = player->y - player->img->h;
|
area.y = player->y - player->img->h;
|
||||||
|
@ -4701,7 +4747,7 @@ void drawlevel(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw player
|
// draw player
|
||||||
if (curlevelnum != 1) {
|
if (curlevelnum != INTRO_LEVELNUM) {
|
||||||
if (player && player->lives > 0) {
|
if (player && player->lives > 0) {
|
||||||
drawsprite(player);
|
drawsprite(player);
|
||||||
drawsprite(cloud);
|
drawsprite(cloud);
|
||||||
|
@ -4719,7 +4765,7 @@ void drawlevel(void) {
|
||||||
|
|
||||||
|
|
||||||
// remove players
|
// remove players
|
||||||
if (curlevelnum != 1) {
|
if (curlevelnum != INTRO_LEVELNUM) {
|
||||||
if (player && player->lives > 0) {
|
if (player && player->lives > 0) {
|
||||||
area.x = player->x - player->img->w/2;
|
area.x = player->x - player->img->w/2;
|
||||||
area.y = player->y - player->img->h;
|
area.y = player->y - player->img->h;
|
||||||
|
@ -4800,7 +4846,7 @@ void drawlevel(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw player
|
// draw player
|
||||||
if (curlevelnum != 1) {
|
if (curlevelnum != INTRO_LEVELNUM) {
|
||||||
if (player && player->lives > 0) {
|
if (player && player->lives > 0) {
|
||||||
drawsprite(player);
|
drawsprite(player);
|
||||||
drawsprite(cloud);
|
drawsprite(cloud);
|
||||||
|
@ -4817,7 +4863,7 @@ void drawlevel(void) {
|
||||||
SDL_framerateDelay(&manager);
|
SDL_framerateDelay(&manager);
|
||||||
|
|
||||||
// remove players
|
// remove players
|
||||||
if (curlevelnum != 1) {
|
if (curlevelnum != INTRO_LEVELNUM) {
|
||||||
if (player && player->lives > 0) {
|
if (player && player->lives > 0) {
|
||||||
area.x = player->x - player->img->w/2;
|
area.x = player->x - player->img->w/2;
|
||||||
area.y = player->y - player->img->h;
|
area.y = player->y - player->img->h;
|
||||||
|
@ -4974,7 +5020,7 @@ void movetext(void) {
|
||||||
if (t->state == 0) {
|
if (t->state == 0) {
|
||||||
t->size += TEXTSPEED;
|
t->size += TEXTSPEED;
|
||||||
if (t->size >= t->maxsize) {
|
if (t->size >= t->maxsize) {
|
||||||
if (t->type == TT_HELP) {
|
if (t->type == TT_HELP) {
|
||||||
// freeze
|
// freeze
|
||||||
oldlevelcomplete = levelcomplete;
|
oldlevelcomplete = levelcomplete;
|
||||||
levelcomplete = LV_HELPFREEZE;
|
levelcomplete = LV_HELPFREEZE;
|
||||||
|
@ -4992,6 +5038,9 @@ void movetext(void) {
|
||||||
gameovertime = gtime;
|
gameovertime = gtime;
|
||||||
}
|
}
|
||||||
killtext(t);
|
killtext(t);
|
||||||
|
if (t->type == TT_INTROTEXT) {
|
||||||
|
introstate = IS_JUMP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -5697,6 +5746,12 @@ int isonground(sprite_t *s) {
|
||||||
if (s->onplatform) {
|
if (s->onplatform) {
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// antigrav?
|
||||||
|
if (s->antigrav) {
|
||||||
|
return B_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* get tile below sprite's feet */
|
/* get tile below sprite's feet */
|
||||||
if (isongroundpoint(s, s->x, s->y)) {
|
if (isongroundpoint(s, s->x, s->y)) {
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
|
@ -7829,11 +7884,14 @@ void moveallsprites(void) {
|
||||||
void checkcollideall(void) {
|
void checkcollideall(void) {
|
||||||
sprite_t *s;
|
sprite_t *s;
|
||||||
|
|
||||||
|
|
||||||
/* check collisions for player and effects */
|
/* check collisions for player and effects */
|
||||||
for (s = sprite ; s ; s = s->next) {
|
for (s = sprite ; s ; s = s->next) {
|
||||||
if (isplayer(s)) {
|
if (isplayer(s)) {
|
||||||
if (s->powerup != PW_GUNNER) {
|
if (!inintro()) {
|
||||||
checkcollide(s);
|
if (s->powerup != PW_GUNNER) {
|
||||||
|
checkcollide(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (needscollisions(s->id)) {
|
} else if (needscollisions(s->id)) {
|
||||||
if (isplatform(s->id)) {
|
if (isplatform(s->id)) {
|
||||||
|
@ -7843,6 +7901,8 @@ void checkcollideall(void) {
|
||||||
}
|
}
|
||||||
} else if ((s->id == P_BLACKCLOUD) && (globpowerup == PW_WHISTLE)) {
|
} else if ((s->id == P_BLACKCLOUD) && (globpowerup == PW_WHISTLE)) {
|
||||||
checkcollide(s);
|
checkcollide(s);
|
||||||
|
} else if (inintro() && s->id == P_RAT) {
|
||||||
|
checkcollide(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7873,8 +7933,13 @@ void checkwrap(sprite_t *s) {
|
||||||
if (!iseffect(s->id)) {
|
if (!iseffect(s->id)) {
|
||||||
/* if we've fallen off the bottom... */
|
/* if we've fallen off the bottom... */
|
||||||
if (s->y > (480+s->img->h)) {
|
if (s->y > (480+s->img->h)) {
|
||||||
// move to top
|
if (inintro()) {
|
||||||
s->y = -s->img->h;
|
// die
|
||||||
|
s->dead = D_FINAL;
|
||||||
|
} else {
|
||||||
|
// move to top
|
||||||
|
s->y = -s->img->h;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* if we've gone off the top */
|
/* if we've gone off the top */
|
||||||
if (s->y < -s->img->h) {
|
if (s->y < -s->img->h) {
|
||||||
|
@ -9026,7 +9091,9 @@ if (cheat) {
|
||||||
/* ************************************************************
|
/* ************************************************************
|
||||||
Player movement
|
Player movement
|
||||||
************************************************************/
|
************************************************************/
|
||||||
if ((!paused) && (!levelcomplete != LV_DOPOKER) ) {
|
|
||||||
|
|
||||||
|
if ((!inintro()) && !paused && (!levelcomplete != LV_DOPOKER) ) {
|
||||||
// is cloud touching the player?
|
// is cloud touching the player?
|
||||||
if (levelcomplete == LV_CLOUD) {
|
if (levelcomplete == LV_CLOUD) {
|
||||||
sprite_t *c;
|
sprite_t *c;
|
||||||
|
@ -9678,7 +9745,7 @@ void dotitlescreen(void) {
|
||||||
if ((htime > 0) && (htime % TTIME == 0)) {
|
if ((htime > 0) && (htime % TTIME == 0)) {
|
||||||
if (titlemode == TS_INSERTCOIN) {
|
if (titlemode == TS_INSERTCOIN) {
|
||||||
// INSERTCOIN -> NORMAL HISCORES
|
// INSERTCOIN -> NORMAL HISCORES
|
||||||
gethiscores(easymode());
|
if (wanthiscores) gethiscores(easymode());
|
||||||
titlemode = TS_HISCORES;
|
titlemode = TS_HISCORES;
|
||||||
} else if (titlemode == TS_HISCORES) {
|
} else if (titlemode == TS_HISCORES) {
|
||||||
// next time, get other hiscores
|
// next time, get other hiscores
|
||||||
|
@ -9770,6 +9837,9 @@ void startgame(void) {
|
||||||
curlevelnum = i;
|
curlevelnum = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// special intro level
|
||||||
|
curlevelnum = INTRO_LEVELNUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate player
|
// allocate player
|
||||||
|
@ -9824,14 +9894,26 @@ void startgame(void) {
|
||||||
|
|
||||||
gtime = 0;
|
gtime = 0;
|
||||||
|
|
||||||
|
|
||||||
curlevelnum-- ; // since nextlevel() will increment it
|
curlevelnum-- ; // since nextlevel() will increment it
|
||||||
|
|
||||||
|
// start intro
|
||||||
|
introstate = IS_START;
|
||||||
firstlevel = B_TRUE;
|
firstlevel = B_TRUE;
|
||||||
// start the first level
|
|
||||||
nextlevel();
|
nextlevel();
|
||||||
firstlevel = B_FALSE;
|
firstlevel = B_FALSE;
|
||||||
|
|
||||||
flip();
|
flip();
|
||||||
|
|
||||||
|
// make players face the correct way
|
||||||
|
if (player) {
|
||||||
|
player->dir = D_RIGHT;
|
||||||
|
}
|
||||||
|
if (player2) {
|
||||||
|
player2->dir = D_LEFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// start timer
|
// start timer
|
||||||
timer = 0;
|
timer = 0;
|
||||||
}
|
}
|
||||||
|
@ -10970,3 +11052,170 @@ SDL_Color *getbgcolour (int id) {
|
||||||
|
|
||||||
return &black;
|
return &black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int inintro(void) {
|
||||||
|
if (curlevelnum == INTRO_LEVELNUM) return B_TRUE;
|
||||||
|
return B_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dointroseq(void) {
|
||||||
|
if (introstate == IS_START) {
|
||||||
|
if (gtime >= 1) {
|
||||||
|
introstate = IS_YUM;
|
||||||
|
}
|
||||||
|
} else if (introstate == IS_YUM) {
|
||||||
|
if (player) {
|
||||||
|
addoutlinetext(player->x,player->y - (player->img->h*1.5),TEXTSIZE_YUM,"Yum!",&white,&black,YUMDELAY, TT_INTROTEXT);
|
||||||
|
}
|
||||||
|
if (player2) {
|
||||||
|
addoutlinetext(player2->x,player2->y - (player2->img->h*1.5),TEXTSIZE_YUM,"Yum!",&white,&black,YUMDELAY, TT_INTROTEXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
introstate = IS_YUMWAIT; // exits when yum text is gone
|
||||||
|
} else if (introstate == IS_JUMP) {
|
||||||
|
if (player) {
|
||||||
|
if (!player->jumping && !player->falling) {
|
||||||
|
jump(player, D_RIGHT);
|
||||||
|
player->jumpspeed = 7;
|
||||||
|
} else if (player->falling) {
|
||||||
|
movex(player, getspeed(player)/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player2) {
|
||||||
|
if (!player2->jumping && !player2->falling) {
|
||||||
|
jump(player2, D_LEFT);
|
||||||
|
player2->jumpspeed = 7;
|
||||||
|
} else if (player2->falling) {
|
||||||
|
movex(player2, -getspeed(player2)/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((player && player->falling) || (player2 && player2->falling)) {
|
||||||
|
sprite_t *newsp;
|
||||||
|
double startx,starty;
|
||||||
|
// add rats
|
||||||
|
startx = TILEW;
|
||||||
|
starty = (curlevel->p1y * TILEH) + TILEH-2;
|
||||||
|
puffin(-1, startx, starty, "nothing", 0);
|
||||||
|
newsp = addsprite(P_RAT, startx, starty, "intro_rat");
|
||||||
|
newsp->speed = INTRO_RATSPEED;
|
||||||
|
newsp->antigrav = B_TRUE;
|
||||||
|
introstate = IS_RATS;
|
||||||
|
playfx(FX_BOSSCHARGE);
|
||||||
|
}
|
||||||
|
} else if ((introstate == IS_RATS) || (introstate == IS_RATS2)) {
|
||||||
|
sprite_t *s;
|
||||||
|
double xpoint;
|
||||||
|
// keep moving until we hit the ground
|
||||||
|
if (player) {
|
||||||
|
if (player->falling) {
|
||||||
|
movex(player, getspeed(player));
|
||||||
|
|
||||||
|
}
|
||||||
|
if (introstate == IS_RATS2) {
|
||||||
|
// look around
|
||||||
|
if (timer % 15 == 0) {
|
||||||
|
player->dir = -player->dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player2) {
|
||||||
|
if (player2->falling) {
|
||||||
|
movex(player2, -getspeed(player2));
|
||||||
|
|
||||||
|
}
|
||||||
|
if (introstate == IS_RATS2) {
|
||||||
|
// look around
|
||||||
|
if (timer % 15 == 0) {
|
||||||
|
player2->dir = -player2->dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// add more rats
|
||||||
|
if (introstate != IS_RATS2) {
|
||||||
|
if (countmonsters(P_RAT) <= 4) {
|
||||||
|
if (timer % 5 == 0) {
|
||||||
|
sprite_t *newsp;
|
||||||
|
double startx,starty;
|
||||||
|
// add rats
|
||||||
|
startx = TILEW;
|
||||||
|
starty = (curlevel->p1y * TILEH) + TILEH-2;
|
||||||
|
puffin(-1, startx, starty, "nothing", 0);
|
||||||
|
newsp = addsprite(P_RAT, startx, starty, "intro_rat");
|
||||||
|
newsp->speed = INTRO_RATSPEED;
|
||||||
|
newsp->antigrav = B_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if rats are past p2 start point, they fall
|
||||||
|
xpoint = (curlevel->p2x * TILEW) + (TILEW/2);
|
||||||
|
for (s = sprite ; s ; s = s->next) {
|
||||||
|
if (ismonster(s->id)) {
|
||||||
|
if (s->x >= xpoint) {
|
||||||
|
s->antigrav = B_FALSE;
|
||||||
|
s->speed = (INTRO_RATSPEED / 2);
|
||||||
|
introstate = IS_RATS2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// next state
|
||||||
|
if (countmonsters(-1) <= 0) {
|
||||||
|
introstate = IS_FINISH;
|
||||||
|
if (player) {
|
||||||
|
player->timer1 = 0;
|
||||||
|
player->timer2 = 0;
|
||||||
|
}
|
||||||
|
if (player2) {
|
||||||
|
player2->timer1 = 0;
|
||||||
|
player2->timer2 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (introstate == IS_FINISH) {
|
||||||
|
int finished = B_FALSE;
|
||||||
|
// players jump up and down 3 times
|
||||||
|
if (player) {
|
||||||
|
if (isonground(player)) {
|
||||||
|
if (player->timer1 < 3) {
|
||||||
|
playfx(FX_JUMP);
|
||||||
|
player->jumping = 1;
|
||||||
|
player->jumpdir = 0;
|
||||||
|
player->jumpspeed = 2;
|
||||||
|
|
||||||
|
player->timer1++;
|
||||||
|
finished = B_FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((player->falling) && (player->timer1 >= 3)) {
|
||||||
|
finished = B_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player2) {
|
||||||
|
if (isonground(player2)) {
|
||||||
|
if (player2->timer1 < 3) {
|
||||||
|
playfx(FX_JUMP);
|
||||||
|
player2->jumping = 1;
|
||||||
|
player2->jumpdir = 0;
|
||||||
|
player2->jumpspeed = 2;
|
||||||
|
|
||||||
|
player2->timer1++;
|
||||||
|
finished = B_FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((player2->falling) && (player2->timer1 >= 3)) {
|
||||||
|
finished = B_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finished) {
|
||||||
|
if (levelcomplete == LV_INPROGRESS) {
|
||||||
|
// clouds come in
|
||||||
|
levelcomplete = LV_FINAL;
|
||||||
|
// don't delay
|
||||||
|
levelcompletetime = gtime;
|
||||||
|
gtime += 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
2
rc.h
|
@ -115,8 +115,10 @@ void doplayermovement(sprite_t *pl);
|
||||||
double getxdisttoplayer(sprite_t *s);
|
double getxdisttoplayer(sprite_t *s);
|
||||||
double getydisttoplayer(sprite_t *s);
|
double getydisttoplayer(sprite_t *s);
|
||||||
int playersalive(void);
|
int playersalive(void);
|
||||||
|
int inintro(void);
|
||||||
sprite_t *isplayerbelow(sprite_t *s);
|
sprite_t *isplayerbelow(sprite_t *s);
|
||||||
sprite_t *isplayerabove(sprite_t *s);
|
sprite_t *isplayerabove(sprite_t *s);
|
||||||
sprite_t *isplayerright(sprite_t *s);
|
sprite_t *isplayerright(sprite_t *s);
|
||||||
SDL_Color *getcolour(int id);
|
SDL_Color *getcolour(int id);
|
||||||
SDL_Color *getbgcolour(int id);
|
SDL_Color *getbgcolour(int id);
|
||||||
|
void dointroseq(void);
|
||||||
|
|
9
shared.c
|
@ -51,7 +51,12 @@ int loadlevel(int lnum, int wantmonsters) {
|
||||||
|
|
||||||
printf("Loading level %d-%d (seq %d) %s...",getworld(lnum), getlevel(lnum), lnum,levelentry[lnum].filename);
|
printf("Loading level %d-%d (seq %d) %s...",getworld(lnum), getlevel(lnum), lnum,levelentry[lnum].filename);
|
||||||
|
|
||||||
sprintf(filename,"%s/%s/%s",datadir,DIR_LEVELS,levelentry[lnum].filename);
|
if (lnum == 101) {
|
||||||
|
// special case for intro
|
||||||
|
sprintf(filename,"%s/%s/intro.dat",datadir,DIR_LEVELS);
|
||||||
|
} else {
|
||||||
|
sprintf(filename,"%s/%s/%s",datadir,DIR_LEVELS,levelentry[lnum].filename);
|
||||||
|
}
|
||||||
//filename = levelentry[lnum].filename;
|
//filename = levelentry[lnum].filename;
|
||||||
|
|
||||||
f = fopen(filename,"rt");
|
f = fopen(filename,"rt");
|
||||||
|
@ -688,6 +693,8 @@ void setdefaults(sprite_t *s) {
|
||||||
|
|
||||||
s->onplatform = NULL;
|
s->onplatform = NULL;
|
||||||
|
|
||||||
|
s->antigrav = B_FALSE;
|
||||||
|
|
||||||
s->hasbell = B_FALSE;
|
s->hasbell = B_FALSE;
|
||||||
s->gemboost = 1;
|
s->gemboost = 1;
|
||||||
s->powerup = 0;
|
s->powerup = 0;
|
||||||
|
|