git-svn-id: https://svn.eduke32.com/eduke32@562 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2007-08-26 11:28:32 +00:00
parent ad5c98d66f
commit d651d1d895
9 changed files with 83 additions and 79 deletions

View file

@ -478,7 +478,7 @@ extern long *actorLoadEventScrptr[MAXTILES];
extern char actortype[MAXTILES]; extern char actortype[MAXTILES];
extern char *music_pointer; extern char *music_pointer;
extern char *music_fn[MAXVOLUMES+1][MAXLEVELS],music_select; extern char music_select;
extern char env_music_fn[MAXVOLUMES+1][BMAX_PATH]; extern char env_music_fn[MAXVOLUMES+1][BMAX_PATH];
extern short camsprite; extern short camsprite;
@ -539,8 +539,6 @@ extern int screencapt;
extern short soundps[NUM_SOUNDS],soundpe[NUM_SOUNDS],soundvo[NUM_SOUNDS]; extern short soundps[NUM_SOUNDS],soundpe[NUM_SOUNDS],soundvo[NUM_SOUNDS];
extern char soundpr[NUM_SOUNDS],soundm[NUM_SOUNDS]; extern char soundpr[NUM_SOUNDS],soundm[NUM_SOUNDS];
extern long soundsiz[NUM_SOUNDS]; extern long soundsiz[NUM_SOUNDS];
extern char *level_names[MAXVOLUMES*MAXLEVELS];
extern long partime[MAXVOLUMES*MAXLEVELS],designertime[MAXVOLUMES*MAXLEVELS];
extern char volume_names[MAXVOLUMES][33]; extern char volume_names[MAXVOLUMES][33];
extern char skill_names[5][33]; extern char skill_names[5][33];
@ -574,7 +572,6 @@ enum gametypeflags {
#define GTFLAGS(x) (gametype_flags[ud.coop] & x) #define GTFLAGS(x) (gametype_flags[ud.coop] & x)
extern char *level_file_names[MAXVOLUMES*MAXLEVELS];
extern char num_volumes; extern char num_volumes;
extern int lastsavedpos; extern int lastsavedpos;
@ -898,6 +895,13 @@ extern int redefined_quote_count;
extern char setupfilename[BMAX_PATH]; extern char setupfilename[BMAX_PATH];
typedef struct {
char *name, *filename, *musicfn;
long partime, designertime;
} map_t;
extern map_t map[MAXVOLUMES*MAXLEVELS];
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -925,7 +925,7 @@ void getpackets(void)
voting = packbuf[2]; voting = packbuf[2];
vote_episode = packbuf[3]; vote_episode = packbuf[3];
vote_map = packbuf[4]; vote_map = packbuf[4];
Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",ud.user_name[(unsigned char)packbuf[2]],level_names[(unsigned char)(packbuf[3]*MAXLEVELS + packbuf[4])],packbuf[3]+1,packbuf[4]+1); Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",ud.user_name[(unsigned char)packbuf[2]],map[(unsigned char)(packbuf[3]*MAXLEVELS + packbuf[4])].name,packbuf[3]+1,packbuf[4]+1);
adduserquote(tempbuf); adduserquote(tempbuf);
Bsprintf(tempbuf,"PRESS F1 TO VOTE YES, F2 TO VOTE NO"); Bsprintf(tempbuf,"PRESS F1 TO VOTE YES, F2 TO VOTE NO");
adduserquote(tempbuf); adduserquote(tempbuf);
@ -3380,7 +3380,7 @@ void displayrest(long smoothratio)
else a = 182; else a = 182;
minitext(1,a+6,volume_names[ud.volume_number],0,2+8+16); minitext(1,a+6,volume_names[ud.volume_number],0,2+8+16);
minitext(1,a+12,level_names[ud.volume_number*MAXLEVELS + ud.level_number],0,2+8+16); minitext(1,a+12,map[ud.volume_number*MAXLEVELS + ud.level_number].name,0,2+8+16);
} }
} }
} }
@ -7462,7 +7462,7 @@ FOUNDCHEAT:
levnume--; levnume--;
if ((VOLUMEONE && volnume > 0) || volnume > num_volumes-1 || if ((VOLUMEONE && volnume > 0) || volnume > num_volumes-1 ||
levnume >= MAXLEVELS || level_file_names[volnume*MAXLEVELS+levnume] == NULL) levnume >= MAXLEVELS || map[volnume*MAXLEVELS+levnume].filename == NULL)
{ {
ps[myconnectindex].cheat_phase = 0; ps[myconnectindex].cheat_phase = 0;
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
@ -7845,15 +7845,15 @@ static void nonsharedkeys(void)
{ {
i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6); i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6);
music_select++; music_select++;
while ((music_fn[0][(unsigned char)music_select] == NULL) && music_select < i) while ((map[(unsigned char)music_select].musicfn == NULL) && music_select < i)
music_select++; music_select++;
if (music_select == i) if (music_select == i)
music_select = 0; music_select = 0;
if (music_fn[0][(unsigned char)music_select] != NULL) if (map[(unsigned char)music_select].musicfn != NULL)
{ {
Bsprintf(fta_quotes[26],"PLAYING %s",&music_fn[0][(unsigned char)music_select][0]); Bsprintf(fta_quotes[26],"PLAYING %s",&map[(unsigned char)music_select].musicfn[0]);
FTA(26,&ps[myconnectindex]); FTA(26,&ps[myconnectindex]);
playmusic(&music_fn[0][(unsigned char)music_select][0]); playmusic(&map[(unsigned char)music_select].musicfn[0]);
} }
return; return;
} }
@ -8071,8 +8071,8 @@ FAKE_F3:
if (KB_KeyPressed(sc_F5) && config.MusicDevice >= 0) if (KB_KeyPressed(sc_F5) && config.MusicDevice >= 0)
{ {
KB_ClearKeyDown(sc_F5); KB_ClearKeyDown(sc_F5);
if (music_fn[0][(unsigned char)music_select] != NULL) if (map[(unsigned char)music_select].musicfn != NULL)
Bstrcpy(fta_quotes[26],&music_fn[0][(unsigned char)music_select][0]); Bstrcpy(fta_quotes[26],&map[(unsigned char)music_select].musicfn[0]);
else fta_quotes[26][0] = '\0'; else fta_quotes[26][0] = '\0';
Bstrcat(fta_quotes[26],". USE SHIFT-F5 TO CHANGE."); Bstrcat(fta_quotes[26],". USE SHIFT-F5 TO CHANGE.");
FTA(26,&ps[myconnectindex]); FTA(26,&ps[myconnectindex]);
@ -9270,12 +9270,12 @@ static void freeconmem(void)
for (i=(MAXLEVELS*MAXVOLUMES)-1;i>=0;i--) for (i=(MAXLEVELS*MAXVOLUMES)-1;i>=0;i--)
{ {
if (level_names[i] != NULL) if (map[i].name != NULL)
Bfree(level_names[i]); Bfree(map[i].name);
if (level_file_names[i] != NULL) if (map[i].filename != NULL)
Bfree(level_file_names[i]); Bfree(map[i].filename);
if (music_fn[0][i] != NULL) if (map[i].musicfn != NULL)
Bfree(music_fn[0][i]); Bfree(map[i].musicfn);
} }
for (i=MAXQUOTES-1;i>=0;i--) for (i=MAXQUOTES-1;i>=0;i--)
@ -10412,7 +10412,7 @@ MAIN_LOOP_RESTART:
{ {
Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE FOR MAP",ud.user_name[voting]); Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE FOR MAP",ud.user_name[voting]);
gametext(160,40,tempbuf,0,2+8+16); gametext(160,40,tempbuf,0,2+8+16);
Bsprintf(tempbuf,"%s (E%dL%d)",level_names[vote_episode*MAXLEVELS + vote_map],vote_episode+1,vote_map+1); Bsprintf(tempbuf,"%s (E%dL%d)",map[vote_episode*MAXLEVELS + vote_map].name,vote_episode+1,vote_map+1);
gametext(160,48,tempbuf,0,2+8+16); gametext(160,48,tempbuf,0,2+8+16);
gametext(160,70,"PRESS F1 TO VOTE YES, F2 TO VOTE NO",0,2+8+16); gametext(160,70,"PRESS F1 TO VOTE YES, F2 TO VOTE NO",0,2+8+16);
} }
@ -11627,7 +11627,7 @@ void dobonus(int bonusonly)
if (!lastmapname) lastmapname = Bstrrchr(boardfilename,'/'); if (!lastmapname) lastmapname = Bstrrchr(boardfilename,'/');
if (!lastmapname) lastmapname = boardfilename; if (!lastmapname) lastmapname = boardfilename;
} }
else lastmapname = level_names[(ud.volume_number*MAXLEVELS)+ud.last_level-1]; else lastmapname = map[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name;
bonuscnt = 0; bonuscnt = 0;
@ -11938,7 +11938,7 @@ FRAGBONUS:
if (PLUTOPAK) // JBF 20030804 if (PLUTOPAK) // JBF 20030804
rotatesprite((260)<<16,36<<16,65536L,0,PLUTOPAKSPRITE+2,0,0,2+8,0,0,xdim-1,ydim-1); rotatesprite((260)<<16,36<<16,65536L,0,PLUTOPAKSPRITE+2,0,0,2+8,0,0,xdim-1,ydim-1);
gametext(160,58+2,"MULTIPLAYER TOTALS",0,2+8+16); gametext(160,58+2,"MULTIPLAYER TOTALS",0,2+8+16);
gametext(160,58+10,level_names[(ud.volume_number*MAXLEVELS)+ud.last_level-1],0,2+8+16); gametext(160,58+10,map[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name,0,2+8+16);
gametext(160,165,"PRESS ANY KEY TO CONTINUE",0,2+8+16); gametext(160,165,"PRESS ANY KEY TO CONTINUE",0,2+8+16);
@ -12045,11 +12045,11 @@ FRAGBONUS:
totalclock = 0; totalclock = 0;
tinc = 0; tinc = 0;
playerbest = CONFIG_GetMapBestTime(level_file_names[ud.volume_number*MAXLEVELS+ud.last_level-1]); playerbest = CONFIG_GetMapBestTime(map[ud.volume_number*MAXLEVELS+ud.last_level-1].filename);
if (ps[myconnectindex].player_par < playerbest || playerbest < 0) if (ps[myconnectindex].player_par < playerbest || playerbest < 0)
{ {
CONFIG_SetMapBestTime(level_file_names[ud.volume_number*MAXLEVELS+ud.last_level-1], ps[myconnectindex].player_par); CONFIG_SetMapBestTime(map[ud.volume_number*MAXLEVELS+ud.last_level-1].filename, ps[myconnectindex].player_par);
// if(playerbest != -1) // if(playerbest != -1)
// playerbest = ps[myconnectindex].player_par; // playerbest = ps[myconnectindex].player_par;
} }
@ -12061,11 +12061,11 @@ FRAGBONUS:
clockpad = max(clockpad,ij); clockpad = max(clockpad,ij);
if (!(ud.volume_number == 0 && ud.last_level-1 == 7)) if (!(ud.volume_number == 0 && ud.last_level-1 == 7))
{ {
for (ii=partime[ud.volume_number*MAXLEVELS+ud.last_level-1]/(26*60), ij=1; ii>9; ii/=10, ij++) ; for (ii=map[ud.volume_number*MAXLEVELS+ud.last_level-1].partime/(26*60), ij=1; ii>9; ii/=10, ij++) ;
clockpad = max(clockpad,ij); clockpad = max(clockpad,ij);
if (!NAM) if (!NAM)
{ {
for (ii=designertime[ud.volume_number*MAXLEVELS+ud.last_level-1]/(26*60), ij=1; ii>9; ii/=10, ij++) ; for (ii=map[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime/(26*60), ij=1; ii>9; ii/=10, ij++) ;
clockpad = max(clockpad,ij); clockpad = max(clockpad,ij);
} }
} }
@ -12185,16 +12185,16 @@ FRAGBONUS:
if (!(ud.volume_number == 0 && ud.last_level-1 == 7)) if (!(ud.volume_number == 0 && ud.last_level-1 == 7))
{ {
Bsprintf(tempbuf,"%0*ld:%02ld",clockpad, Bsprintf(tempbuf,"%0*ld:%02ld",clockpad,
(partime[ud.volume_number*MAXLEVELS+ud.last_level-1]/(26*60)), (map[ud.volume_number*MAXLEVELS+ud.last_level-1].partime/(26*60)),
(partime[ud.volume_number*MAXLEVELS+ud.last_level-1]/26)%60); (map[ud.volume_number*MAXLEVELS+ud.last_level-1].partime/26)%60);
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16);
yy+=10; yy+=10;
if (!NAM) if (!NAM)
{ {
Bsprintf(tempbuf,"%0*ld:%02ld",clockpad, Bsprintf(tempbuf,"%0*ld:%02ld",clockpad,
(designertime[ud.volume_number*MAXLEVELS+ud.last_level-1]/(26*60)), (map[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime/(26*60)),
(designertime[ud.volume_number*MAXLEVELS+ud.last_level-1]/26)%60); (map[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime/26)%60);
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16);
yy+=10; yy+=10;
} }

View file

@ -1881,12 +1881,12 @@ static int parsecommand(void)
} }
tempbuf[j+1] = '\0'; tempbuf[j+1] = '\0';
if (music_fn[k][i] == NULL) if (map[(k*MAXLEVELS)+i].musicfn == NULL)
music_fn[k][i] = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char)); map[(k*MAXLEVELS)+i].musicfn = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char));
else if ((Bstrlen(tempbuf)+1) > sizeof(music_fn[k][i])) else if ((Bstrlen(tempbuf)+1) > sizeof(map[(k*MAXLEVELS)+i].musicfn))
music_fn[k][i] = Brealloc(music_fn[k][i],(Bstrlen(tempbuf)+1)); map[(k*MAXLEVELS)+i].musicfn = Brealloc(map[(k*MAXLEVELS)+i].musicfn,(Bstrlen(tempbuf)+1));
Bstrcpy(music_fn[k][i],tempbuf); Bstrcpy(map[(k*MAXLEVELS)+i].musicfn,tempbuf);
textptr += j; textptr += j;
if (i > MAXLEVELS-1) break; if (i > MAXLEVELS-1) break;
@ -4065,25 +4065,25 @@ repeatcase:
Bcorrectfilename(tempbuf,0); Bcorrectfilename(tempbuf,0);
if (level_file_names[j*MAXLEVELS+k] == NULL) if (map[j*MAXLEVELS+k].filename == NULL)
level_file_names[j*MAXLEVELS+k] = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char)); map[j*MAXLEVELS+k].filename = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char));
else if ((Bstrlen(tempbuf)+1) > sizeof(level_file_names[j*MAXLEVELS+k])) else if ((Bstrlen(tempbuf)+1) > sizeof(map[j*MAXLEVELS+k].filename))
level_file_names[j*MAXLEVELS+k] = Brealloc(level_file_names[j*MAXLEVELS+k],(Bstrlen(tempbuf)+1)); map[j*MAXLEVELS+k].filename = Brealloc(map[j*MAXLEVELS+k].filename,(Bstrlen(tempbuf)+1));
/* initprintf("level file name string len: %ld\n",Bstrlen(tempbuf)); */ /* initprintf("level file name string len: %ld\n",Bstrlen(tempbuf)); */
Bstrcpy(level_file_names[j*MAXLEVELS+k],tempbuf); Bstrcpy(map[j*MAXLEVELS+k].filename,tempbuf);
while (*textptr == ' ' || *textptr == '\t') textptr++; while (*textptr == ' ' || *textptr == '\t') textptr++;
partime[j*MAXLEVELS+k] = map[j*MAXLEVELS+k].partime =
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*26*60)+ (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*26*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*26); (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*26);
textptr += 5; textptr += 5;
while (*textptr == ' ' || *textptr == '\t') textptr++; while (*textptr == ' ' || *textptr == '\t') textptr++;
designertime[j*MAXLEVELS+k] = map[j*MAXLEVELS+k].designertime =
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*26*60)+ (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*26*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*26); (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*26);
@ -4107,14 +4107,14 @@ repeatcase:
tempbuf[i] = '\0'; tempbuf[i] = '\0';
if (level_names[j*MAXLEVELS+k] == NULL) if (map[j*MAXLEVELS+k].name == NULL)
level_names[j*MAXLEVELS+k] = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char)); map[j*MAXLEVELS+k].name = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char));
else if ((Bstrlen(tempbuf)+1) > sizeof(level_names[j*MAXLEVELS+k])) else if ((Bstrlen(tempbuf)+1) > sizeof(map[j*MAXLEVELS+k].name))
level_names[j*MAXLEVELS+k] = Brealloc(level_names[j*MAXLEVELS+k],(Bstrlen(tempbuf)+1)); map[j*MAXLEVELS+k].name = Brealloc(map[j*MAXLEVELS+k].name,(Bstrlen(tempbuf)+1));
/* initprintf("level name string len: %ld\n",Bstrlen(tempbuf)); */ /* initprintf("level name string len: %ld\n",Bstrlen(tempbuf)); */
Bstrcpy(level_names[j*MAXLEVELS+k],tempbuf); Bstrcpy(map[j*MAXLEVELS+k].name,tempbuf);
return 0; return 0;

