From 0a54aa84233bffc5f54dc768c47c509fdcc5c38a Mon Sep 17 00:00:00 2001 From: Knightmare66 Date: Thu, 22 Apr 2021 21:41:49 -0400 Subject: [PATCH] Added new monster muzzleflashes in client and missionpack DLL: MZ2_SOLDIER_HYPERBLASTER_x, MZ2_GLADBETA_PHALANX_1, MZ2_TURRET_RAILGUN_1, MZ2_GUNNER_ETF_RIFLE_x. Removed unused muzzleflash MZ2_SUPERTANK_GRENADE_x in q_shared.h for both default Lazarus DLL and missionpack DLL. Added check for filename length before swapping extension to .ent in qcommon/cmodel.c->CMod_LoadEntityString(). Added check for filename length before swapping extension to .pcx in renderer/r_image.c->R_LoadPic(). Added check for filename length before swapping extension to .md3 in renderer/r_model.c->R_RegisterModel(). --- client/cl_lights.c | 47 ++++++++++++++++++++++++++++++++++++++++- client/cl_main.c | 4 ++-- client/cl_tempent.c | 6 +++++- game/m_flash.c | 39 ++++++++++++++++++++++++++++++++++ game/q_shared.h | 30 ++++++++++++++++++++++---- kmquake2_changelog.txt | 2 ++ missionpack/g_monster.c | 8 +++---- missionpack/m_flash.c | 39 ++++++++++++++++++++++++++++++++++ missionpack/m_gladb.c | 8 +++++-- missionpack/m_soldier.c | 27 +++++++++++++++++------ missionpack/m_turret.c | 10 ++++++--- missionpack/q_shared.h | 32 +++++++++++++++++++++++----- qcommon/cmodel.c | 9 +++++--- renderer/r_image.c | 4 ++-- renderer/r_model.c | 8 +++---- 15 files changed, 236 insertions(+), 37 deletions(-) diff --git a/client/cl_lights.c b/client/cl_lights.c index 7dfef9c..6676b11 100644 --- a/client/cl_lights.c +++ b/client/cl_lights.c @@ -278,6 +278,14 @@ void CL_ParseMuzzleFlash (void) Com_Error (ERR_DROP, "CL_ParseMuzzleFlash: bad entity"); weapon = MSG_ReadByte (&net_message); + + // TODO: Use index 127 as a flag to read a short for the extended index +/* if ( (weapon & MZ_SEND_SHORT) == MZ_SEND_SHORT) { + weapon = (unsigned short)MSG_ReadShort (&net_message); + silenced = weapon & MZ_SILENCED_HI; + weapon &= ~MZ_SILENCED_HI; + } + else { */ silenced = weapon & MZ_SILENCED; weapon &= ~MZ_SILENCED; @@ -493,6 +501,10 @@ void CL_ParseMuzzleFlash2 (void) flash_number = MSG_ReadByte (&net_message); + // TODO: Use index 255 as a flag to read a short for the real extended index +/* if (flash_number == MZ2_SEND_SHORT) + flash_number = (unsigned short)MSG_ReadShort (&net_message); */ + // locate the origin AngleVectors (cl_entities[ent].current.angles, forward, right, NULL); origin[0] = cl_entities[ent].current.origin[0] + forward[0] * monster_flash_offset[flash_number][0] + right[0] * monster_flash_offset[flash_number][1]; @@ -750,6 +762,7 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_JORG_BFG_1: dl->color[0] = 0.5;dl->color[1] = 1 ;dl->color[2] = 0.5; break; +// --- Xian's shit ends --- case MZ2_BOSS2_MACHINEGUN_R1: case MZ2_BOSS2_MACHINEGUN_R2: @@ -837,7 +850,39 @@ void CL_ParseMuzzleFlash2 (void) // ROGUE // ====== -// --- Xian's shit ends --- +// Knightmare added + case MZ2_SOLDIER_HYPERBLASTER_1: + case MZ2_SOLDIER_HYPERBLASTER_2: + case MZ2_SOLDIER_HYPERBLASTER_3: + case MZ2_SOLDIER_HYPERBLASTER_4: + case MZ2_SOLDIER_HYPERBLASTER_5: + case MZ2_SOLDIER_HYPERBLASTER_6: + case MZ2_SOLDIER_HYPERBLASTER_7: + case MZ2_SOLDIER_HYPERBLASTER_8: + dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1; + S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), 1, ATTN_NORM, 0); + break; + + case MZ2_GLADBETA_PHALANX_1: + dl->color[0] = 1;dl->color[1] = 0.5; dl->color[2] = 0.5; + break; + + case MZ2_TURRET_RAILGUN_1: + dl->color[0] = 0.5;dl->color[1] = 0.5;dl->color[2] = 1.0; + break; + + case MZ2_GUNNER_ETF_RIFLE_1: + case MZ2_GUNNER_ETF_RIFLE_2: + case MZ2_GUNNER_ETF_RIFLE_3: + case MZ2_GUNNER_ETF_RIFLE_4: + case MZ2_GUNNER_ETF_RIFLE_5: + case MZ2_GUNNER_ETF_RIFLE_6: + case MZ2_GUNNER_ETF_RIFLE_7: + case MZ2_GUNNER_ETF_RIFLE_8: + dl->color[0] = 0.9;dl->color[1] = 0.7;dl->color[2] = 0; + S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("weapons/nail1.wav"), 1, ATTN_NORM, 0); + break; +// end Knightmare } } diff --git a/client/cl_main.c b/client/cl_main.c index a5cafbf..ffcf539 100644 --- a/client/cl_main.c +++ b/client/cl_main.c @@ -2482,8 +2482,8 @@ void CL_AdvertiseVersion (void) { char adBuf[128]; - Com_sprintf (adBuf, sizeof(adBuf), "say \"KMQuake2 %4.2f %s %s %s %s [www.markshan.com/knightmare]\"\n", - VERSION, CPUSTRING, OS_STRING, COMPILETYPE_STRING, __DATE__); + Com_sprintf (adBuf, sizeof(adBuf), "say \"KMQuake2 %4.2fu%d %s %s %s %s [www.markshan.com/knightmare]\"\n", + VERSION, VERSION_UPDATE, CPUSTRING, OS_STRING, COMPILETYPE_STRING, __DATE__); Cbuf_AddText (adBuf); cls.lastAdvertiseTime = cls.realtime; cls.advertiseTime = 0; diff --git a/client/cl_tempent.c b/client/cl_tempent.c index 8f1c9d9..3952406 100644 --- a/client/cl_tempent.c +++ b/client/cl_tempent.c @@ -794,6 +794,10 @@ void CL_ParseTEnt (void) type = MSG_ReadByte (&net_message); + // TODO: have index 255 as a flag to read a short for the real extended index +/* if (type == 255) + type = (unsigned short)MSG_ReadShort (&net_message); */ + switch (type) { case TE_BLOOD: // bullet hitting flesh @@ -904,7 +908,7 @@ void CL_ParseTEnt (void) else if (type == TE_RAILTRAIL2) { CL_RailTrail (pos, pos2, 255, 20, 20); } - else { + else { // 20, 48, 176 default CL_RailTrail (pos, pos2, cl_railred->integer, cl_railgreen->integer, cl_railblue->integer); } S_StartSound (pos2, 0, 0, clMedia.sfx_railg, 1, ATTN_NORM, 0); diff --git a/game/m_flash.c b/game/m_flash.c index 8ab7438..a3bc5c1 100644 --- a/game/m_flash.c +++ b/game/m_flash.c @@ -487,6 +487,45 @@ vec3_t monster_flash_offset [] = // MZ2_WIDOW2_BEAM_SWEEP_11 210 58.29, 27.11, 92.00, +// Knightmare added +// MZ2_SOLDIER_HYPERBLASTER_1 211 + 10.6 * 1.2, 7.7 * 1.2, 7.8 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_2 212 + 21.1 * 1.2, 3.6 * 1.2, 19.0 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_3 213 + 20.8 * 1.2, 10.1 * 1.2, -2.7 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_4 214 + 7.6 * 1.2, 9.3 * 1.2, 0.8 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_5 215 + 30.5 * 1.2, 9.9 * 1.2, -18.7 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_6 216 + 27.6 * 1.2, 3.4 * 1.2, -10.4 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_7 217 + 28.9 * 1.2, 4.6 * 1.2, -8.1 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_8 218 + 31.5 * 1.2, 9.6 * 1.2, 10.1 * 1.2, +// MZ2_GLADBETA_PHALANX_1 219 + 30.0, 18.0, 28.0, +// MZ2_TURRET_RAILGUN_1 220 + 16, 0, 0, +// MZ2_GUNNER_ETF_RIFLE_1 221 + 30.1 * 1.15, 3.9 * 1.15, 19.6 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_2 222 + 29.1 * 1.15, 2.5 * 1.15, 20.7 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_3 223 + 28.2 * 1.15, 2.5 * 1.15, 22.2 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_4 224 + 28.2 * 1.15, 3.6 * 1.15, 22.0 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_5 225 + 26.9 * 1.15, 2.0 * 1.15, 23.4 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_6 226 + 26.5 * 1.15, 0.6 * 1.15, 20.8 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_7 227 + 26.9 * 1.15, 0.5 * 1.15, 21.5 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_8 228 + 29.0 * 1.15, 2.4 * 1.15, 19.5 * 1.15, +// end Knightmare + // end of table 0.0, 0.0, 0.0 }; diff --git a/game/q_shared.h b/game/q_shared.h index cbc44c0..5ce65ff 100644 --- a/game/q_shared.h +++ b/game/q_shared.h @@ -982,6 +982,10 @@ typedef struct #define MZ_GREENHYPERBLASTER 41 #define MZ_REDBLASTER 42 #define MZ_REDHYPERBLASTER 43 + +#define MZ_SEND_SHORT 127 // send this value as a flag to read real index as a short + +#define MZ_SILENCED_HI 0x8000 // bit flag ORed with one of the above numbers for short index // end Knightmare @@ -1215,12 +1219,30 @@ typedef struct #define MZ2_WIDOW2_BEAM_SWEEP_9 208 #define MZ2_WIDOW2_BEAM_SWEEP_10 209 #define MZ2_WIDOW2_BEAM_SWEEP_11 210 - // ROGUE -//Mappack - new monster firing vectors -#define MZ2_SUPERTANK_GRENADE_1 211 -#define MZ2_SUPERTANK_GRENADE_2 212 +// Knightmare added +#define MZ2_SOLDIER_HYPERBLASTER_1 211 +#define MZ2_SOLDIER_HYPERBLASTER_2 212 +#define MZ2_SOLDIER_HYPERBLASTER_3 213 +#define MZ2_SOLDIER_HYPERBLASTER_4 214 +#define MZ2_SOLDIER_HYPERBLASTER_5 215 +#define MZ2_SOLDIER_HYPERBLASTER_6 216 +#define MZ2_SOLDIER_HYPERBLASTER_7 217 +#define MZ2_SOLDIER_HYPERBLASTER_8 218 +#define MZ2_GLADBETA_PHALANX_1 219 +#define MZ2_TURRET_RAILGUN_1 220 +#define MZ2_GUNNER_ETF_RIFLE_1 221 +#define MZ2_GUNNER_ETF_RIFLE_2 222 +#define MZ2_GUNNER_ETF_RIFLE_3 223 +#define MZ2_GUNNER_ETF_RIFLE_4 224 +#define MZ2_GUNNER_ETF_RIFLE_5 225 +#define MZ2_GUNNER_ETF_RIFLE_6 226 +#define MZ2_GUNNER_ETF_RIFLE_7 227 +#define MZ2_GUNNER_ETF_RIFLE_8 228 + +#define MZ2_SEND_SHORT 255 // send this value as a flag to read real index as a short +// end Knightmare extern vec3_t monster_flash_offset []; diff --git a/kmquake2_changelog.txt b/kmquake2_changelog.txt index a6fa6b6..ed4696e 100644 --- a/kmquake2_changelog.txt +++ b/kmquake2_changelog.txt @@ -28,6 +28,8 @@ Changes as of v0.20 update 8: - Added horizontal offset to third-person mode. Offset distance is controlled by cvar cg_thirdperson_offset. +- Added unique muzzleflashes for Hyperblaster Soldier and Beta-class Gladiator in The Reckoning and Railgun Turret in Ground Zero. + - Added separate cvars ui_font and scr_font for menu and screen fonts, respectively. Con_font now only changes the font in the console. diff --git a/missionpack/g_monster.c b/missionpack/g_monster.c index aefd357..eda368e 100644 --- a/missionpack/g_monster.c +++ b/missionpack/g_monster.c @@ -257,7 +257,7 @@ void monster_fire_blueblaster (edict_t *self, vec3_t start, vec3_t dir, int dama gi.WriteByte (svc_muzzleflash2); gi.WriteShort (self - g_edicts); - gi.WriteByte (MZ_BLUEHYPERBLASTER); + gi.WriteByte (flashtype); gi.multicast (start, MULTICAST_PVS); } @@ -422,11 +422,11 @@ void monster_fire_phalanx (edict_t *self, vec3_t start, vec3_t dir, int damage, fire_phalanx_plasma (self, start, dir, damage, speed, damage_radius, radius_damage); - // Don't actually send a muzzleflash here because Xatrix forgot to add one! -/* gi.WriteByte (svc_muzzleflash2); + // Sends new MZ2_GLADBETA_PHALANX_1 for KMQ2 builds, or MZ2_GLADIATOR_RAILGUN_1 for non-KMQ2 + gi.WriteByte (svc_muzzleflash2); gi.WriteShort (self - g_edicts); gi.WriteByte (flashtype); - gi.multicast (start, MULTICAST_PVS); */ + gi.multicast (start, MULTICAST_PVS); } // ROGUE diff --git a/missionpack/m_flash.c b/missionpack/m_flash.c index 8457639..37fac56 100644 --- a/missionpack/m_flash.c +++ b/missionpack/m_flash.c @@ -464,6 +464,45 @@ vec3_t monster_flash_offset [] = // MZ2_WIDOW2_BEAM_SWEEP_11 210 58.29, 27.11, 92.00, +// Knightmare added +// MZ2_SOLDIER_HYPERBLASTER_1 211 + 10.6 * 1.2, 7.7 * 1.2, 7.8 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_2 212 + 21.1 * 1.2, 3.6 * 1.2, 19.0 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_3 213 + 20.8 * 1.2, 10.1 * 1.2, -2.7 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_4 214 + 7.6 * 1.2, 9.3 * 1.2, 0.8 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_5 215 + 30.5 * 1.2, 9.9 * 1.2, -18.7 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_6 216 + 27.6 * 1.2, 3.4 * 1.2, -10.4 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_7 217 + 28.9 * 1.2, 4.6 * 1.2, -8.1 * 1.2, +// MZ2_SOLDIER_HYPERBLASTER_8 218 + 31.5 * 1.2, 9.6 * 1.2, 10.1 * 1.2, +// MZ2_GLADBETA_PHALANX_1 219 + 30.0, 18.0, 28.0, +// MZ2_TURRET_RAILGUN_1 220 + 16, 0, 0, +// MZ2_GUNNER_ETF_RIFLE_1 221 + 30.1 * 1.15, 3.9 * 1.15, 19.6 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_2 222 + 29.1 * 1.15, 2.5 * 1.15, 20.7 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_3 223 + 28.2 * 1.15, 2.5 * 1.15, 22.2 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_4 224 + 28.2 * 1.15, 3.6 * 1.15, 22.0 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_5 225 + 26.9 * 1.15, 2.0 * 1.15, 23.4 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_6 226 + 26.5 * 1.15, 0.6 * 1.15, 20.8 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_7 227 + 26.9 * 1.15, 0.5 * 1.15, 21.5 * 1.15, +// MZ2_GUNNER_ETF_RIFLE_8 228 + 29.0 * 1.15, 2.4 * 1.15, 19.5 * 1.15, +// end Knightmare + // end of table 0.0, 0.0, 0.0 }; diff --git a/missionpack/m_gladb.c b/missionpack/m_gladb.c index 1763c0b..c0551d6 100644 --- a/missionpack/m_gladb.c +++ b/missionpack/m_gladb.c @@ -169,7 +169,11 @@ void gladbGun (edict_t *self) VectorSubtract (self->pos1, start, dir); VectorNormalize (dir); +#ifdef KMQUAKE2_ENGINE_MOD + monster_fire_phalanx (self, start, dir, 100, 725, 60, 60, MZ2_GLADBETA_PHALANX_1); // new muzzleflash for KMQ2 +#else monster_fire_phalanx (self, start, dir, 100, 725, 60, 60, MZ2_GLADIATOR_RAILGUN_1); +#endif // KMQUAKE2_ENGINE_MOD } void gladbGun_check (edict_t *self) @@ -192,7 +196,7 @@ mframe_t gladb_frames_attack_gun [] = }; mmove_t gladb_move_attack_gun = {FRAME_attack1, FRAME_attack9, gladb_frames_attack_gun, gladb_run}; -void gladb_attack(edict_t *self) +void gladb_attack (edict_t *self) { float range; vec3_t v; @@ -205,7 +209,7 @@ void gladb_attack(edict_t *self) // charge up the railgun gi.sound (self, CHAN_WEAPON, sound_gun, 1, ATTN_NORM, 0); - VectorCopy (self->enemy->s.origin, self->pos1); //save for aiming the shot + VectorCopy (self->enemy->s.origin, self->pos1); // save for aiming the shot self->pos1[2] += self->enemy->viewheight; self->monsterinfo.currentmove = &gladb_move_attack_gun; } diff --git a/missionpack/m_soldier.c b/missionpack/m_soldier.c index b09dad8..9a04bad 100644 --- a/missionpack/m_soldier.c +++ b/missionpack/m_soldier.c @@ -494,6 +494,9 @@ void soldier_pain (edict_t *self, edict_t *other, float kick, int damage) static int blaster_flash [] = {MZ2_SOLDIER_BLASTER_1, MZ2_SOLDIER_BLASTER_2, MZ2_SOLDIER_BLASTER_3, MZ2_SOLDIER_BLASTER_4, MZ2_SOLDIER_BLASTER_5, MZ2_SOLDIER_BLASTER_6, MZ2_SOLDIER_BLASTER_7, MZ2_SOLDIER_BLASTER_8}; static int shotgun_flash [] = {MZ2_SOLDIER_SHOTGUN_1, MZ2_SOLDIER_SHOTGUN_2, MZ2_SOLDIER_SHOTGUN_3, MZ2_SOLDIER_SHOTGUN_4, MZ2_SOLDIER_SHOTGUN_5, MZ2_SOLDIER_SHOTGUN_6, MZ2_SOLDIER_SHOTGUN_7, MZ2_SOLDIER_SHOTGUN_8}; static int machinegun_flash [] = {MZ2_SOLDIER_MACHINEGUN_1, MZ2_SOLDIER_MACHINEGUN_2, MZ2_SOLDIER_MACHINEGUN_3, MZ2_SOLDIER_MACHINEGUN_4, MZ2_SOLDIER_MACHINEGUN_5, MZ2_SOLDIER_MACHINEGUN_6, MZ2_SOLDIER_MACHINEGUN_7, MZ2_SOLDIER_MACHINEGUN_8}; +#ifdef KMQUAKE2_ENGINE_MOD +static int hyperblaster_flash [] = {MZ2_SOLDIER_HYPERBLASTER_1, MZ2_SOLDIER_HYPERBLASTER_2, MZ2_SOLDIER_HYPERBLASTER_3, MZ2_SOLDIER_HYPERBLASTER_4, MZ2_SOLDIER_HYPERBLASTER_5, MZ2_SOLDIER_HYPERBLASTER_6, MZ2_SOLDIER_HYPERBLASTER_7, MZ2_SOLDIER_HYPERBLASTER_8}; +#endif // KMQUAKE2_ENGINE_MOD //void soldier_fire (edict_t *self, int flash_number) PMM void soldier_fire (edict_t *self, int in_flash_number) @@ -2098,8 +2101,12 @@ void soldierh_fire (edict_t *self, int flash_number) flash_index = blaster_flash[flash_number]; // ripper // else if ((self->s.skinnum % 6) < 4) else if (self->skinnum < 4) +#ifdef KMQUAKE2_ENGINE_MOD + flash_index = hyperblaster_flash[flash_number]; // hyperblaster +#else flash_index = blaster_flash[flash_number]; // hyperblaster - else +#endif // KMQUAKE2_ENGINE_MOD + else // if (self->skinnum < 6) flash_index = machinegun_flash[flash_number]; // laserbeam AngleVectors (self->s.angles, forward, right, NULL); @@ -2151,10 +2158,11 @@ void soldierh_fire (edict_t *self, int flash_number) // else if ((self->s.skinnum % 6) <= 3) else if (self->skinnum <= 3) { - // monster_fire_blaster (self, start, aim, 4, 600, MZ_BLUEHYPERBLASTER, EF_BLUEHYPERBLASTER, BLASTER_BLUE); - monster_fire_blueblaster (self, start, aim, 4, 600, MZ_BLUEHYPERBLASTER, EF_BLUEHYPERBLASTER); + // monster_fire_blaster (self, start, aim, 4, 600, flash_index, EF_BLUEHYPERBLASTER, BLASTER_BLUE); + // monster_fire_blueblaster (self, start, aim, 4, 600, MZ_BLUEHYPERBLASTER, EF_BLUEHYPERBLASTER); + monster_fire_blueblaster (self, start, aim, 4, 600, flash_index, EF_BLUEHYPERBLASTER); // Knightmare- use an actual monster muzzleflash here! } - else + else // if (self->skinnum <= 5) { if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME)) self->monsterinfo.pausetime = level.time + (3 + rand() % 8) * FRAMETIME; @@ -3434,7 +3442,13 @@ void SP_monster_soldier_hypergun (edict_t *self) gi.modelindex ("models/objects/blaser/tris.md2"); sound_pain = gi.soundindex ("soldier/solpain1.wav"); sound_death = gi.soundindex ("soldier/soldeth1.wav"); - gi.soundindex ("soldier/solatck1.wav"); + gi.soundindex ("weapons/hyprbl1a.wav"); // Knightmare- missing precache + gi.soundindex ("weapons/hyprbd1a.wav"); // Knightmare- missing precache +#ifdef KMQUAKE2_ENGINE_MOD + gi.soundindex ("weapons/hyprbf1a.wav"); // Knightmare- used by new muzzleflash +#else + gi.soundindex ("soldier/solatck2.wav"); // Knightmare- used by monster muzzle flash +#endif self->common_name = "Hyperblaster Guard"; self->class_id = ENTITY_MONSTER_SOLDIER_HYPERGUN; @@ -3447,6 +3461,7 @@ void SP_monster_soldier_hypergun (edict_t *self) // PMM - blindfire self->monsterinfo.blindfire = true; + // Knightmare- call generic spawn function LAST, because it // calls walkmonster_start, which the health and everything else need to be set up for SP_monster_soldier_h (self); @@ -3467,7 +3482,7 @@ void SP_monster_soldier_lasergun (edict_t *self) sound_pain_ss = gi.soundindex ("soldier/solpain3.wav"); sound_death_ss = gi.soundindex ("soldier/soldeth3.wav"); - gi.soundindex ("soldier/solatck3.wav"); +// gi.soundindex ("soldier/solatck3.wav"); // Knightmare- not used self->common_name = "Laser Guard"; self->class_id = ENTITY_MONSTER_SOLDIER_LASER; diff --git a/missionpack/m_turret.c b/missionpack/m_turret.c index 6d4fa0a..5f49d32 100644 --- a/missionpack/m_turret.c +++ b/missionpack/m_turret.c @@ -338,7 +338,11 @@ void Turret_Railgun_Fire (edict_t *self) VectorSubtract (self->aim_point, start, dir); VectorNormalize(dir); +#ifdef KMQUAKE2_ENGINE_MOD + monster_fire_railgun (self, start, dir, 50, 0, MZ2_TURRET_RAILGUN_1); // new muzzleflash for KMQ2 +#else monster_fire_railgun (self, start, dir, 50, 0, MZ2_GLADIATOR_RAILGUN_1); +#endif // KMQUAKE2_ENGINE_MOD self->think = monster_think; self->nextthink = level.time + FRAMETIME; @@ -470,10 +474,10 @@ void TurretFire (edict_t *self) if (trace.ent == self->enemy || trace.ent == world || (self->monsterinfo.visibility < FOG_CANSEEGOOD)) { if (self->spawnflags & SPAWN_BLASTER) - monster_fire_blaster(self, start, dir, 20, rocketSpeed, MZ2_TURRET_BLASTER, EF_BLASTER, BLASTER_ORANGE); - else if (self->spawnflags & SPAWN_RAILGUN && self->last_fire_time <= level.time) //was SPAWN_MACHINEGUN + monster_fire_blaster (self, start, dir, 20, rocketSpeed, MZ2_TURRET_BLASTER, EF_BLASTER, BLASTER_ORANGE); + else if (self->spawnflags & SPAWN_RAILGUN && self->last_fire_time <= level.time) // was SPAWN_MACHINEGUN { - //monster_fire_bullet (self, start, dir, TURRET_BULLET_DAMAGE, 0, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MZ2_TURRET_MACHINEGUN); + // monster_fire_bullet (self, start, dir, TURRET_BULLET_DAMAGE, 0, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MZ2_TURRET_MACHINEGUN); gi.sound (self, CHAN_WEAPON, gi.soundindex ("gladiator/railgun.wav"), 1, ATTN_NORM, 0); self->think = Turret_Railgun_Aim; self->nextthink = level.time + 2 * FRAMETIME; diff --git a/missionpack/q_shared.h b/missionpack/q_shared.h index ca905ba..50b4fb7 100644 --- a/missionpack/q_shared.h +++ b/missionpack/q_shared.h @@ -800,13 +800,17 @@ typedef struct #define MZ_NUKE2 37 #define MZ_NUKE4 38 #define MZ_NUKE8 39 +//ROGUE // Knightmare 1/3/2002- blue blaster and green hyperblaster #define MZ_BLUEBLASTER 40 #define MZ_GREENHYPERBLASTER 41 #define MZ_REDBLASTER 42 #define MZ_REDHYPERBLASTER 43 + +#define MZ_SEND_SHORT 127 // send this value as a flag to read real index as a short + +#define MZ_SILENCED_HI 0x8000 // bit flag ORed with one of the above numbers for short index // end Knightmare -//ROGUE // // monster muzzle flashes @@ -1038,12 +1042,30 @@ typedef struct #define MZ2_WIDOW2_BEAM_SWEEP_9 208 #define MZ2_WIDOW2_BEAM_SWEEP_10 209 #define MZ2_WIDOW2_BEAM_SWEEP_11 210 - // ROGUE -//Mappack - new monster firing vectors -#define MZ2_SUPERTANK_GRENADE_1 211 -#define MZ2_SUPERTANK_GRENADE_2 212 +// Knightmare added +#define MZ2_SOLDIER_HYPERBLASTER_1 211 +#define MZ2_SOLDIER_HYPERBLASTER_2 212 +#define MZ2_SOLDIER_HYPERBLASTER_3 213 +#define MZ2_SOLDIER_HYPERBLASTER_4 214 +#define MZ2_SOLDIER_HYPERBLASTER_5 215 +#define MZ2_SOLDIER_HYPERBLASTER_6 216 +#define MZ2_SOLDIER_HYPERBLASTER_7 217 +#define MZ2_SOLDIER_HYPERBLASTER_8 218 +#define MZ2_GLADBETA_PHALANX_1 219 +#define MZ2_TURRET_RAILGUN_1 220 +#define MZ2_GUNNER_ETF_RIFLE_1 221 +#define MZ2_GUNNER_ETF_RIFLE_2 222 +#define MZ2_GUNNER_ETF_RIFLE_3 223 +#define MZ2_GUNNER_ETF_RIFLE_4 224 +#define MZ2_GUNNER_ETF_RIFLE_5 225 +#define MZ2_GUNNER_ETF_RIFLE_6 226 +#define MZ2_GUNNER_ETF_RIFLE_7 227 +#define MZ2_GUNNER_ETF_RIFLE_8 228 + +#define MZ2_SEND_SHORT 255 // send this value as a flag to read real index as a short +// end Knightmare extern vec3_t monster_flash_offset []; diff --git a/qcommon/cmodel.c b/qcommon/cmodel.c index 97cd662..d2f03ba 100644 --- a/qcommon/cmodel.c +++ b/qcommon/cmodel.c @@ -532,13 +532,16 @@ CMod_LoadEntityString */ void CMod_LoadEntityString (lump_t *l, char *name) { + int nameLen; + + nameLen = (int)strlen(name); + // Knightmare- .ent file support -// if (sv_entfile->value) - if (sv_entfile->integer) + if ( (nameLen >= 5) && sv_entfile->integer ) { char s[MAX_QPATH]; char *buffer = NULL; - int nameLen, bufLen; + int bufLen; nameLen = (int)strlen(name); Q_strncpyz (s, sizeof(s), name); diff --git a/renderer/r_image.c b/renderer/r_image.c index 74c6b0f..1e7e222 100644 --- a/renderer/r_image.c +++ b/renderer/r_image.c @@ -2151,9 +2151,9 @@ image_t *R_LoadPic (char *name, byte *pic, int width, int height, imagetype_t ty // Load .pcx for size refereence, check if we have a tga/jpg/png pic #ifdef PNG_SUPPORT - if ( ((type == it_pic) || (type == it_font)) && (!strcmp(refName+nameLen-4, ".tga") || !strcmp(refName+nameLen-4, ".png") || !strcmp(refName+nameLen-4, ".jpg")) ) + if ( (nameLen >= 5) && ((type == it_pic) || (type == it_font)) && (!strcmp(refName+nameLen-4, ".tga") || !strcmp(refName+nameLen-4, ".png") || !strcmp(refName+nameLen-4, ".jpg")) ) #else // PNG_SUPPORT - if ( ((type == it_pic) || (type == it_font)) && (!strcmp(refName+nameLen-4, ".tga") || !strcmp(refName+nameLen-4, ".jpg")) ) + if ( (nameLen >= 5) && ((type == it_pic) || (type == it_font)) && (!strcmp(refName+nameLen-4, ".tga") || !strcmp(refName+nameLen-4, ".jpg")) ) #endif // PNG_SUPPORT { byte *pic, *palette; diff --git a/renderer/r_model.c b/renderer/r_model.c index 4171b3b..3919470 100644 --- a/renderer/r_model.c +++ b/renderer/r_model.c @@ -2750,7 +2750,7 @@ R_RegisterModel struct model_s *R_RegisterModel (char *name) { model_t *mod; - int i; + int i, nameLen; dspr2_t *sprout; #ifndef MD2_AS_MD3 // Knightmare- no longer used! dmd2_t *pheader; @@ -2760,13 +2760,13 @@ struct model_s *R_RegisterModel (char *name) // Harven-- MD3 // Knightmare- MD3 autoreplace code - int len = (int)strlen(name); - if (!strcmp(name+len-4, ".md2")) // look if we have a .md2 file + nameLen = (int)strlen(name); + if ( (nameLen >= 5) && !strcmp(name+nameLen-4, ".md2") ) // look if we have a .md2 file { char s[128]; // strncpy(s,name); Q_strncpyz (s, sizeof(s), name); - s[len-1]='3'; + s[nameLen-1]='3'; mod = R_RegisterModel (s); if (mod) return mod;