mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-10 15:21:44 +00:00
New uiScript "replace weapons/items/ammo" (experimental).
This commit is contained in:
parent
c02e381f75
commit
b50af1df78
1 changed files with 50 additions and 24 deletions
|
@ -4923,26 +4923,17 @@ static qboolean UI_SelectedPlayer_HandleKey(int flags, float *special, int key)
|
|||
return qfalse;
|
||||
}
|
||||
|
||||
//Makro - replacement type
|
||||
static qboolean UI_ReplacementType_HandleKey(int flags, float *special, int key)
|
||||
static void UI_SelectReplacementType(int index)
|
||||
{
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW
|
||||
|| key == K_RIGHTARROW) {
|
||||
int index = uiInfo.replacements.TypeIndex;
|
||||
|
||||
if (key == K_MOUSE2 || key == K_LEFTARROW) {
|
||||
index--;
|
||||
} else {
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index >= replacementTypeCount) {
|
||||
index = 0;
|
||||
} else if (index < 0) {
|
||||
index = replacementTypeCount - 1;
|
||||
}
|
||||
|
||||
uiInfo.replacements.TypeIndex = index;
|
||||
uiInfo.replacements.SubtypeIndex = 0;
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
|
@ -4961,6 +4952,24 @@ static qboolean UI_ReplacementType_HandleKey(int flags, float *special, int key)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Makro - replacement type
|
||||
static qboolean UI_ReplacementType_HandleKey(int flags, float *special, int key)
|
||||
{
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW
|
||||
|| key == K_RIGHTARROW) {
|
||||
int index = uiInfo.replacements.TypeIndex;
|
||||
|
||||
if (key == K_MOUSE2 || key == K_LEFTARROW) {
|
||||
index--;
|
||||
} else {
|
||||
index++;
|
||||
}
|
||||
|
||||
UI_SelectReplacementType(index);
|
||||
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
@ -5683,6 +5692,9 @@ static void UI_Update(const char *name)
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: Makro - this is a monster of a function
|
||||
// Not exactly efficient with all this strcmp's in it, either...
|
||||
|
||||
static void UI_RunMenuScript(char **args)
|
||||
{
|
||||
const char *name, *name2;
|
||||
|
@ -6380,6 +6392,20 @@ static void UI_RunMenuScript(char **args)
|
|||
//Makro - select replacement
|
||||
} else if (Q_stricmp(name, "selectReplacement") == 0) {
|
||||
UI_SelectReplacement();
|
||||
// Makro - select replacement type (weapons/items/ammo)
|
||||
} else if (Q_stricmp(name, "replace") == 0) {
|
||||
if (String_Parse(args, &name2))
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<replacementTypeCount; ++i)
|
||||
{
|
||||
if (Q_stricmp(name2, replacementTypes[i].displayName) == 0)
|
||||
{
|
||||
UI_SelectReplacementType(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Q_stricmp(name, "update") == 0) {
|
||||
if (String_Parse(args, &name2)) {
|
||||
UI_Update(name2);
|
||||
|
|
Loading…
Reference in a new issue