View file

@ -6136,8 +6136,8 @@ static int parse(void)
case CON_STARTTRACK: case CON_STARTTRACK:
insptr++; insptr++;
music_select=*insptr++; music_select=*insptr++;
if (music_fn[ud.volume_number][(unsigned char)music_select] != NULL) if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&music_fn[ud.volume_number][(unsigned char)music_select][0]); playmusic(&map[(unsigned char)music_select].musicfn[0]);
break; break;
case CON_GETTEXTURECEILING: case CON_GETTEXTURECEILING:

View file

@ -56,8 +56,8 @@ short mirrorwall[64], mirrorsector[64], mirrorcnt;
int current_menu; int current_menu;
char *level_names[MAXVOLUMES*MAXLEVELS],*level_file_names[MAXVOLUMES*MAXLEVELS]; map_t map[MAXVOLUMES*MAXLEVELS];
long partime[MAXVOLUMES*MAXLEVELS],designertime[MAXVOLUMES*MAXLEVELS];
char volume_names[MAXVOLUMES][33] = { "L.A. MELTDOWN", "LUNAR APOCALYPSE", "SHRAPNEL CITY" }; char volume_names[MAXVOLUMES][33] = { "L.A. MELTDOWN", "LUNAR APOCALYPSE", "SHRAPNEL CITY" };
char skill_names[5][33] = { "PIECE OF CAKE", "LET'S ROCK", "COME GET SOME", "DAMN I'M GOOD" }; char skill_names[5][33] = { "PIECE OF CAKE", "LET'S ROCK", "COME GET SOME", "DAMN I'M GOOD" };

