menu.dat support.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@516 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-11-23 01:10:10 +00:00
parent 1a4aa4ae5e
commit 84b4af51ae
12 changed files with 168 additions and 46 deletions

View file

@ -592,7 +592,7 @@ entity_state_t *CL_FindOldPacketEntity(int num)
return NULL; return NULL;
} }
void CLNQ_ParseEntity(int bits) void CLNQ_ParseEntity(unsigned int bits)
{ {
int i; int i;
int num, pnum; int num, pnum;
@ -600,6 +600,7 @@ void CLNQ_ParseEntity(int bits)
entity_state_t *base; entity_state_t *base;
static float lasttime; static float lasttime;
packet_entities_t *pack; packet_entities_t *pack;
cl.validsequence=1; cl.validsequence=1;
#define NQU_MOREBITS (1<<0) #define NQU_MOREBITS (1<<0)
#define NQU_ORIGIN1 (1<<1) #define NQU_ORIGIN1 (1<<1)
@ -619,6 +620,30 @@ void CLNQ_ParseEntity(int bits)
#define NQU_EFFECTS (1<<13) #define NQU_EFFECTS (1<<13)
#define NQU_LONGENTITY (1<<14) #define NQU_LONGENTITY (1<<14)
// LordHavoc's: protocol extension
#define DPU_EXTEND1 (1<<15)
// LordHavoc: first extend byte
#define DPU_DELTA (1<<16) // no data, while this is set the entity is delta compressed (uses previous frame as a baseline, meaning only things that have changed from the previous frame are sent, except for the forced full update every half second)
#define DPU_ALPHA (1<<17) // 1 byte, 0.0-1.0 maps to 0-255, not sent if exactly 1, and the entity is not sent if <=0 unless it has effects (model effects are checked as well)
#define DPU_SCALE (1<<18) // 1 byte, scale / 16 positive, not sent if 1.0
#define DPU_EFFECTS2 (1<<19) // 1 byte, this is .effects & 0xFF00 (second byte)
#define DPU_GLOWSIZE (1<<20) // 1 byte, encoding is float/4.0, unsigned, not sent if 0
#define DPU_GLOWCOLOR (1<<21) // 1 byte, palette index, default is 254 (white), this IS used for darklight (allowing colored darklight), however the particles from a darklight are always black, not sent if default value (even if glowsize or glowtrail is set)
// LordHavoc: colormod feature has been removed, because no one used it
#define DPU_COLORMOD (1<<22) // 1 byte, 3 bit red, 3 bit green, 2 bit blue, this lets you tint an object artifically, so you could make a red rocket, or a blue fiend...
#define DPU_EXTEND2 (1<<23) // another byte to follow
// LordHavoc: second extend byte
#define DPU_GLOWTRAIL (1<<24) // leaves a trail of particles (of color .glowcolor, or black if it is a negative glowsize)
#define DPU_VIEWMODEL (1<<25) // attachs the model to the view (origin and angles become relative to it), only shown to owner, a more powerful alternative to .weaponmodel and such
#define DPU_FRAME2 (1<<26) // 1 byte, this is .frame & 0xFF00 (second byte)
#define DPU_MODEL2 (1<<27) // 1 byte, this is .modelindex & 0xFF00 (second byte)
#define DPU_EXTERIORMODEL (1<<28) // causes this model to not be drawn when using a first person view (third person will draw it, first person will not)
#define DPU_UNUSED29 (1<<29) // future expansion
#define DPU_UNUSED30 (1<<30) // future expansion
#define DPU_EXTEND3 (1<<31) // another byte to follow, future expansion
if (cls.signon == 4 - 1) if (cls.signon == 4 - 1)
{ // first update is the final signon stage { // first update is the final signon stage
cls.signon = 4; cls.signon = 4;
@ -632,6 +657,16 @@ void CLNQ_ParseEntity(int bits)
i = MSG_ReadByte (); i = MSG_ReadByte ();
bits |= (i<<8); bits |= (i<<8);
} }
if (bits & DPU_EXTEND1)
{
i = MSG_ReadByte ();
bits |= (i<<16);
}
if (bits & DPU_EXTEND2)
{
i = MSG_ReadByte ();
bits |= (i<<24);
}
if (bits & NQU_LONGENTITY) if (bits & NQU_LONGENTITY)
num = MSG_ReadShort (); num = MSG_ReadShort ();
@ -787,10 +822,12 @@ void CL_RotateAroundTag(entity_t *ent, int num, int tagent)
float *org=NULL, *ang=NULL; float *org=NULL, *ang=NULL;
vec3_t axis[3]; vec3_t axis[3];
vec3_t temp[3]; vec3_t temp[3];
int model;
int frame;
float *tagorg=NULL, *tagaxis; int model = 0; //these two are only initialised because msvc sucks at detecting usage.
int frame = 0;
float *tagorg=NULL;
float *tagaxis;
ps = CL_FindPacketEntity(tagent); ps = CL_FindPacketEntity(tagent);
if (ps) if (ps)
@ -825,10 +862,13 @@ void CL_RotateAroundTag(entity_t *ent, int num, int tagent)
AngleVectors(ang, axis[0], axis[1], axis[2]); AngleVectors(ang, axis[0], axis[1], axis[2]);
VectorInverse(axis[1]); VectorInverse(axis[1]);
Mod_GetTag(cl.model_precache[model], cl.lerpents[tagent].tagindex, frame, &tagorg, &tagaxis); if (Mod_GetTag)
Mod_GetTag(cl.model_precache[model], cl.lerpents[tagent].tagindex, frame, &tagorg, &tagaxis);
else
tagaxis = NULL;
if (tagaxis) if (tagaxis)
{ {
Matrix3_Multiply(ent->axis, tagaxis, temp); Matrix3_Multiply(ent->axis, (void*)tagaxis, temp);
} }
else //hrm. else //hrm.
memcpy(temp, ent->axis, sizeof(temp)); memcpy(temp, ent->axis, sizeof(temp));
@ -894,7 +934,7 @@ void CL_LinkPacketEntities (void)
{ {
if (s1->number == cl.viewentity[spnum]) if (s1->number == cl.viewentity[spnum])
{ {
float a1, a2; // float a1, a2;
cl.simvel[spnum][0] = 0; cl.simvel[spnum][0] = 0;
cl.simvel[spnum][1] = 0; cl.simvel[spnum][1] = 0;
cl.simvel[spnum][2] = 0; cl.simvel[spnum][2] = 0;

View file

@ -1521,7 +1521,7 @@ void CL_ConnectionlessPacket (void)
char *s2; char *s2;
for (s2 = s; *s; s++) for (s2 = s; *s; s++)
{ {
if (*s < '0' || *s > '9') if ((*s < '0' || *s > '9') && *s != '-')
break; break;
} }
if (*s) if (*s)
@ -2611,6 +2611,10 @@ void Host_Init (quakeparms_t *parms)
extern cvar_t vid_renderer; extern cvar_t vid_renderer;
COM_InitArgv (parms->argc, parms->argv); COM_InitArgv (parms->argc, parms->argv);
if (setjmp (host_abort) )
Sys_Error("Host_Init: An error occured. Try the -condebug commandline parameter\n");
Sys_mkdir("qw"); Sys_mkdir("qw");
if (COM_CheckParm ("-minmemory")) if (COM_CheckParm ("-minmemory"))
@ -2691,7 +2695,7 @@ void Host_Init (quakeparms_t *parms)
Hunk_AllocName (0, "-HOST_HUNKLEVEL-"); Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
host_hunklevel = Hunk_LowMark (); host_hunklevel = Hunk_LowMark ();
R_SetRenderer(QR_NONE);//set the mod stuff... R_SetRenderer(0);//set the renderer stuff to 'none'...
host_initialized = true; host_initialized = true;

View file

@ -85,6 +85,7 @@ extern cvar_t scr_chatmodecvar;
int mouseusedforgui; int mouseusedforgui;
int mousecursor_x, mousecursor_y; int mousecursor_x, mousecursor_y;
int mousemove_x, mousemove_y;
// only the refresh window will be updated unless these variables are flagged // only the refresh window will be updated unless these variables are flagged
int scr_copytop; int scr_copytop;

View file

@ -630,6 +630,7 @@ void CL_BaseMove (usercmd_t *cmd, int pnum);
float CL_KeyState (kbutton_t *key, int pnum); float CL_KeyState (kbutton_t *key, int pnum);
char *Key_KeynumToString (int keynum); char *Key_KeynumToString (int keynum);
int Key_StringToKeynum (char *str, int *modifier);
// //
// cl_demo.c // cl_demo.c
@ -687,6 +688,7 @@ void CL_InitTEnts (void);
void CL_ClearTEnts (void); void CL_ClearTEnts (void);
void CL_ClearCustomTEnts(void); void CL_ClearCustomTEnts(void);
void CL_ParseCustomTEnt(void); void CL_ParseCustomTEnt(void);
void CL_ParseEffect (qboolean effect2);
// //
// cl_ents.c // cl_ents.c
@ -801,7 +803,7 @@ void CLQ2_ParseTEnt (void);
void CLQ2_AddEntities (void); void CLQ2_AddEntities (void);
void CLQ2_ParseBaseline (void); void CLQ2_ParseBaseline (void);
void CLQ2_ParseFrame (void); void CLQ2_ParseFrame (void);
void CLNQ_ParseEntity(int bits); void CLNQ_ParseEntity(unsigned int bits);
int CLQ2_RegisterTEntModels (void); int CLQ2_RegisterTEntModels (void);
#endif #endif

View file

@ -922,6 +922,7 @@ void IN_MouseEvent (int mstate)
static void ProcessMouse(mouse_t *mouse, usercmd_t *cmd, int pnum) static void ProcessMouse(mouse_t *mouse, usercmd_t *cmd, int pnum)
{ {
extern int mouseusedforgui, mousecursor_x, mousecursor_y; extern int mouseusedforgui, mousecursor_x, mousecursor_y;
extern int mousemove_x, mousemove_y;
int mx, my; int mx, my;
int mouse_x, mouse_y; int mouse_x, mouse_y;
@ -971,6 +972,8 @@ static void ProcessMouse(mouse_t *mouse, usercmd_t *cmd, int pnum)
if (mouseusedforgui || (key_dest == key_menu && m_state == m_complex) || UI_MenuState()) if (mouseusedforgui || (key_dest == key_menu && m_state == m_complex) || UI_MenuState())
{ {
mousemove_x += mx;
mousemove_y += my;
mousecursor_x += mx; mousecursor_x += mx;
mousecursor_y += my; mousecursor_y += my;

View file

@ -413,12 +413,3 @@ void M_Menu_FPS_f (void)
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 200, 32, NULL, false); menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 200, 32, NULL, false);
} }
void M_OptionsMenusInit(void)
{
Cmd_AddCommand ("menu_options", M_Menu_Options_f);
Cmd_AddCommand ("menu_video", M_Menu_Video_f);
Cmd_AddCommand ("menu_audio", M_Menu_Audio_f);
Cmd_AddCommand ("menu_fps", M_Menu_FPS_f);
Cmd_AddCommand ("menu_particles", M_Menu_Particles_f);
}

View file

@ -205,6 +205,8 @@ M_ToggleMenu_f
*/ */
void M_ToggleMenu_f (void) void M_ToggleMenu_f (void)
{ {
if (MP_Toggle())
return;
m_entersound = true; m_entersound = true;
if (key_dest == key_menu) if (key_dest == key_menu)
@ -789,37 +791,93 @@ void M_Menu_Quit_f (void)
/* Menu Subsystem */ /* Menu Subsystem */
void M_OptionsMenusInit (void);
void M_Menu_MediaFiles_f (void); void M_Menu_MediaFiles_f (void);
void M_Init (void) void M_Menu_FPS_f (void);
void M_Menu_Particles_f (void);
static qboolean internalmenusregistered;
void M_Init_Internal (void)
{ {
Cmd_AddCommand ("togglemenu", M_ToggleMenu_f); MP_Shutdown();
#ifndef CLIENTONLY
Cmd_AddCommand ("menu_save", M_Menu_Save_f);
Cmd_AddCommand ("menu_load", M_Menu_Load_f);
Cmd_AddCommand ("menu_loadgame", M_Menu_Load_f); //q2...
#endif
Cmd_AddCommand ("menu_single", M_Menu_SinglePlayer_f);
Cmd_AddCommand ("menu_multi", M_Menu_MultiPlayer_f);
Cmd_AddCommand ("menu_demo", M_Menu_Demos_f);
Cmd_AddCommand ("menu_keys", M_Menu_Keys_f); if (internalmenusregistered)
Cmd_AddCommand ("help", M_Menu_Help_f); return;
Cmd_AddCommand ("menu_quit", M_Menu_Quit_f); internalmenusregistered = true;
Cmd_AddCommand ("menu_media", M_Menu_Media_f);
Cmd_AddCommand ("menu_mediafiles", M_Menu_MediaFiles_f); #ifndef CLIENTONLY
Cmd_AddRemCommand ("menu_save", M_Menu_Save_f);
Cmd_AddRemCommand ("menu_load", M_Menu_Load_f);
Cmd_AddRemCommand ("menu_loadgame", M_Menu_Load_f); //q2...
#endif
Cmd_AddRemCommand ("menu_single", M_Menu_SinglePlayer_f);
Cmd_AddRemCommand ("menu_multi", M_Menu_MultiPlayer_f);
Cmd_AddRemCommand ("menu_demo", M_Menu_Demos_f);
Cmd_AddRemCommand ("menu_keys", M_Menu_Keys_f);
Cmd_AddRemCommand ("help", M_Menu_Help_f);
Cmd_AddRemCommand ("menu_quit", M_Menu_Quit_f);
Cmd_AddRemCommand ("menu_media", M_Menu_Media_f);
Cmd_AddRemCommand ("menu_mediafiles", M_Menu_MediaFiles_f);
#ifdef CL_MASTER #ifdef CL_MASTER
Cmd_AddCommand ("menu_servers", M_Menu_ServerList_f); Cmd_AddRemCommand ("menu_servers", M_Menu_ServerList_f);
Cmd_AddCommand ("menu_slist", M_Menu_ServerList_f); Cmd_AddRemCommand ("menu_slist", M_Menu_ServerList_f);
#endif #endif
Cmd_AddCommand ("menu_setup", M_Menu_Setup_f); Cmd_AddRemCommand ("menu_setup", M_Menu_Setup_f);
Cmd_AddCommand ("menu_newmulti", M_Menu_GameOptions_f); Cmd_AddRemCommand ("menu_newmulti", M_Menu_GameOptions_f);
Cmd_AddRemCommand ("menu_main", M_Menu_Main_f); //I've moved main to last because that way tab give us main and not quit.
Cmd_AddCommand ("menu_main", M_Menu_Main_f); //I've moved main to last because that way tab give us main and not quit. Cmd_AddRemCommand ("menu_options", M_Menu_Options_f);
Cmd_AddRemCommand ("menu_video", M_Menu_Video_f);
Cmd_AddRemCommand ("menu_audio", M_Menu_Audio_f);
Cmd_AddRemCommand ("menu_fps", M_Menu_FPS_f);
Cmd_AddRemCommand ("menu_particles", M_Menu_Particles_f);
}
M_OptionsMenusInit(); void M_DeInit_Internal (void)
{
M_RemoveAllMenus();
if (!internalmenusregistered)
return;
internalmenusregistered = false;
#ifndef CLIENTONLY
Cmd_RemoveCommand ("menu_save");
Cmd_RemoveCommand ("menu_load");
Cmd_RemoveCommand ("menu_loadgame"); //q2...
#endif
Cmd_RemoveCommand ("menu_single");
Cmd_RemoveCommand ("menu_multi");
Cmd_RemoveCommand ("menu_demo");
Cmd_RemoveCommand ("menu_keys");
Cmd_RemoveCommand ("help");
Cmd_RemoveCommand ("menu_quit");
Cmd_RemoveCommand ("menu_media");
Cmd_RemoveCommand ("menu_mediafiles");
#ifdef CL_MASTER
Cmd_RemoveCommand ("menu_servers");
Cmd_RemoveCommand ("menu_slist");
#endif
Cmd_RemoveCommand ("menu_setup");
Cmd_RemoveCommand ("menu_newmulti");
Cmd_RemoveCommand ("menu_main"); //I've moved main to last because that way tab give us main and not quit.
Cmd_RemoveCommand ("menu_options");
Cmd_RemoveCommand ("menu_video");
Cmd_RemoveCommand ("menu_audio");
Cmd_RemoveCommand ("menu_fps");
Cmd_RemoveCommand ("menu_particles");
}
//menu.dat is loaded later... after the video and everything is up.
void M_Init (void)
{
M_Init_Internal();
Cmd_AddCommand("togglemenu", M_ToggleMenu_f);
Cvar_Register(&m_helpismedia, "Menu thingumiebobs"); Cvar_Register(&m_helpismedia, "Menu thingumiebobs");
@ -914,6 +972,9 @@ void M_Draw (int uimenu)
Plug_Menu_Event (0, (int)(realtime*1000)); Plug_Menu_Event (0, (int)(realtime*1000));
break; break;
#endif #endif
case m_menu_dat:
MP_Draw();
return;
} }
if (m_entersound) if (m_entersound)
@ -964,6 +1025,10 @@ void M_Keydown (int key)
Plug_Menu_Event (1, key); Plug_Menu_Event (1, key);
return; return;
#endif #endif
case m_menu_dat:
MP_Keydown(key);
return;
} }
} }
@ -980,6 +1045,9 @@ void M_Keyup (int key)
Plug_Menu_Event (2, key); Plug_Menu_Event (2, key);
return; return;
#endif #endif
case m_menu_dat:
MP_Keyup(key);
return;
default: default:
break; break;
} }

View file

@ -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_plugin} m_state_t; typedef enum {m_none, m_complex, m_help, m_keys, m_slist, m_media, m_xwindows, m_plugin, m_menu_dat} m_state_t;
extern m_state_t m_state; 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; 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;
@ -293,3 +293,10 @@ void M_DrawPic (int x, int y, qpic_t *pic);
void M_FindKeysForCommand (char *command, int *twokeys); void M_FindKeysForCommand (char *command, int *twokeys);
void M_UnbindCommand (char *command); void M_UnbindCommand (char *command);
void MP_Shutdown (void);
void MP_Init (void);
qboolean MP_Toggle(void);
void MP_Draw(void);
void MP_Keydown(int key);
void MP_Keyup(int key);

