Skip to content

Commit

Permalink
ITEMCLOCK: Add static items to list, parse //ktx notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
meag committed Nov 7, 2018
1 parent 312d75f commit c729dd9
Show file tree
Hide file tree
Showing 12 changed files with 909 additions and 121 deletions.
10 changes: 10 additions & 0 deletions cl_ents.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,16 @@ void CL_LinkPacketEntities(void)
continue;
}

ent.renderfx &= ~(RF_BACKPACK_FLAGS);
if (cls.mvdplayback && model->modhint == MOD_BACKPACK) {
if (cent->contents == IT_ROCKET_LAUNCHER) {
ent.renderfx |= RF_ROCKETPACK;
}
else if (cent->contents == IT_LIGHTNING) {
ent.renderfx |= RF_LGPACK;
}
}

CL_AddEntity (&ent);
}
}
Expand Down
38 changes: 35 additions & 3 deletions cl_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2998,9 +2998,41 @@ void CL_ParseStufftext (void)
return;
}
}
else if (!strncmp(s, "//ktx race ", sizeof("//ktx race ") - 1)) {
if (!strncmp(s, "//ktx race pm ", sizeof("//ktx race pm ") - 1)) {
cl.race_pacemaker_ent = atoi(s + sizeof("//ktx race pm ") - 1);
else if (!strncmp(s, "//ktx ", sizeof("//ktx ") - 1)) {
if (!strncmp(s, "//ktx race ", sizeof("//ktx race ") - 1)) {
if (!strncmp(s, "//ktx race pm ", sizeof("//ktx race pm ") - 1)) {
cl.race_pacemaker_ent = atoi(s + sizeof("//ktx race pm ") - 1);
}
}
else if (!strcmp(s, "//ktx matchstart\n")) {
if (cls.mvdplayback) {
MVDAnnouncer_MatchStart();
}
}
else if (!strncmp(s, "//ktx took ", sizeof("//ktx took ") - 1)) {
if (cls.mvdplayback) {
MVDAnnouncer_ItemTaken(s + 2);
}
}
else if (!strncmp(s, "//ktx timer ", sizeof("//ktx timer ") - 1)) {
if (cls.mvdplayback) {
MVDAnnouncer_StartTimer(s + 2);
}
}
else if (!strncmp(s, "//ktx drop ", sizeof("//ktx drop ") - 1)) {
if (cls.mvdplayback) {
MVDAnnouncer_PackDropped(s + 2);
}
}
else if (!strncmp(s, "//ktx expire ", sizeof("//ktx expire ") - 1)) {
if (cls.mvdplayback) {
MVDAnnouncer_Expired(s + 2);
}
}
else if (!strncmp(s, "//ktx bp ", sizeof("//ktx bp ") - 1)) {
if (cls.mvdplayback) {
MVDAnnouncer_BackpackPickup(s + 2);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions client.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ typedef struct

int old_vw_index; // player entities only
int old_vw_frame; // player entities only

int contents;
} centity_t;

#define CENT_TRAILDRAWN 1
Expand Down
2 changes: 2 additions & 0 deletions gl_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,8 @@ static void Draw_StringBase (int x, int y, const wchar *text, clrinfo_t *color,
if (!*text)
return;

Draw_SetColor(color_white, alpha);

// Turn on alpha transparency.
if (gl_alphafont.value || (overall_alpha < 1.0))
{
Expand Down
73 changes: 57 additions & 16 deletions gl_rmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ typedef struct custom_model_color_s {
cvar_t fullbright_cvar;
cvar_t* amf_cvar;
int model_hint;
int renderfx;
qbool disable_texturing;
} custom_model_color_t;

custom_model_color_t custom_model_colors[] = {
Expand All @@ -236,28 +238,52 @@ custom_model_color_t custom_model_colors[] = {
{ "gl_custom_lg_color", "", CVAR_COLOR },
{ "gl_custom_lg_fullbright", "1" },
&amf_lightning,
MOD_THUNDERBOLT
MOD_THUNDERBOLT,
0,
true
},
// Rockets
{
{ "gl_custom_rocket_color", "", CVAR_COLOR },
{ "gl_custom_rocket_fullbright", "1" },
NULL,
MOD_ROCKET
MOD_ROCKET,
0,
true
},
// Grenades
{
{ "gl_custom_grenade_color", "", CVAR_COLOR },
{ "gl_custom_grenade_fullbright", "1" },
NULL,
MOD_GRENADE
MOD_GRENADE,
0,
true
},
// Spikes
{
{ "gl_custom_spike_color", "", CVAR_COLOR },
{ "gl_custom_spike_fullbright", "1" },
&amf_part_spikes,
MOD_SPIKE
MOD_SPIKE,
0,
true
},
{
{ "gl_custom_rlpack_color", "255 64 64", CVAR_COLOR },
{ "", "0" },
NULL,
MOD_BACKPACK,
RF_ROCKETPACK,
false
},
{
{ "gl_custom_lgpack_color", "64 64 255", CVAR_COLOR },
{ "", "0" },
NULL,
MOD_BACKPACK,
RF_LGPACK,
false
}
};

Expand Down Expand Up @@ -608,8 +634,9 @@ void GL_DrawAliasFrame(aliashdr_t *paliashdr, int pose1, int pose2, qbool mtex,
glEnable(GL_BLEND);

if (custom_model) {
glDisable(GL_TEXTURE_2D);
glColor4ub(custom_model->color_cvar.color[0], custom_model->color_cvar.color[1], custom_model->color_cvar.color[2], r_modelalpha * 255);
if (custom_model->disable_texturing) {
glDisable(GL_TEXTURE_2D);
}
}

for ( ;; )
Expand Down Expand Up @@ -664,31 +691,46 @@ void GL_DrawAliasFrame(aliashdr_t *paliashdr, int pose1, int pose2, qbool mtex,
else
glColor4f(r_modelcolor[0] * lc[0], r_modelcolor[1] * lc[1], r_modelcolor[2] * lc[2], r_modelalpha); // forced
}
else if (custom_model == NULL)
{
else if (custom_model == NULL) {
if (r_modelcolor[0] < 0) {
glColor4f(l, l, l, r_modelalpha); // normal color
} else {
}
else {
glColor4f(r_modelcolor[0] * l, r_modelcolor[1] * l, r_modelcolor[2] * l, r_modelalpha); // forced
}
}
else {
if (custom_model->fullbright_cvar.name[0] && custom_model->fullbright_cvar.integer) {
l = 1;
}

// model color
glColor4ub(
l * custom_model->color_cvar.color[0],
l * custom_model->color_cvar.color[1],
l * custom_model->color_cvar.color[2],
r_modelalpha * 255
);
}

VectorInterpolate(verts1->v, lerpfrac, verts2->v, interpolated_verts);
glVertex3fv(interpolated_verts);


verts1++;
verts2++;
} while (--count);

glEnd();
}

if (r_modelalpha < 1)
if (r_modelalpha < 1) {
glDisable(GL_BLEND);
}

if (custom_model) {
glEnable(GL_TEXTURE_2D);
if (custom_model->disable_texturing) {
glEnable(GL_TEXTURE_2D);
}
custom_model = NULL;
}
}
Expand Down Expand Up @@ -777,17 +819,17 @@ void R_AliasSetupLighting(entity_t *ent)
clmodel = ent->model;

custom_model = NULL;
for (i = 0; i < sizeof (custom_model_colors) / sizeof (custom_model_colors[0]); ++i) {
for (i = 0; i < sizeof(custom_model_colors) / sizeof(custom_model_colors[0]); ++i) {
custom_model_color_t* test = &custom_model_colors[i];
if (test->model_hint == clmodel->modhint) {
if (test->model_hint && test->model_hint == clmodel->modhint && (test->renderfx == 0 || test->renderfx == ent->renderfx)) {
if (test->color_cvar.string[0] && (test->amf_cvar == NULL || test->amf_cvar->integer == 0)) {
custom_model = &custom_model_colors[i];
}
break;
}
}

if (custom_model && custom_model->fullbright_cvar.integer) {
if (custom_model && custom_model->fullbright_cvar.name[0] && custom_model->fullbright_cvar.integer) {
ambientlight = 4096;
shadelight = 0;
full_light = true;
Expand All @@ -811,7 +853,6 @@ void R_AliasSetupLighting(entity_t *ent)
full_light = false;
ambientlight = shadelight = R_LightPoint (ent->origin);


/* FIXME: dimman... cache opt from fod */
//VULT COLOURED MODEL LIGHTS
if (amf_lighting_colour.value)
Expand Down
12 changes: 11 additions & 1 deletion hud_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -5382,7 +5382,7 @@ void SCR_HUD_DrawItemsClock(hud_t *hud)
extern const char* MVD_AnnouncerString(int line, int total, float* alpha);
int width, height;
int x, y;
int i;

static cvar_t
*hud_itemsclock_timelimit = NULL,
*hud_itemsclock_style = NULL,
Expand Down Expand Up @@ -7106,3 +7106,13 @@ static void SCR_Hud_GameSummary(hud_t* hud)
}
}
}

const char* HUD_FirstTeam(void)
{
if (n_teams) {
return sorted_teams[0].name;
}
else {
return "";
}
}
Loading

0 comments on commit c729dd9

Please sign in to comment.