View file

@ -4232,8 +4232,8 @@ cheat_for_port_credits:
{ {
if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME) if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME)
{ {
if (music_fn[0][(unsigned char)music_select] != NULL) if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&music_fn[0][(unsigned char)music_select][0]); playmusic(&map[(unsigned char)music_select].musicfn[0]);
} }
else playmusic(&env_music_fn[0][0]); else playmusic(&env_music_fn[0][0]);
@ -4836,7 +4836,7 @@ VOLUME_ALL_40x:
if (ud.m_volume_number == 0 && ud.m_level_number > 6+(boardfilename[0]!=0)) if (ud.m_volume_number == 0 && ud.m_level_number > 6+(boardfilename[0]!=0))
ud.m_level_number = 0; ud.m_level_number = 0;
while (level_names[(ud.m_volume_number*MAXLEVELS)+ud.m_level_number] == NULL) while (map[(ud.m_volume_number*MAXLEVELS)+ud.m_level_number].name == NULL)
{ {
if (ud.m_level_number < i || i == 0) if (ud.m_level_number < i || i == 0)
ud.m_level_number--; ud.m_level_number--;
@ -4965,7 +4965,7 @@ VOLUME_ALL_40x:
gametext(c+70,57+16-7-9,volume_names[ud.m_volume_number],MENUHIGHLIGHT(1),2+8+16); gametext(c+70,57+16-7-9,volume_names[ud.m_volume_number],MENUHIGHLIGHT(1),2+8+16);
} }
gametext(c+70,57+16+16-7-9,&level_names[MAXLEVELS*ud.m_volume_number+ud.m_level_number][0],MENUHIGHLIGHT(2),2+8+16); gametext(c+70,57+16+16-7-9,&map[MAXLEVELS*ud.m_volume_number+ud.m_level_number].name[0],MENUHIGHLIGHT(2),2+8+16);
gametext(c+70,57+16+16+16-7-9,ud.m_monsters_off == 0 || ud.m_player_skill > 0?skill_names[ud.m_player_skill]:"NONE",MENUHIGHLIGHT(3),2+8+16); gametext(c+70,57+16+16+16-7-9,ud.m_monsters_off == 0 || ud.m_player_skill > 0?skill_names[ud.m_player_skill]:"NONE",MENUHIGHLIGHT(3),2+8+16);

