cl.max_lightstyle = MAX_LIGHTSTYLES;
cl.max_brushmodel_entities = MAX_EDICTS;
cl.max_particles = MAX_PARTICLES;
+ cl.max_showlmps = 0;
// COMMANDLINEOPTION: Client: -particles <number> changes maximum number of particles at once, default 32768
i = COM_CheckParm ("-particles");
cl.lightstyle = (lightstyle_t *)Mem_Alloc(cls.levelmempool, cl.max_lightstyle * sizeof(lightstyle_t));
cl.brushmodel_entities = (int *)Mem_Alloc(cls.levelmempool, cl.max_brushmodel_entities * sizeof(int));
cl.particles = (particle_t *) Mem_Alloc(cls.levelmempool, cl.max_particles * sizeof(particle_t));
+ cl.showlmps = NULL;
// LordHavoc: have to set up the baseline info for alpha and other stuff
for (i = 0;i < cl.max_entities;i++)
//=============================================================================
-// LordHavoc: SHOWLMP stuff
-#define SHOWLMP_MAXLABELS 256
-typedef struct showlmp_s
-{
- qboolean isactive;
- float x;
- float y;
- char label[32];
- char pic[128];
-}
-showlmp_t;
-
-showlmp_t showlmp[SHOWLMP_MAXLABELS];
-
void SHOWLMP_decodehide(void)
{
int i;
char *lmplabel;
lmplabel = MSG_ReadString();
- for (i = 0;i < SHOWLMP_MAXLABELS;i++)
- if (showlmp[i].isactive && strcmp(showlmp[i].label, lmplabel) == 0)
+ for (i = 0;i < cl.num_showlmps;i++)
+ if (cl.showlmps[i].isactive && strcmp(cl.showlmps[i].label, lmplabel) == 0)
{
- showlmp[i].isactive = false;
+ cl.showlmps[i].isactive = false;
return;
}
}
void SHOWLMP_decodeshow(void)
{
- int i, k;
+ int k;
char lmplabel[256], picname[256];
float x, y;
strlcpy (lmplabel,MSG_ReadString(), sizeof (lmplabel));
x = MSG_ReadShort();
y = MSG_ReadShort();
}
- k = -1;
- for (i = 0;i < SHOWLMP_MAXLABELS;i++)
- if (showlmp[i].isactive)
- {
- if (strcmp(showlmp[i].label, lmplabel) == 0)
- {
- k = i;
- break; // drop out to replace it
- }
- }
- else if (k < 0) // find first empty one to replace
- k = i;
- if (k < 0)
- return; // none found to replace
- // change existing one
- showlmp[k].isactive = true;
- strlcpy (showlmp[k].label, lmplabel, sizeof (showlmp[k].label));
- strlcpy (showlmp[k].pic, picname, sizeof (showlmp[k].pic));
- showlmp[k].x = x;
- showlmp[k].y = y;
+ if (!cl.showlmps || cl.num_showlmps >= cl.max_showlmps)
+ {
+ showlmp_t *oldshowlmps = cl.showlmps;
+ cl.max_showlmps += 16;
+ cl.showlmps = Mem_Alloc(cls.levelmempool, cl.max_showlmps * sizeof(showlmp_t));
+ if (cl.num_showlmps)
+ memcpy(cl.showlmps, oldshowlmps, cl.num_showlmps * sizeof(showlmp_t));
+ if (oldshowlmps)
+ Mem_Free(oldshowlmps);
+ }
+ for (k = 0;k < cl.max_showlmps;k++)
+ if (cl.showlmps[k].isactive && !strcmp(cl.showlmps[k].label, lmplabel))
+ break;
+ if (k == cl.max_showlmps)
+ for (k = 0;k < cl.max_showlmps;k++)
+ if (!cl.showlmps[k].isactive)
+ break;
+ cl.showlmps[k].isactive = true;
+ strlcpy (cl.showlmps[k].label, lmplabel, sizeof (cl.showlmps[k].label));
+ strlcpy (cl.showlmps[k].pic, picname, sizeof (cl.showlmps[k].pic));
+ cl.showlmps[k].x = x;
+ cl.showlmps[k].y = y;
+ cl.num_showlmps = max(cl.num_showlmps, k + 1);
}
void SHOWLMP_drawall(void)
{
int i;
- for (i = 0;i < SHOWLMP_MAXLABELS;i++)
- if (showlmp[i].isactive)
- DrawQ_Pic(showlmp[i].x, showlmp[i].y, Draw_CachePic(showlmp[i].pic, true), 0, 0, 1, 1, 1, 1, 0);
-}
-
-void SHOWLMP_clear(void)
-{
- int i;
- for (i = 0;i < SHOWLMP_MAXLABELS;i++)
- showlmp[i].isactive = false;
+ for (i = 0;i < cl.num_showlmps;i++)
+ if (cl.showlmps[i].isactive)
+ DrawQ_Pic(cl.showlmps[i].x, cl.showlmps[i].y, Draw_CachePic(cl.showlmps[i].pic, true), 0, 0, 1, 1, 1, 1, 0);
}
/*
void CL_Screen_NewMap(void)
{
- SHOWLMP_clear();
}
0 bug darkplaces loader: mcbsp hull selection is ignoring the custom hulls supported by mcbsp (div0)
0 bug darkplaces loader: q1bsp loader computes wrong submodel size for submodels with no surfaces, such as a func_wall comprised entirely of SKIP or CAULK brushes (neg|ke)
0 bug darkplaces memory: memstats doesn't account for memory used by VBO/EBO buffers in models
+0 bug darkplaces menu: load/save game menus show files that are not in the highest priority gamedir, such as id1 saves showing up when playing dpmod (Dooomer)
0 bug darkplaces qc FRIK_FILE: when opening a file for writing that already has the data/ prefix in its path, it should not add another data/ prefix (daemon)
0 bug darkplaces readme: it would be a very good idea to add documentation of sv_gameplayfix_* cvars in the readme as a means to run broken mods (xaGe)
0 bug darkplaces readme: readme says that q3 shaders are not supported, this is not true, describe the working features in detail (qqshka)