Fixed editor crash

New level
This commit is contained in:
Rob Pearce 2008-10-29 21:54:53 +00:00
parent b21035565f
commit 0efde07a9f
5 changed files with 107 additions and 14 deletions

View File

@ -27,6 +27,7 @@
103,level103.dat,Fishbowls 103,level103.dat,Fishbowls
22,level22.dat,Platforms in the Sand 22,level22.dat,Platforms in the Sand
23,level23.dat,Twisty Little Passages 23,level23.dat,Twisty Little Passages
115,level115.dat,Fine and sunny
113,level113.dat,Mine Shaft 113,level113.dat,Mine Shaft
101,level101.dat,Sand Castle 101,level101.dat,Sand Castle
102,level102.dat,Diving Pool 102,level102.dat,Diving Pool

78
data/world1/level115.dat Normal file
View File

@ -0,0 +1,78 @@
bgfile beach1.png
bg 0
hurryup 30
help
endhelp
monsters
0 20 22
12 34 14
12 4 14
60 22 13
124 15 19
124 24 19
49 32 5
49 7 5
1 32 22
1 7 22
6 33 19
6 4 10
15 33 25
15 4 25
15 6 25
15 35 25
15 31 19
15 29 19
15 8 19
15 10 19
15 8 8
15 10 8
15 29 8
15 31 8
15 34 2
15 36 2
15 5 2
15 3 2
16 30 19
16 9 19
16 9 8
16 30 8
17 35 2
17 4 2
17 5 25
17 34 25
23 20 9
endmonsters
exitdir 1
44,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,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,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,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,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,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,25,25,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,25,25,25,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,25,25,25,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,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,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,25,25,25,0,0,0,0,0,17,0,0,0,0,0,0,0,17,0,0,0,0,25,25,25,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,24,16,16,16,16,16,16,16,16,16,16,16,16,16,16,24,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,24,15,15,15,15,15,15,15,15,15,15,15,15,15,15,24,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,24,15,15,15,15,15,15,15,15,15,15,15,15,15,15,24,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,24,15,15,15,15,15,15,15,15,15,15,15,15,15,15,24,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,25,25,25,25,25,25,25,0,24,15,15,15,15,15,15,15,15,15,15,15,15,15,15,24,0,25,25,25,25,25,25,25,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,24,15,15,15,15,15,15,15,15,15,15,15,15,15,15,24,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,24,15,15,15,15,15,15,15,15,15,15,15,15,15,15,24,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,24,15,15,15,15,15,15,15,15,15,15,15,15,15,15,24,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,24,15,15,15,15,15,15,15,15,15,15,15,15,15,15,24,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,25,25,25,0,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,0,25,25,25,0,0,0,0,0,0,0,44,
44,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,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,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,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,25,25,25,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,0,25,25,25,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,0,0,0,25,25,25,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,0,0,0,44,
44,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,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,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,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
44,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,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
layer2
39,0,44
20,15,14

13
edit.c
View File