View file

@ -363,8 +363,8 @@ static int osdcmd_restartsound(const osdfuncparm_t *parm)
{ {
if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME) if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME)
{ {
if (music_fn[0][(unsigned char)music_select] != NULL) if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&music_fn[0][(unsigned char)music_select][0]); playmusic(&map[(unsigned char)music_select].musicfn[0]);
} }
else playmusic(&env_music_fn[0][0]); else playmusic(&env_music_fn[0][0]);
} }

View file

@ -351,8 +351,8 @@ static void dofrontscreens(char *statustext)
else else
{ {
menutext(160,90,0,0,"ENTERING"); menutext(160,90,0,0,"ENTERING");
if (level_names[(ud.volume_number*MAXLEVELS) + ud.level_number] != NULL) if (map[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL)
menutext(160,90+16+8,0,0,level_names[(ud.volume_number*MAXLEVELS) + ud.level_number]); menutext(160,90+16+8,0,0,map[(ud.volume_number*MAXLEVELS) + ud.level_number].name);
} }
if (statustext) gametext(160,180,statustext,0,2+8+16); if (statustext) gametext(160,180,statustext,0,2+8+16);
@ -1556,8 +1556,8 @@ static void getlevelfromfilename(const char *fn, char *volume, char *level)
{ {
for (*level=0;*level<MAXLEVELS;(*level)++) for (*level=0;*level<MAXLEVELS;(*level)++)
{ {
if (level_file_names[(*volume*MAXLEVELS)+*level] != NULL) if (map[(*volume*MAXLEVELS)+*level].filename != NULL)
if (!Bstrcasecmp(fn, level_file_names[(*volume*MAXLEVELS)+*level])) if (!Bstrcasecmp(fn, map[(*volume*MAXLEVELS)+*level].filename))
break; break;
} }
if (*level != MAXLEVELS) if (*level != MAXLEVELS)
@ -1614,16 +1614,16 @@ int enterlevel(int g)
} }
} }
if (level_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL || level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL) if (map[(ud.volume_number*MAXLEVELS)+ud.level_number].name == NULL || map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename == NULL)
{ {
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0) if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
{ {
if (level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL) if (map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename == NULL)
level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number] = Bcalloc(BMAX_PATH,sizeof(char)); map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename = Bcalloc(BMAX_PATH,sizeof(char));
if (level_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL) if (map[(ud.volume_number*MAXLEVELS)+ud.level_number].name == NULL)
{ {
level_names[(ud.volume_number*MAXLEVELS)+ud.level_number] = Bcalloc(9,sizeof(char)); map[(ud.volume_number*MAXLEVELS)+ud.level_number].name = Bcalloc(9,sizeof(char));
Bsprintf(level_names[(ud.volume_number*MAXLEVELS)+ud.level_number],"USER MAP"); Bsprintf(map[(ud.volume_number*MAXLEVELS)+ud.level_number].name,"USER MAP");
} }
} }
else else
@ -1644,7 +1644,7 @@ int enterlevel(int g)
Bstrcpy(levname, boardfilename); Bstrcpy(levname, boardfilename);
Bsprintf(apptitle," - %s",levname); Bsprintf(apptitle," - %s",levname);
} }
else Bsprintf(apptitle," - %s",level_names[(ud.volume_number*MAXLEVELS)+ud.level_number]); else Bsprintf(apptitle," - %s",map[(ud.volume_number*MAXLEVELS)+ud.level_number].name);
if (VOLUMEALL) Bsprintf(tempbuf,HEAD2); if (VOLUMEALL) Bsprintf(tempbuf,HEAD2);
else Bsprintf(tempbuf,HEAD); else Bsprintf(tempbuf,HEAD);
@ -1678,16 +1678,16 @@ int enterlevel(int g)
if (!loadmaphack(levname)) initprintf("Loaded map hack file '%s'\n",levname); if (!loadmaphack(levname)) initprintf("Loaded map hack file '%s'\n",levname);
} }
} }
else if (loadboard(level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number],0,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum) == -1) else if (loadboard(map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,0,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum) == -1)
{ {
initprintf("Map %s not found!\n",level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number]); initprintf("Map %s not found!\n",map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
//gameexit(tempbuf); //gameexit(tempbuf);
return 1; return 1;
} }
else else
{ {
char *p; char *p;
strcpy(levname, level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number]); strcpy(levname, map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
p = Bstrrchr(levname,'.'); p = Bstrrchr(levname,'.');
if (!p) strcat(levname,".mhk"); if (!p) strcat(levname,".mhk");
else else
@ -1704,14 +1704,14 @@ int enterlevel(int g)
else else
{ {
i = strlen(level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number]); i = strlen(map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
copybufbyte(level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number],&levname[0],i); copybufbyte(map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,&levname[0],i);
levname[i] = 255; levname[i] = 255;
levname[i+1] = 0; levname[i+1] = 0;
if (loadboard(levname,1,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum) == -1) if (loadboard(levname,1,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum) == -1)
{ {
initprintf("Map '%s' not found!\n",level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number]); initprintf("Map '%s' not found!\n",map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
//gameexit(tempbuf); //gameexit(tempbuf);
return 1; return 1;
} }
@ -1751,8 +1751,8 @@ int enterlevel(int g)
if (ud.recstat != 2) if (ud.recstat != 2)
{ {
music_select = (ud.volume_number*MAXLEVELS) + ud.level_number; music_select = (ud.volume_number*MAXLEVELS) + ud.level_number;
if (music_fn[0][(unsigned char)music_select] != NULL) if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&music_fn[0][(unsigned char)music_select][0]); playmusic(&map[(unsigned char)music_select].musicfn[0]);
} }
if ((g&MODE_GAME) || (g&MODE_EOL)) if ((g&MODE_GAME) || (g&MODE_EOL))
@ -1830,6 +1830,6 @@ int enterlevel(int g)
// variables are set by pointer... // variables are set by pointer...
OnEvent(EVENT_ENTERLEVEL, -1, -1, -1); OnEvent(EVENT_ENTERLEVEL, -1, -1, -1);
initprintf("E%ldL%ld: %s\n",ud.volume_number+1,ud.level_number+1,level_names[(ud.volume_number*MAXLEVELS)+ud.level_number]); initprintf("E%ldL%ld: %s\n",ud.volume_number+1,ud.level_number+1,map[(ud.volume_number*MAXLEVELS)+ud.level_number].name);
return 0; return 0;
} }

View file

@ -404,10 +404,10 @@ int loadplayer(int spot)
i = music_select; i = music_select;
music_select = (ud.volume_number*MAXLEVELS) + ud.level_number; music_select = (ud.volume_number*MAXLEVELS) + ud.level_number;
if (music_fn[0][(unsigned char)music_select] != NULL && i != music_select) if (map[(unsigned char)music_select].musicfn != NULL && i != music_select)
{ {
MUSIC_StopSong(); MUSIC_StopSong();
playmusic(&music_fn[0][(unsigned char)music_select][0]); playmusic(&map[(unsigned char)music_select].musicfn[0]);
} }
ps[myconnectindex].gm = MODE_GAME; ps[myconnectindex].gm = MODE_GAME;