From ce2468c2e3ef7ffd3b3fda3d83fbfe3fa95d305d Mon Sep 17 00:00:00 2001 From: ezh-HaMMeR Date: Sun, 5 Nov 2023 21:55:49 +0300 Subject: [PATCH 1/2] Adding information about non-standard flag models for the correct work of r_flagcolor on those maps where they are used. --- src/cl_ents.c | 23 ++++++++++++++++++++++- src/client.h | 2 +- src/fmod.c | 20 ++++++++++++++++++++ src/r_model.c | 6 ++++++ src/teamplay.c | 20 +++++++++++++++++++- 5 files changed, 68 insertions(+), 3 deletions(-) diff --git a/src/cl_ents.c b/src/cl_ents.c index 652372171..66a91ecc8 100644 --- a/src/cl_ents.c +++ b/src/cl_ents.c @@ -67,6 +67,16 @@ void CL_InitEnts(void) { cl_modelnames[mi_flag] = "progs/flag.mdl"; cl_modelnames[mi_tf_flag] = "progs/tf_flag.mdl"; cl_modelnames[mi_tf_stan] = "progs/tf_stan.mdl"; + cl_modelnames[mi_stag] = "progs/stag.mdl"; + cl_modelnames[mi_basrkey] = "progs/basrkey.bsp"; + cl_modelnames[mi_basbkey] = "progs/basbkey.bsp"; + cl_modelnames[mi_w_s_key] = "progs/w_s_key.mdl"; + cl_modelnames[mi_w_g_key] = "progs/w_g_key.mdl"; + cl_modelnames[mi_b_g_key] = "progs/b_g_key.mdl"; + cl_modelnames[mi_b_s_key] = "progs/b_s_key.mdl"; + cl_modelnames[mi_ff_flag] = "progs/ff_flag.mdl"; + cl_modelnames[mi_harbflag] = "progs/harbflag.mdl"; + cl_modelnames[mi_princess] = "progs/princess.mdl"; cl_modelnames[mi_explod1] = "progs/s_explod.spr"; cl_modelnames[mi_explod2] = "progs/s_expl.spr"; cl_modelnames[mi_h_player] = "progs/h_player.mdl"; @@ -901,7 +911,18 @@ void CL_LinkPacketEntities(void) { qbool flagcolor = false; - if (cl.teamfortress && (state->modelindex == cl_modelindices[mi_tf_flag] || state->modelindex == cl_modelindices[mi_tf_stan])) + if (cl.teamfortress && (state->modelindex == cl_modelindices[mi_tf_flag] || + state->modelindex == cl_modelindices[mi_tf_stan] || + state->modelindex == cl_modelindices[mi_stag] || + state->modelindex == cl_modelindices[mi_basrkey] || + state->modelindex == cl_modelindices[mi_basbkey] || + state->modelindex == cl_modelindices[mi_w_s_key] || + state->modelindex == cl_modelindices[mi_w_g_key] || + state->modelindex == cl_modelindices[mi_b_g_key] || + state->modelindex == cl_modelindices[mi_b_s_key] || + state->modelindex == cl_modelindices[mi_ff_flag] || + state->modelindex == cl_modelindices[mi_harbflag] || + state->modelindex == cl_modelindices[mi_princess])) flagcolor = true; else if (state->modelindex == cl_modelindices[mi_flag]) flagcolor = true; diff --git a/src/client.h b/src/client.h index faa9d9685..2add1acf9 100644 --- a/src/client.h +++ b/src/client.h @@ -1038,7 +1038,7 @@ void CL_UpdateTEnts(void); // cl_ents.c typedef enum cl_modelindex_s { - mi_spike, mi_player, mi_eyes, mi_flag, mi_tf_flag, mi_tf_stan, mi_explod1, mi_explod2, mi_h_player, + mi_spike, mi_player, mi_eyes, mi_flag, mi_tf_flag, mi_tf_stan, mi_stag, mi_basrkey, mi_basbkey, mi_w_s_key, mi_w_g_key, mi_b_g_key, mi_b_s_key, mi_ff_flag, mi_harbflag, mi_princess, mi_explod1, mi_explod2, mi_h_player, mi_gib1, mi_gib2, mi_gib3, mi_rocket, mi_grenade, mi_bubble, mi_vaxe, mi_vbio, mi_vgrap, mi_vknife, mi_vknife2, mi_vmedi, mi_vspan, mi_flame, //joe: for changing flame/flame0 models diff --git a/src/fmod.c b/src/fmod.c index e146b0c10..ce6a3a1e8 100644 --- a/src/fmod.c +++ b/src/fmod.c @@ -60,6 +60,16 @@ static const int progs_suit_mdl_FMOD_DM_FMOD_TF[5] = {0xb7dcb9dd, 0xed8da03b, static const int progs_player_mdl_FMOD_DM[5] = {0x95ca0ab4, 0x021be62e, 0x6655e9a5, 0xd4a7ef1c, 0xb484582f}; static const int progs_player_mdl_FMOD_TF[5] = {0x8fcab658, 0x027a97ef, 0xa96eee3d, 0xc1e44f46, 0x18a533c9}; static const int progs_tf_flag_mdl_FMOD_TF[5] = {0x6e969df0, 0xc91b9eef, 0x84cb1a40, 0xcaee122e, 0x1b1d3d28}; +static const int progs_stag_mdl_FMOD_TF[5] = {0x6e970df0, 0xc91b9eef, 0x84cb1a40, 0xcaee122e, 0x1b1d3d28}; +static const int progs_basrkey_bsp_FMOD_TF[5] = {0x6e971df0, 0xc11b9eef, 0x84cb1a40, 0xcaee122e, 0x1b1d3d28}; +static const int progs_basbkey_bsp_FMOD_TF[5] = {0x6e972df0, 0xc21b9eef, 0x84cb1a40, 0xcaee122e, 0x1b1d3d28}; +static const int progs_w_s_key_mdl_FMOD_TF[5] = {0x6e973df0, 0xc31b9eef, 0x84cb1a40, 0xcaee122e, 0x1b1d3d28}; +static const int progs_w_g_key_mdl_FMOD_TF[5] = {0x6e974df0, 0xc41b9eef, 0x84cb1a40, 0xcaee122e, 0x1b1d3d28}; +static const int progs_b_g_key_mdl_FMOD_TF[5] = {0x6e975df0, 0xc51b9eef, 0x84cb1a40, 0xcaee122e, 0x1b1d3d28}; +static const int progs_b_s_key_mdl_FMOD_TF[5] = {0x6e976df0, 0xc61b9eef, 0x84cb1a40, 0xcaee122e, 0x1b1d3d28}; +static const int progs_ff_flag_mdl_FMOD_TF[5] = {0x6e977df0, 0xc71b9eef, 0x84cb1a40, 0xcaee122e, 0x1b1d3d28}; +static const int progs_harbflag_mdl_FMOD_TF[5] = {0x6e978df0, 0xc81b9eef, 0x84cb1a40, 0xcaee122e, 0x1b1d3d28}; +static const int progs_princess_mdl_FMOD_TF[5] = {0x6e979df0, 0xc92b9eef, 0x84cb1a40, 0xcaee122e, 0x1b1d3d28}; static const int progs_turrbase_mdl_FMOD_TF[5] = {0x0cda73d5, 0x822703cb, 0x9e6cbe6b, 0x94fb95f7, 0xc7c04bed}; static const int progs_turrgun_mdl_FMOD_TF[5] = {0x314b126f, 0x7d8d7cb5, 0x8df185c8, 0x1f3662f7, 0xa272957b}; static const int progs_disp_mdl_FMOD_TF[5] = {0x5596fa4a, 0xd94e2457, 0x140f84df, 0x5859dda8, 0xe96752fc}; @@ -501,6 +511,16 @@ void FMod_Init (void) FMod_AddModel ("progs/player.mdl", FMOD_TF, progs_player_mdl_FMOD_TF); FMod_AddModel ("progs/tf_flag.mdl", FMOD_TF, progs_tf_flag_mdl_FMOD_TF); + FMod_AddModel("progs/stag.mdl", FMOD_TF, progs_stag_mdl_FMOD_TF); + FMod_AddModel("progs/basrkey.bsp", FMOD_TF, progs_basrkey_bsp_FMOD_TF); + FMod_AddModel("progs/basbkey.bsp", FMOD_TF, progs_basbkey_bsp_FMOD_TF); + FMod_AddModel("progs/w_s_key.mdl", FMOD_TF, progs_w_s_key_mdl_FMOD_TF); + FMod_AddModel("progs/w_g_key.mdl", FMOD_TF, progs_w_g_key_mdl_FMOD_TF); + FMod_AddModel("progs/b_g_key.mdl", FMOD_TF, progs_b_g_key_mdl_FMOD_TF); + FMod_AddModel("progs/b_s_key.mdl", FMOD_TF, progs_b_s_key_mdl_FMOD_TF); + FMod_AddModel("progs/ff_flag.mdl", FMOD_TF, progs_ff_flag_mdl_FMOD_TF); + FMod_AddModel("progs/harbflag.mdl", FMOD_TF, progs_harbflag_mdl_FMOD_TF); + FMod_AddModel("progs/princess.mdl", FMOD_TF, progs_princess_mdl_FMOD_TF); FMod_AddModel ("progs/turrbase.mdl", FMOD_TF, progs_turrbase_mdl_FMOD_TF); FMod_AddModel ("progs/turrgun.mdl", FMOD_TF, progs_turrgun_mdl_FMOD_TF); FMod_AddModel ("progs/disp.mdl", FMOD_TF, progs_disp_mdl_FMOD_TF); diff --git a/src/r_model.c b/src/r_model.c index af4ce2e16..5304061f2 100644 --- a/src/r_model.c +++ b/src/r_model.c @@ -465,6 +465,12 @@ void Mod_AddModelFlags(model_t *mod) !strcmp(mod->name, "progs/w_s_key.mdl") || !strcmp(mod->name, "progs/b_g_key.mdl") || !strcmp(mod->name, "progs/b_s_key.mdl") || + !strcmp(mod->name, "progs/stag.mdl") || + !strcmp(mod->name, "progs/basrkey.bsp") || + !strcmp(mod->name, "progs/basbkey.bsp") || + !strcmp(mod->name, "progs/ff_flag.mdl") || + !strcmp(mod->name, "progs/harbflag.mdl") || + !strcmp(mod->name, "progs/princess.mdl") || !strcmp(mod->name, "progs/tf_stan.mdl")) { mod->modhint = MOD_FLAG; } diff --git a/src/teamplay.c b/src/teamplay.c index 68e7bfb70..ca51a5a0a 100644 --- a/src/teamplay.c +++ b/src/teamplay.c @@ -2413,7 +2413,25 @@ item_t tp_items[] = { { it_flag, &tp_name_flag, "progs/b_g_key.mdl", {0, 0, 20}, 18, }, - { it_flag, &tp_name_flag, "progs/flag.mdl", + { it_flag, &tp_name_flag, "progs/stag.mdl", + {0, 0, 20}, 18, + }, + { it_flag, &tp_name_flag, "progs/basrkey.bsp", + {0, 0, 20}, 18, + }, + { it_flag, &tp_name_flag, "progs/basbkey.bsp", + {0, 0, 20}, 18, + }, + { it_flag, &tp_name_flag, "progs/ff_flag.mdl", + {0, 0, 20}, 18, + }, + { it_flag, &tp_name_flag, "progs/harbflag.mdl", + {0, 0, 20}, 18, + }, + { it_flag, &tp_name_flag, "progs/princess.mdl", + {0, 0, 20}, 18, + }, + { it_flag, &tp_name_flag, "progs/flag.mdl", {0, 0, 14}, 25, }, { it_rune1, &tp_name_rune1, "progs/end1.mdl", From bf34282e7a0f3859acdd168032a5adb5a730ede4 Mon Sep 17 00:00:00 2001 From: Vlad Koptevskiy <61891125+MeMcCree@users.noreply.github.com> Date: Tue, 7 Nov 2023 23:14:43 +0300 Subject: [PATCH 2/2] Adding back support for 'img' type for 'hud262_add', Add command to stop all sounds played using 'play' command. --- src/cmd.c | 2 +- src/hud_262.c | 22 +++++++++++++++++++--- src/snd_main.c | 6 ++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 56ca4406e..78b604743 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1653,7 +1653,7 @@ int Commands_Compare_Func (const void * arg1, const void * arg2) } char *msgtrigger_commands[] = { - "play", "playvol", "stopsound", "set", "echo", "say", "say_team", + "play", "playvol", "stopsound", "stopsound_script", "set", "echo", "say", "say_team", "alias", "unalias", "msg_trigger", "inc", "bind", "unbind", "record", "easyrecord", "stop", "if", "if_exists", "wait", "log", "match_forcestart", "dns", "addserver", "connect", "join", "observe", diff --git a/src/hud_262.c b/src/hud_262.c index 2e7413d10..a4102b4f0 100644 --- a/src/hud_262.c +++ b/src/hud_262.c @@ -90,8 +90,10 @@ static hud_element_t* Hud_NewElement(void) static void Hud_DeleteElement(hud_element_t *elem) { - if (elem->flags & (HUD_STRING | HUD_IMAGE)) + if (elem->flags & (HUD_STRING)) Q_free(elem->contents); + if (elem->flags & (HUD_IMAGE)) + CachePic_RemoveByPic(elem->contents); if (elem->f_hover) Q_free(elem->f_hover); if (elem->f_button) @@ -164,6 +166,20 @@ void Hud_Add_f(void) elem->contents = Q_strdup(a3); elem->flags = HUD_STRING | HUD_ENABLED; } + else if (!strcasecmp(a2, "img")) { + char* pic_path = Q_strdup(a3); + mpic_t* tmp_pic; + if (pic_path && strlen(pic_path) > 0) { + // Try loading the pic. + if (!(tmp_pic = Draw_CachePicSafe(pic_path, false, true))) { + Com_Printf("Couldn't load picture %s for '%s'\n", pic_path, a2); + return; + } + } + elem = Hud_NewElement(); + elem->contents = tmp_pic; + elem->flags = HUD_IMAGE | HUD_ENABLED; + } else { Com_Printf("\"%s\" is not a valid hud type\n", a2); return; @@ -592,10 +608,10 @@ void SCR_DrawHud(void) func = (Hud_Func)elem->contents; st = (*func)(); l = strlen(st); - /*} else if (elem->flags & HUD_IMAGE) { + } else if (elem->flags & HUD_IMAGE) { img = (mpic_t*)elem->contents; l = img->width/8; - elem->scr_height = img->height;*/ + elem->scr_height = img->height; } else { continue; diff --git a/src/snd_main.c b/src/snd_main.c index b37685d1b..78fc0eb28 100644 --- a/src/snd_main.c +++ b/src/snd_main.c @@ -40,6 +40,7 @@ static void S_Play_f (void); static void S_MuteSound_f (void); static void S_SoundList_f (void); static void S_Update_ (void); +static void S_StopSoundScript_f(void); static void S_StopAllSounds_f (void); static void S_Register_LatchCvars(void); void S_Voip_RegisterCvars (void); @@ -450,6 +451,7 @@ static void S_Register_RegularCvarsAndCommands(void) Cmd_AddCommand("play", S_Play_f); Cmd_AddCommand("playvol", S_Play_f); Cmd_AddCommand("stopsound", S_StopAllSounds_f); + Cmd_AddCommand("stopsound_script", S_StopSoundScript_f); Cmd_AddCommand("soundlist", S_SoundList_f); Cmd_AddCommand("soundinfo", S_SoundInfo_f); Cmd_AddCommand("s_listdrivers", S_ListDrivers); @@ -717,6 +719,10 @@ void S_StopSound (int entnum, int entchannel) S_UnlockMixer(); } +static void S_StopSoundScript_f(void) { + S_StopSound(SELF_SOUND_ENTITY, 0); +} + void S_StopAllSounds(void) { if (!shw)