mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Check to see if the user map filename matches a defined level name and warp to that level instead of opening it as a user map
git-svn-id: https://svn.eduke32.com/eduke32@392 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e11f4c9afb
commit
15ee3431f9
7 changed files with 53 additions and 14 deletions
|
@ -358,4 +358,6 @@ extern void sendquit(void);
|
|||
extern void adduserquote(char *daquote);
|
||||
extern char *strip_color_codes(char *t);
|
||||
|
||||
extern void get_level_from_filename(char *fn, char *volume, char *level);
|
||||
|
||||
#endif // __funct_h__
|
||||
|
|
|
@ -2510,11 +2510,13 @@ void FTA(short q,struct player_struct *p)
|
|||
// if(p->ftq != q || q == 26)
|
||||
// || q == 26 || q == 115 || q ==116 || q == 117 || q == 122)
|
||||
{
|
||||
if (p->ftq != q)
|
||||
if (p == &ps[screenpeek])
|
||||
OSD_Printf("%s\n",strip_color_codes(fta_quotes[q]));
|
||||
|
||||
p->ftq = q;
|
||||
pub = NUMPAGES;
|
||||
pus = NUMPAGES;
|
||||
if (p == &ps[screenpeek])
|
||||
OSD_Printf("%s\n",strip_color_codes(fta_quotes[q]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3457,14 +3459,15 @@ void displayrest(long smoothratio)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ud.pause_on==1 && (ps[myconnectindex].gm&MODE_MENU) == 0)
|
||||
menutext(160,100,0,0,"GAME PAUSED");
|
||||
|
||||
if (ps[myconnectindex].gm&MODE_TYPE)
|
||||
typemode();
|
||||
else
|
||||
menus();
|
||||
|
||||
if (ud.pause_on==1 && (ps[myconnectindex].gm&MODE_MENU) == 0)
|
||||
menutext(160,100,0,0,"GAME PAUSED");
|
||||
|
||||
if (ud.coords)
|
||||
coords(screenpeek);
|
||||
|
||||
|
@ -9591,6 +9594,21 @@ int load_script(char *szScript)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void get_level_from_filename(char *fn, char *volume, char *level)
|
||||
{
|
||||
for ((*volume)=0;(*volume)<MAXVOLUMES;(*volume)++)
|
||||
{
|
||||
for ((*level)=0;(*level)<MAXLEVELS;(*level)++)
|
||||
{
|
||||
if (level_file_names[((*volume)*MAXLEVELS)+(*level)] != NULL)
|
||||
if (!Bstrcasecmp(fn, level_file_names[((*volume)*MAXLEVELS)+(*level)]))
|
||||
break;
|
||||
}
|
||||
if ((*level) != MAXLEVELS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_main(int argc,char **argv)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -9824,6 +9842,7 @@ void app_main(int argc,char **argv)
|
|||
{
|
||||
Bsprintf(ud.user_name[j],"PLAYER %d",j+1);
|
||||
ps[j].team = ud.pteam[j] = i;
|
||||
ps[j].weaponswitch = 3;
|
||||
i = 1-i;
|
||||
}
|
||||
|
||||
|
@ -9949,10 +9968,9 @@ MAIN_LOOP_RESTART:
|
|||
{
|
||||
if (ud.multimode > 1 && boardfilename[0] != 0)
|
||||
{
|
||||
ud.level_number = ud.m_level_number = 7;
|
||||
ud.volume_number = ud.m_volume_number;
|
||||
ud.player_skill = ud.m_player_skill;
|
||||
|
||||
ud.m_level_number = 7;
|
||||
ud.m_volume_number = 0;
|
||||
|
||||
if (ud.m_player_skill == 4)
|
||||
ud.m_respawn_monsters = 1;
|
||||
else ud.m_respawn_monsters = 0;
|
||||
|
|
|
@ -4022,6 +4022,9 @@ SKIPJIBS:
|
|||
}
|
||||
else g_sp->zvel = 0;
|
||||
}
|
||||
|
||||
if (g_sp->z > (hittype[g_i].floorz-FOURSLEIGHT))
|
||||
g_sp->z = (hittype[g_i].floorz - FOURSLEIGHT);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -180,3 +180,5 @@ proj_struct projectile[MAXTILES], thisprojectile[MAXSPRITES], defaultprojectile[
|
|||
|
||||
char cheatkey[2] = { sc_D, sc_N };
|
||||
char setupfilename[BMAX_PATH]= "duke3d.cfg";
|
||||
|
||||
void get_level_from_filename(char *fn, char *volume, char *level);
|
||||
|
|
|
@ -2003,8 +2003,10 @@ cheat_for_port_credits:
|
|||
break;
|
||||
|
||||
case 101:
|
||||
if (boardfilename[0] == 0) strcpy(boardfilename, "./");
|
||||
Bcorrectfilename(boardfilename,1);
|
||||
// everything seems to work fine without this...
|
||||
|
||||
// if (boardfilename[0] == 0) strcpy(boardfilename, "./");
|
||||
// Bcorrectfilename(boardfilename,1);
|
||||
getfilenames(boardfilename,"*.map");
|
||||
cmenu(102);
|
||||
KB_FlushKeyboardQueue();
|
||||
|
|
|
@ -163,7 +163,6 @@ int osdcmd_map(const osdfuncparm_t *parm)
|
|||
{
|
||||
// out-of-game behave like a menu command
|
||||
osdcmd_cheatsinfo_stat.cheatnum = -1;
|
||||
|
||||
ud.m_volume_number = 0;
|
||||
ud.m_level_number = 7;
|
||||
|
||||
|
@ -811,9 +810,7 @@ int registerosdcommands(void)
|
|||
}
|
||||
|
||||
if (VOLUMEONE)
|
||||
{
|
||||
OSD_RegisterFunction("changelevel","changelevel <level>: warps to the given level", osdcmd_changelevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
OSD_RegisterFunction("changelevel","changelevel <volume> <level>: warps to the given level", osdcmd_changelevel);
|
||||
|
|
|
@ -1613,6 +1613,20 @@ int enterlevel(char g)
|
|||
clearsoundlocks();
|
||||
FX_SetReverb(0);
|
||||
|
||||
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
|
||||
{
|
||||
char volume, level;
|
||||
|
||||
get_level_from_filename(boardfilename,&volume,&level);
|
||||
|
||||
if (level != MAXLEVELS)
|
||||
{
|
||||
ud.level_number = ud.m_level_number = level;
|
||||
ud.volume_number = ud.m_volume_number = volume;
|
||||
boardfilename[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (level_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL || level_file_names[(ud.volume_number*MAXLEVELS)+ud.level_number] == NULL)
|
||||
{
|
||||
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
|
||||
|
@ -1829,5 +1843,6 @@ int enterlevel(char g)
|
|||
// variables are set by pointer...
|
||||
|
||||
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]);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue