small bug fix, part way through adding plugin stuff for menu support.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@247 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
0fc540cac4
commit
f25bf204a9
8 changed files with 123 additions and 26 deletions
|
@ -2252,19 +2252,40 @@ void CL_NewTranslation (int slot)
|
|||
if (player->skin && !stricmp(s, player->skin->name))
|
||||
player->skin = NULL;
|
||||
|
||||
if (player->_topcolor != player->topcolor ||
|
||||
player->_bottomcolor != player->bottomcolor || !player->skin) {
|
||||
player->_topcolor = player->topcolor;
|
||||
player->_bottomcolor = player->bottomcolor;
|
||||
top = player->topcolor;
|
||||
bottom = player->bottomcolor;
|
||||
if (!cl.splitclients && !(cl.fpd & FPD_NO_FORCE_COLOR)) //no colour/skin forcing in splitscreen.
|
||||
{
|
||||
if (cl.teamplay && !strcmp(player->team, cl.players[cl.playernum[0]].team))
|
||||
{
|
||||
if (cl_teamtopcolor>=0)
|
||||
top = cl_teamtopcolor;
|
||||
if (cl_teambottomcolor>=0)
|
||||
bottom = cl_teambottomcolor;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cl_enemytopcolor>=0)
|
||||
top = cl_enemytopcolor;
|
||||
if (cl_enemybottomcolor>=0)
|
||||
bottom = cl_enemybottomcolor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (player->_topcolor != top ||
|
||||
player->_bottomcolor != bottom || !player->skin) {
|
||||
player->_topcolor = top;
|
||||
player->_bottomcolor = bottom;
|
||||
|
||||
dest = player->translations;
|
||||
source = vid.colormap;
|
||||
memcpy (dest, vid.colormap, sizeof(player->translations));
|
||||
top = player->topcolor;
|
||||
// top = player->topcolor;
|
||||
if (top > 13 || top < 0)
|
||||
top = 13;
|
||||
top *= 16;
|
||||
bottom = player->bottomcolor;
|
||||
// bottom = player->bottomcolor;
|
||||
if (bottom > 13 || bottom < 0)
|
||||
bottom = 13;
|
||||
bottom *= 16;
|
||||
|
|
|
@ -365,6 +365,7 @@ typedef struct {
|
|||
//
|
||||
typedef struct
|
||||
{
|
||||
int fpd;
|
||||
int servercount; // server identification for prespawns
|
||||
|
||||
char serverinfo[MAX_SERVERINFO_STRING];
|
||||
|
@ -502,6 +503,15 @@ typedef struct
|
|||
int deathmatch;
|
||||
} client_state_t;
|
||||
|
||||
extern int cl_teamtopcolor;
|
||||
extern int cl_teambottomcolor;
|
||||
extern int cl_enemytopcolor;
|
||||
extern int cl_enemybottomcolor;
|
||||
|
||||
//FPD values
|
||||
//(commented out ones are ones that we don't support)
|
||||
#define FPD_NO_FORCE_COLOR 512
|
||||
|
||||
|
||||
//
|
||||
// cvars
|
||||
|
|
|
@ -909,6 +909,10 @@ void M_Draw (int uimenu)
|
|||
case m_complex:
|
||||
M_Complex_Draw ();
|
||||
break;
|
||||
|
||||
case m_plugin:
|
||||
Plug_Menu_Event (0, (int)(realtime*1000));
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_entersound)
|
||||
|
@ -954,6 +958,10 @@ void M_Keydown (int key)
|
|||
case m_complex:
|
||||
M_Complex_Key (key);
|
||||
return;
|
||||
|
||||
case m_plugin:
|
||||
Plug_Menu_Event (1, key);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -965,6 +973,9 @@ void M_Keyup (int key)
|
|||
case m_xwindows:
|
||||
XWindows_Keyup(key);
|
||||
return;
|
||||
case m_plugin:
|
||||
Plug_Menu_Event (2, key);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ void XWindows_Init(void);
|
|||
|
||||
|
||||
|
||||
typedef enum {m_none, m_complex, m_help, m_keys, m_slist, m_media, m_xwindows} m_state_t;
|
||||
typedef enum {m_none, m_complex, m_help, m_keys, m_slist, m_media, m_xwindows, m_plugin} m_state_t;
|
||||
extern m_state_t m_state;
|
||||
|
||||
typedef enum {mt_childwindow, mt_button, mt_buttonbigfont, mt_box, mt_colouredbox, mt_line, mt_edit, mt_text, mt_slider, mt_combo, mt_bind, mt_checkbox, mt_picture, mt_menudot, mt_custom} menutype_t;
|
||||
|
|
|
@ -824,14 +824,14 @@ void R_InitParticles (void)
|
|||
pt_gunshot = AllocateParticleType("te_gunshot");
|
||||
pt_lavasplash = AllocateParticleType("te_lavasplash");
|
||||
pt_teleportsplash = AllocateParticleType("te_teleportsplash");
|
||||
rt_blastertrail = AllocateParticleType("te_blastertrail");
|
||||
rt_blastertrail = AllocateParticleType("t_blastertrail");
|
||||
pt_blasterparticles = AllocateParticleType("te_blasterparticles");
|
||||
pt_wizspike = AllocateParticleType("te_wizspike");
|
||||
pt_knightspike = AllocateParticleType("te_knightspike");
|
||||
pt_spike = AllocateParticleType("te_spike");
|
||||
pt_superspike = AllocateParticleType("te_superspike");
|
||||
rt_railtrail = AllocateParticleType("te_railtrail");
|
||||
rt_bubbletrail = AllocateParticleType("te_bubbletrail");
|
||||
rt_railtrail = AllocateParticleType("t_railtrail");
|
||||
rt_bubbletrail = AllocateParticleType("t_bubbletrail");
|
||||
rt_rocket = AllocateParticleType("t_rocket");
|
||||
|
||||
pt_superbullet = AllocateParticleType("te_superbullet");
|
||||
|
|
|
@ -1312,9 +1312,9 @@ char *TP_MapName (void)
|
|||
*/
|
||||
|
||||
int cl_teamtopcolor = -1;
|
||||
int cl_teambottomcolor;
|
||||
int cl_teambottomcolor = -1;
|
||||
int cl_enemytopcolor = -1;
|
||||
int cl_enemybottomcolor;
|
||||
int cl_enemybottomcolor = -1;
|
||||
|
||||
void TP_TeamColor_f (void)
|
||||
{
|
||||
|
@ -1335,8 +1335,10 @@ void TP_TeamColor_f (void)
|
|||
if (!strcmp(Cmd_Argv(1), "off"))
|
||||
{
|
||||
cl_teamtopcolor = -1;
|
||||
for (i = 0; i < MAX_CLIENTS; i++)
|
||||
CL_NewTranslation(i);
|
||||
cl_teambottomcolor = -1;
|
||||
if (qrenderer) //make sure we have the renderer initialised...
|
||||
for (i = 0; i < MAX_CLIENTS; i++)
|
||||
CL_NewTranslation(i);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1359,8 +1361,9 @@ void TP_TeamColor_f (void)
|
|||
cl_teamtopcolor = top;
|
||||
cl_teambottomcolor = bottom;
|
||||
|
||||
for (i = 0; i < MAX_CLIENTS; i++)
|
||||
CL_NewTranslation(i);
|
||||
if (qrenderer) //make sure we have the renderer initialised...
|
||||
for (i = 0; i < MAX_CLIENTS; i++)
|
||||
CL_NewTranslation(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1383,8 +1386,10 @@ void TP_EnemyColor_f (void)
|
|||
if (!strcmp(Cmd_Argv(1), "off"))
|
||||
{
|
||||
cl_enemytopcolor = -1;
|
||||
for (i = 0; i < MAX_CLIENTS; i++)
|
||||
CL_NewTranslation(i);
|
||||
cl_enemybottomcolor = -1;
|
||||
if (qrenderer) //make sure we have the renderer initialised...
|
||||
for (i = 0; i < MAX_CLIENTS; i++)
|
||||
CL_NewTranslation(i);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1407,8 +1412,9 @@ void TP_EnemyColor_f (void)
|
|||
cl_enemytopcolor = top;
|
||||
cl_enemybottomcolor = bottom;
|
||||
|
||||
for (i = 0; i < MAX_CLIENTS; i++)
|
||||
CL_NewTranslation(i);
|
||||
if (qrenderer) //make sure we have the renderer initialised...
|
||||
for (i = 0; i < MAX_CLIENTS; i++)
|
||||
CL_NewTranslation(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ typedef struct plugin_s {
|
|||
vm_t *vm;
|
||||
int tick;
|
||||
int executestring;
|
||||
int menufunction;
|
||||
|
||||
struct plugin_s *next;
|
||||
} plugin_t;
|
||||
|
@ -31,6 +32,7 @@ void Plug_Shutdown(void);
|
|||
|
||||
|
||||
static plugin_t *plugs;
|
||||
static plugin_t *menuplug; //plugin that has the current menu
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
@ -89,7 +91,7 @@ int Plug_FindBuiltin(void *offset, unsigned int mask, const long *args)
|
|||
int i;
|
||||
for (i = 0; i < numplugbuiltins; i++)
|
||||
if (plugbuiltins[i].name)
|
||||
if (!strcmp(plugbuiltins[i].name, (char *)offset+args[0]))
|
||||
if (!strcmp(plugbuiltins[i].name, (char *)VM_POINTER(args[0])))
|
||||
return -i;
|
||||
|
||||
return 0;
|
||||
|
@ -190,7 +192,7 @@ int Plug_Emumerated (char *name, int size, void *param)
|
|||
|
||||
int Plug_Con_Print(void *offset, unsigned int mask, const long *arg)
|
||||
{
|
||||
Con_Print((char*)offset+arg[0]);
|
||||
Con_Print((char*)VM_POINTER(arg[0]));
|
||||
return 0;
|
||||
}
|
||||
int Plug_Sys_Error(void *offset, unsigned int mask, const long *arg)
|
||||
|
@ -200,11 +202,13 @@ int Plug_Sys_Error(void *offset, unsigned int mask, const long *arg)
|
|||
}
|
||||
int Plug_ExportToEngine(void *offset, unsigned int mask, const long *arg)
|
||||
{
|
||||
char *name = (char*)offset+arg[0];
|
||||
char *name = (char*)VM_POINTER(arg[0]);
|
||||
if (!strcmp(name, "Tick"))
|
||||
currentplug->tick = arg[1];
|
||||
else if (!strcmp(name, "ExecuteCommand"))
|
||||
currentplug->executestring = arg[1];
|
||||
else if (!strcmp(name, "MenuEvent"))
|
||||
currentplug->menufunction = arg[1];
|
||||
else
|
||||
return 0;
|
||||
return 1;
|
||||
|
@ -212,7 +216,7 @@ int Plug_ExportToEngine(void *offset, unsigned int mask, const long *arg)
|
|||
//void(char *buffer, int buffersize)
|
||||
int Plug_Cmd_Args(void *offset, unsigned int mask, const long *arg)
|
||||
{
|
||||
char *buffer = (char*)offset+arg[0];
|
||||
char *buffer = (char*)VM_POINTER(arg[0]);
|
||||
char *args;
|
||||
args = Cmd_Args();
|
||||
if (strlen(args)+1>arg[1])
|
||||
|
@ -223,7 +227,7 @@ int Plug_Cmd_Args(void *offset, unsigned int mask, const long *arg)
|
|||
//void(int num, char *buffer, int buffersize)
|
||||
int Plug_Cmd_Argv(void *offset, unsigned int mask, const long *arg)
|
||||
{
|
||||
char *buffer = (char*)offset+arg[1];
|
||||
char *buffer = (char*)VM_POINTER(arg[1]);
|
||||
char *args;
|
||||
args = Cmd_Argv(arg[0]);
|
||||
if (strlen(args)+1>arg[2])
|
||||
|
@ -236,6 +240,24 @@ int Plug_Cmd_Argc(void *offset, unsigned int mask, const long *arg)
|
|||
{
|
||||
return Cmd_Argc();
|
||||
}
|
||||
|
||||
int Plug_Menu_Control(void *offset, unsigned int mask, const long *arg)
|
||||
{
|
||||
switch(VM_LONG(arg[0]))
|
||||
{
|
||||
case 0: //weather it's us or not.
|
||||
return currentplug == menuplug && m_state == m_plugin;
|
||||
case 1: //weather a menu is active
|
||||
return key_dest == key_menu;
|
||||
case 2: //give us menu control
|
||||
menuplug = currentplug;
|
||||
key_dest = key_menu;
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Plug_Init(void)
|
||||
{
|
||||
Plug_RegisterBuiltin("Plug_GetEngineFunction", Plug_FindBuiltin, 0);//plugin wishes to find a builtin number.
|
||||
|
@ -248,7 +270,7 @@ void Plug_Init(void)
|
|||
Plug_RegisterBuiltin("Cmd_Argc", Plug_Cmd_Argc, 0);
|
||||
Plug_RegisterBuiltin("Cmd_Argv", Plug_Cmd_Argv, 0);
|
||||
|
||||
|
||||
Plug_RegisterBuiltin("Menu_Control", Plug_Menu_Control, 0);
|
||||
|
||||
#ifdef _WIN32
|
||||
COM_EnumerateFiles("plugins/*x86.dll", Plug_Emumerated, "x86.dll");
|
||||
|
@ -289,6 +311,14 @@ qboolean Plugin_ExecuteString(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
qboolean Plug_Menu_Event(int eventtype, int param) //eventtype = draw/keydown/keyup, param = time/key
|
||||
{
|
||||
if (!menuplug)
|
||||
return false;
|
||||
|
||||
return VM_Call(menuplug->vm, menuplug->menufunction, eventtype, param);
|
||||
}
|
||||
|
||||
void Plug_Close(plugin_t *plug)
|
||||
{
|
||||
if (plugs == plug)
|
||||
|
|
|
@ -441,6 +441,25 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, entity_
|
|||
Skin_Find(e->scoreboard);
|
||||
tc = e->scoreboard->topcolor;
|
||||
bc = e->scoreboard->bottomcolor;
|
||||
|
||||
//colour forcing
|
||||
if (!cl.splitclients && !(cl.fpd & FPD_NO_FORCE_COLOR)) //no colour/skin forcing in splitscreen.
|
||||
{
|
||||
if (cl.teamplay && !strcmp(e->scoreboard->team, cl.players[cl.playernum[0]].team))
|
||||
{
|
||||
if (cl_teamtopcolor>=0)
|
||||
tc = cl_teamtopcolor;
|
||||
if (cl_teambottomcolor>=0)
|
||||
bc = cl_teambottomcolor;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cl_enemytopcolor>=0)
|
||||
tc = cl_enemytopcolor;
|
||||
if (cl_enemybottomcolor>=0)
|
||||
bc = cl_enemybottomcolor;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue