mirror of
https://github.com/libretro/libretro-tyrquake.git
synced 2024-11-23 16:10:09 +00:00
draw: add argument completion for gl_texturemode command
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
d4bf311515
commit
f569b16c0e
@ -58,10 +58,6 @@ static sv_protocol_t sv_protocols[] = {
|
||||
|
||||
static int sv_protocol = PROTOCOL_VERSION_NQ;
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
static void
|
||||
SV_Protocol_f(void)
|
||||
{
|
||||
|
@ -360,12 +360,12 @@ typedef struct {
|
||||
} glmode_t;
|
||||
|
||||
static glmode_t gl_texturemodes[] = {
|
||||
{"GL_NEAREST", GL_NEAREST, GL_NEAREST},
|
||||
{"GL_LINEAR", GL_LINEAR, GL_LINEAR},
|
||||
{"GL_NEAREST_MIPMAP_NEAREST", GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST},
|
||||
{"GL_LINEAR_MIPMAP_NEAREST", GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR},
|
||||
{"GL_NEAREST_MIPMAP_LINEAR", GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST},
|
||||
{"GL_LINEAR_MIPMAP_LINEAR", GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR}
|
||||
{ "GL_NEAREST", GL_NEAREST, GL_NEAREST },
|
||||
{ "GL_LINEAR", GL_LINEAR, GL_LINEAR },
|
||||
{ "GL_NEAREST_MIPMAP_NEAREST", GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST },
|
||||
{ "GL_LINEAR_MIPMAP_NEAREST", GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR },
|
||||
{ "GL_NEAREST_MIPMAP_LINEAR", GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST },
|
||||
{ "GL_LINEAR_MIPMAP_LINEAR", GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR }
|
||||
};
|
||||
|
||||
/*
|
||||
@ -413,6 +413,25 @@ Draw_TextureMode_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
static struct stree_root *
|
||||
Draw_TextureMode_Arg_f(const char *arg)
|
||||
{
|
||||
int i, arg_len;
|
||||
struct stree_root *root;
|
||||
|
||||
root = Z_Malloc(sizeof(struct stree_root));
|
||||
if (root) {
|
||||
*root = STREE_ROOT;
|
||||
STree_AllocInit();
|
||||
arg_len = arg ? strlen(arg) : 0;
|
||||
for (i = 0; i < ARRAY_SIZE(gl_texturemodes); i++) {
|
||||
if (!arg || !strncasecmp(gl_texturemodes[i].name, arg, arg_len))
|
||||
STree_InsertAlloc(root, gl_texturemodes[i].name, false);
|
||||
}
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Draw_Init
|
||||
@ -441,7 +460,8 @@ Draw_Init(void)
|
||||
Cvar_Set("gl_max_size", va("%i", i));
|
||||
}
|
||||
|
||||
Cmd_AddCommand("gl_texturemode", &Draw_TextureMode_f);
|
||||
Cmd_AddCommand("gl_texturemode", Draw_TextureMode_f);
|
||||
Cmd_SetCompletion("gl_texturemode", Draw_TextureMode_Arg_f);
|
||||
|
||||
// load the console background and the charset
|
||||
// by hand, because we need to write the version
|
||||
|
@ -33,6 +33,10 @@ typedef enum { false, true } qboolean;
|
||||
#define offsetof(type, member) __builtin_offsetof (type, member)
|
||||
#endif
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* container_of - cast a member of a structure out to the containing structure
|
||||
* @ptr: the pointer to the member.
|
||||
|
Loading…
Reference in New Issue
Block a user