View file

@ -38,6 +38,10 @@ extern void (*Draw_Fill) (int x, int y, int w, int h, int c);
extern void (*Draw_FadeScreen) (void); extern void (*Draw_FadeScreen) (void);
extern void (*Draw_BeginDisc) (void); extern void (*Draw_BeginDisc) (void);
extern void (*Draw_EndDisc) (void); extern void (*Draw_EndDisc) (void);
extern qboolean (*Draw_IsCached) (char *picname); //can be null
extern void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qpic_t *pic); //gl-style scaled/coloured/subpic
extern void (*Draw_ImageColours) (float r, float g, float b, float a);
extern void (*R_Init) (void); extern void (*R_Init) (void);
extern void (*R_DeInit) (void); extern void (*R_DeInit) (void);
@ -72,8 +76,8 @@ extern void (*VID_ForceLockState) (int lk);
extern int (*VID_ForceUnlockedAndReturnState) (void); extern int (*VID_ForceUnlockedAndReturnState) (void);
extern void (*VID_SetPalette) (unsigned char *palette); extern void (*VID_SetPalette) (unsigned char *palette);
extern void (*VID_ShiftPalette) (unsigned char *palette); extern void (*VID_ShiftPalette) (unsigned char *palette);
extern char *(*VID_GetRGBInfo)(int prepad, int *truevidwidth, int *truevidheight); extern char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
extern void (*VID_SetWindowCaption) (char *msg); extern void (*VID_SetWindowCaption) (char *msg);
extern void SCR_Init (void); extern void SCR_Init (void);
extern void SCR_DeInit (void); extern void SCR_DeInit (void);
@ -99,6 +103,7 @@ extern qbyte *FNC(Mod_Q1LeafPVS) (struct mleaf_s *leaf, struct model_s *mode
extern void FNC(Mod_NowLoadExternal) (void); extern void FNC(Mod_NowLoadExternal) (void);
extern void FNC(Mod_Think) (void); extern void FNC(Mod_Think) (void);
extern void (*Mod_GetTag) (struct model_s *model, int tagnum, int frame, float **org, float **axis);
#undef FNC #undef FNC

View file

@ -162,7 +162,7 @@ extern "C" {
#include "progs.h" #include "progs.h"
#include "world.h" #include "world.h"
//#ifdef Q2SERVER //#ifdef Q2SERVER
#include "q2game.h" //under development. #include "q2game.h"
//#endif //#endif
#include "server.h" #include "server.h"
#endif #endif

View file

@ -236,6 +236,7 @@ void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);
#if defined(RGLQUAKE) #if defined(RGLQUAKE)
void GLMod_Init (void); void GLMod_Init (void);
void GLMod_GetTag(struct model_s *model, int tagnum, int frame, float **org, float **axis);
void GLMod_ClearAll (void); void GLMod_ClearAll (void);
struct model_s *GLMod_ForName (char *name, qboolean crash); struct model_s *GLMod_ForName (char *name, qboolean crash);
struct model_s *GLMod_FindName (char *name); struct model_s *GLMod_FindName (char *name);