@ -369,6 +369,8 @@ int main (int argc, char **argv) {
int lev; int lev;
// get level # at mouse posj // get level # at mouse posj
lev = (my / (EDITTEXT + LLISTPADY)); lev = (my / (EDITTEXT + LLISTPADY));
// adjust for world offset
lev = lev + (getworld(curlevelnum)-1)*20;
if (curlevelnum != lev) { if (curlevelnum != lev) {
@ -978,6 +980,10 @@ void clearlevel(void) {
} }
/* clear level */ /* clear level */
if (curlevel->animtiles) {
free(level->animtiles);
curlevel->animtiles = NULL;
}
for (x = 0; x < LEVELW; x++) { for (x = 0; x < LEVELW; x++) {
for (y = 0; y < LEVELH; y++) { for (y = 0; y < LEVELH; y++) {
offset = y*LEVELW+x; offset = y*LEVELW+x;
@ -989,10 +995,13 @@ void clearlevel(void) {
curlevel->map[offset] = T_BLANK; curlevel->map[offset] = T_BLANK;
} }
curlevel->map2[offset] = T_BLANK; curlevel->map2[offset] = T_BLANK;
curlevel->tileframe[offset] = 0;
draweditortile(screen,x,y); draweditortile(screen,x,y);
} }
} }
curlevel->nummonsters = 0;
modified = B_TRUE; modified = B_TRUE;
} }
@ -1199,12 +1208,12 @@ void drawlevellist(void) {
area.h = EDITMAPH; area.h = EDITMAPH;
SDL_FillRect(screen, &area, SDL_MapRGB(screen->format, 0, 0, 0)); SDL_FillRect(screen, &area, SDL_MapRGB(screen->format, 0, 0, 0));
// draw level list // draw level list (starting at current world)
area.x = LLISTX; area.x = LLISTX;
area.y = 0; area.y = 0;
area.w = 0; area.w = 0;
area.h = 0; area.h = 0;
for (i =1; i < numlevels; i++) { for (i = ((getworld(curlevelnum)-1)*20)+1; i < numlevels; i++) {
if (i == curlevelnum) { if (i == curlevelnum) {
col = &green; col = &green;
} else if (i <= 20) { } else if (i <= 20) {

28
rc.c
View File

@ -357,7 +357,7 @@ int main (int argc, char **argv) {
// turn off clock and water powerups // turn off clock and water powerups
if (player->powerup == PW_CLOCK) { if (player->powerup == PW_CLOCK) {
Mix_ResumeMusic(); Mix_ResumeMusic();
player->powerup = B_FALSE; losepowerup(player);
} else if ((curlevel->iced == WATER_INPROGRESS) || (curlevel->iced == WATER_COMPLETE)) { } else if ((curlevel->iced == WATER_INPROGRESS) || (curlevel->iced == WATER_COMPLETE)) {
curlevel->iced = B_FALSE; curlevel->iced = B_FALSE;
undoflood(); undoflood();
@ -672,7 +672,7 @@ int main (int argc, char **argv) {
} }
if (--player->timer1 == 0) { if (--player->timer1 == 0) {
player->powerup = B_FALSE; losepowerup(player);
} }
} else if (player->powerup == PW_SPRAYUP) { // green overlay for fly spray } else if (player->powerup == PW_SPRAYUP) { // green overlay for fly spray
if (levelcomplete != LV_DOPOKER) { if (levelcomplete != LV_DOPOKER) {
@ -722,7 +722,7 @@ int main (int argc, char **argv) {
if (--player->timer1 == 0) { if (--player->timer1 == 0) {
player->powerup = B_FALSE; losepowerup(player);
} }
} }
@ -814,7 +814,7 @@ void tick(void) {
if (clocktime < 0) { if (clocktime < 0) {
// finished! // finished!
Mix_ResumeMusic(); Mix_ResumeMusic();
player->powerup = B_FALSE; losepowerup(player);
} }
} }
@ -855,7 +855,7 @@ void tick(void) {
// rings are disabled // rings are disabled
if ((player->powerup == PW_RINGWALK) || (player->powerup == PW_RINGJUMP)) { if ((player->powerup == PW_RINGWALK) || (player->powerup == PW_RINGJUMP)) {
player->powerup = B_FALSE; losepowerup(player);
} }
@ -984,7 +984,7 @@ void nextlevel(void) {
// phone is cancelled on boss levels // phone is cancelled on boss levels
if (player->powerup == PW_PHONE) { if (player->powerup == PW_PHONE) {
if (isbosslevel(curlevelnum)) { if (isbosslevel(curlevelnum)) {
player->powerup = B_FALSE; losepowerup(player);
skiplevels = 0; skiplevels = 0;
} }
} }
@ -1046,10 +1046,10 @@ void nextlevel(void) {
if (player->powerup == PW_PHONE) { if (player->powerup == PW_PHONE) {
skiplevels--; skiplevels--;
if (skiplevels <= 0) { if (skiplevels <= 0) {
player->powerup = B_FALSE; losepowerup(player);
} }
} else { } else {
player->powerup = B_FALSE; losepowerup(player);
} }
@ -1203,7 +1203,7 @@ void die(sprite_t *s) {
if (player->powerup == PW_CLOCK) { if (player->powerup == PW_CLOCK) {
Mix_ResumeMusic(); Mix_ResumeMusic();
} }
player->powerup = B_FALSE; losepowerup(player);
resethurryup(curlevel); resethurryup(curlevel);
if (curmusic == fastmusic) { if (curmusic == fastmusic) {
@ -1261,7 +1261,7 @@ void die(sprite_t *s) {
} else if (s == boss) { // boss effects } else if (s == boss) { // boss effects
// stop screen shaking // stop screen shaking
if (player->powerup == PW_RATSHAKE) { if (player->powerup == PW_RATSHAKE) {
player->powerup = B_FALSE; losepowerup(player);
} }
// reset timers // reset timers
s->timer1 = 0; s->timer1 = 0;
@ -7527,7 +7527,7 @@ void docannoneffect(void) {
if (!found) { if (!found) {
printf("weird error - no cannon!!\n"); printf("weird error - no cannon!!\n");
player->powerup = B_FALSE; losepowerup(player);
} else { } else {
int initx,inity; int initx,inity;
int i; int i;
@ -7580,7 +7580,7 @@ void docannoneffect(void) {
if (timer % 8 == 0) { if (timer % 8 == 0) {
player->timer3--; player->timer3--;
if (player->timer3 <= 0) { if (player->timer3 <= 0) {
player->powerup = B_FALSE; losepowerup(player);
s->dead = D_FINAL; s->dead = D_FINAL;
SDL_BlitSurface(temps, NULL, screen, NULL); SDL_BlitSurface(temps, NULL, screen, NULL);
} }
@ -8633,3 +8633,7 @@ void stopteleporting(sprite_t *s) {
s->img = imageset[s->id].img[F_WALK1]; s->img = imageset[s->id].img[F_WALK1];
} }
} }
void losepowerup(sprite_t *s) {
s->powerup = B_FALSE;
}

1
rc.h
View File

@ -102,3 +102,4 @@ void getinput(void);
int isendoflev(void); int isendoflev(void);
void keeponscreen(sprite_t *s); void keeponscreen(sprite_t *s);
void stopteleporting(sprite_t *s); void stopteleporting(sprite_t *s);
void losepowerup(sprite_t *s);