mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
add a builtin (gametype) for detecting the, well, game type (ie, netquake
or quakeworld) which just returns the apprproate string. the single player menu is now acessable in nq but not qw :)
This commit is contained in:
parent
db7a2264c0
commit
14ac3acc17
6 changed files with 35 additions and 6 deletions
|
@ -15,6 +15,7 @@ void (integer x, integer y, string name) Draw_Pic = #0;
|
|||
void (integer x, integer y, string text) Draw_String = #0;
|
||||
|
||||
float () random = #0;
|
||||
string () gametype = #0;
|
||||
|
||||
float time;
|
||||
entity self;
|
||||
|
@ -22,6 +23,8 @@ entity self;
|
|||
.float frame;
|
||||
.void () think;
|
||||
|
||||
integer do_single_player;
|
||||
|
||||
string [6] dot = {
|
||||
"gfx/menudot1.lmp",
|
||||
"gfx/menudot2.lmp",
|
||||
|
@ -156,22 +159,22 @@ void () quit_draw =
|
|||
|
||||
void () single_player_menu =
|
||||
{
|
||||
Menu_Item (54, 32, "", NIL);
|
||||
Menu_Item (54, 32, "", quit_f);
|
||||
};
|
||||
|
||||
void () multi_player_menu =
|
||||
{
|
||||
Menu_Item (54, 52, "", NIL);
|
||||
Menu_Item (54, 52, "", quit_f);
|
||||
};
|
||||
|
||||
void () options_menu =
|
||||
{
|
||||
Menu_Item (54, 72, "", NIL);
|
||||
Menu_Item (54, 72, "", quit_f);
|
||||
};
|
||||
|
||||
void () help_menu =
|
||||
{
|
||||
Menu_Item (54, 92, "", NIL);
|
||||
Menu_Item (54, 92, "", quit_f);
|
||||
};
|
||||
|
||||
void () main_menu =
|
||||
|
@ -181,8 +184,8 @@ void () main_menu =
|
|||
Menu_CenterPic (160, 4, "gfx/ttl_main.lmp");
|
||||
Menu_Pic (71,32, "gfx/mainmenu.lmp");
|
||||
Menu_Cursor (spinner);
|
||||
//if (do_single_player)
|
||||
// single_player_menu ();
|
||||
if (do_single_player)
|
||||
single_player_menu ();
|
||||
multi_player_menu ();
|
||||
options_menu ();
|
||||
help_menu ();
|
||||
|
@ -200,6 +203,16 @@ void () quit_menu =
|
|||
|
||||
void () menu_init =
|
||||
{
|
||||
switch (gametype ()) {
|
||||
case "netquake":
|
||||
do_single_player = 1;
|
||||
break;
|
||||
case "quakeworld":
|
||||
do_single_player = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
main_menu ();
|
||||
quit_menu ();
|
||||
Menu_TopMenu ("main");
|
||||
|
|
|
@ -199,6 +199,8 @@ extern struct cvar_s *pr_debug;
|
|||
extern struct cvar_s *pr_deadbeef_locals;
|
||||
extern struct cvar_s *pr_boundscheck;
|
||||
|
||||
extern const char *pr_gametype;
|
||||
|
||||
//
|
||||
// PR Cmds stuff
|
||||
//
|
||||
|
|
|
@ -58,6 +58,8 @@ static const char rcsid[] =
|
|||
#define RETURN_STRING(p, s) ((p)->pr_globals[OFS_RETURN].integer_var = PR_SetString((p), s))
|
||||
#define RETURN_VECTOR(p, v) (VectorCopy (v, G_VECTOR (p, OFS_RETURN)))
|
||||
|
||||
const char *pr_gametype = "";
|
||||
|
||||
/* BUILT-IN FUNCTIONS */
|
||||
|
||||
// FIXME: Hunk_TempAlloc, Sys_Printf, Cvar_*, PR_SetString, PR_RunError, ED_PrintEdicts, PF_traceon, PF_traceoff, ED_PrintNum, PR_FindBuiltin isn't threadsafe/reentrant
|
||||
|
@ -832,6 +834,12 @@ PF_sprintf (progs_t *pr)
|
|||
PR_Error (pr, "PF_sprintf: argument limit exceeded\n");
|
||||
}
|
||||
|
||||
void
|
||||
PR_gametype (progs_t *pr)
|
||||
{
|
||||
RETURN_STRING (pr, pr_gametype);
|
||||
}
|
||||
|
||||
void
|
||||
PR_Cmds_Init (progs_t *pr)
|
||||
{
|
||||
|
@ -870,4 +878,5 @@ PR_Cmds_Init (progs_t *pr)
|
|||
PR_AddBuiltin (pr, "stoi", PF_stoi, 113); // integer (string s) stoi
|
||||
PR_AddBuiltin (pr, "stov", PF_stov, 114); // vector (string s) stov
|
||||
PR_AddBuiltin (pr, "vtos", PF_vtos, 27); // string (vector v) vtos
|
||||
PR_AddBuiltin (pr, "gametype", PR_gametype, 115); // string () gametype
|
||||
};
|
||||
|
|
|
@ -914,6 +914,8 @@ Host_Init (quakeparms_t *parms)
|
|||
|
||||
Memory_Init (parms->membase, parms->memsize);
|
||||
|
||||
pr_gametype = "netquake";
|
||||
|
||||
PI_Init ();
|
||||
|
||||
Chase_Init_Cvars ();
|
||||
|
|
|
@ -1652,6 +1652,8 @@ Host_Init (void)
|
|||
|
||||
PI_Init ();
|
||||
|
||||
pr_gametype = "quakeworld";
|
||||
|
||||
CL_Cam_Init_Cvars ();
|
||||
CL_Input_Init_Cvars ();
|
||||
CL_Skin_Init_Cvars ();
|
||||
|
|
|
@ -348,6 +348,7 @@ SV_LoadProgs (void)
|
|||
void
|
||||
SV_Progs_Init (void)
|
||||
{
|
||||
pr_gametype = "quakeworld";
|
||||
sv_pr_state.edicts = &sv.edicts;
|
||||
sv_pr_state.num_edicts = &sv.num_edicts;
|
||||
sv_pr_state.time = &sv.time;
|
||||
|
|
Loading…
Reference in a new issue