diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index 82de9d0ce..01941db93 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -1520,7 +1520,7 @@ void CL_LinkPacketEntities (void) } if (model->particletrail>=0) - R_RocketTrail (old_origin, ent->origin, model->particletrail, &cl.lerpents[s1->number].trailstate); + P_ParticleTrail (old_origin, ent->origin, model->particletrail, &cl.lerpents[s1->number].trailstate); //dlights are not so customisable. if (r_rocketlight.value) diff --git a/engine/client/cl_input.c b/engine/client/cl_input.c index ec9b655a2..c5cffed7d 100644 --- a/engine/client/cl_input.c +++ b/engine/client/cl_input.c @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "winquake.h" //fps indep stuff. #endif -float in_sensitivityscale; +float in_sensitivityscale = 1; cvar_t cl_nodelta = {"cl_nodelta","0"}; diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 361cb338f..23d33cc1f 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -1241,7 +1241,7 @@ void CL_CheckServerInfo(void) ================== CL_FullServerinfo_f -Sent by server when serverinfo changes +Sent by server just after the svc_serverdata ================== */ void CL_FullServerinfo_f (void) @@ -1272,6 +1272,16 @@ void CL_FullServerinfo_f (void) } } CL_CheckServerInfo(); + +#ifdef CSQC_DAT + p = Info_ValueForKey(cl.serverinfo, "*csprogs"); + if (*p) //only allow csqc if the server says so, and the 'checksum' matches. + { + unsigned int chksum = strtoul(p, NULL, 0); + if (CSQC_Init(chksum)) + CL_SendClientCommand("enablecsqc"); + } +#endif } /* diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index b138a5b69..81a3adc85 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -25,295 +25,6 @@ void CL_GetNumberedEntityInfo (int num, float *org, float *ang); void CLNQ_ParseDarkPlaces5Entities(void); void CL_SetStat (int pnum, int stat, int value); -void R_ParseParticleEffect2 (void); -void R_ParseParticleEffect3 (void); -void R_ParseParticleEffect4 (void); - -#define Q2SND_VOLUME (1<<0) // a qbyte -#define Q2SND_ATTENUATION (1<<1) // a qbyte -#define Q2SND_POS (1<<2) // three coordinates -#define Q2SND_ENT (1<<3) // a short 0-2: channel, 3-12: entity -#define Q2SND_OFFSET (1<<4) // a qbyte, msec offset from frame start - -#define Q2DEFAULT_SOUND_PACKET_VOLUME 1.0 -#define Q2DEFAULT_SOUND_PACKET_ATTENUATION 1.0 - - -#define ATTN_NONE 0 -#define ATTN_NORM 1 -#define CHAN_AUTO 0 -#define CHAN_WEAPON 1 -#define CHAN_VOICE 2 -#define CHAN_ITEM 3 -#define CHAN_BODY 4 - -#define Q2MZ_BLASTER 0 -#define Q2MZ_MACHINEGUN 1 -#define Q2MZ_SHOTGUN 2 -#define Q2MZ_CHAINGUN1 3 -#define Q2MZ_CHAINGUN2 4 -#define Q2MZ_CHAINGUN3 5 -#define Q2MZ_RAILGUN 6 -#define Q2MZ_ROCKET 7 -#define Q2MZ_GRENADE 8 -#define Q2MZ_LOGIN 9 -#define Q2MZ_LOGOUT 10 -#define Q2MZ_RESPAWN 11 -#define Q2MZ_BFG 12 -#define Q2MZ_SSHOTGUN 13 -#define Q2MZ_HYPERBLASTER 14 -#define Q2MZ_ITEMRESPAWN 15 -// RAFAEL -#define Q2MZ_IONRIPPER 16 -#define Q2MZ_BLUEHYPERBLASTER 17 -#define Q2MZ_PHALANX 18 -#define Q2MZ_SILENCED 128 // bit flag ORed with one of the above numbers - -//ROGUE -#define Q2MZ_ETF_RIFLE 30 -#define Q2MZ_UNUSED 31 -#define Q2MZ_SHOTGUN2 32 -#define Q2MZ_HEATBEAM 33 -#define Q2MZ_BLASTER2 34 -#define Q2MZ_TRACKER 35 -#define Q2MZ_NUKE1 36 -#define Q2MZ_NUKE2 37 -#define Q2MZ_NUKE4 38 -#define Q2MZ_NUKE8 39 -//ROGUE - -// -// monster muzzle flashes -// -#define Q2MZ2_TANK_BLASTER_1 1 -#define Q2MZ2_TANK_BLASTER_2 2 -#define Q2MZ2_TANK_BLASTER_3 3 -#define Q2MZ2_TANK_MACHINEGUN_1 4 -#define Q2MZ2_TANK_MACHINEGUN_2 5 -#define Q2MZ2_TANK_MACHINEGUN_3 6 -#define Q2MZ2_TANK_MACHINEGUN_4 7 -#define Q2MZ2_TANK_MACHINEGUN_5 8 -#define Q2MZ2_TANK_MACHINEGUN_6 9 -#define Q2MZ2_TANK_MACHINEGUN_7 10 -#define Q2MZ2_TANK_MACHINEGUN_8 11 -#define Q2MZ2_TANK_MACHINEGUN_9 12 -#define Q2MZ2_TANK_MACHINEGUN_10 13 -#define Q2MZ2_TANK_MACHINEGUN_11 14 -#define Q2MZ2_TANK_MACHINEGUN_12 15 -#define Q2MZ2_TANK_MACHINEGUN_13 16 -#define Q2MZ2_TANK_MACHINEGUN_14 17 -#define Q2MZ2_TANK_MACHINEGUN_15 18 -#define Q2MZ2_TANK_MACHINEGUN_16 19 -#define Q2MZ2_TANK_MACHINEGUN_17 20 -#define Q2MZ2_TANK_MACHINEGUN_18 21 -#define Q2MZ2_TANK_MACHINEGUN_19 22 -#define Q2MZ2_TANK_ROCKET_1 23 -#define Q2MZ2_TANK_ROCKET_2 24 -#define Q2MZ2_TANK_ROCKET_3 25 - -#define Q2MZ2_INFANTRY_MACHINEGUN_1 26 -#define Q2MZ2_INFANTRY_MACHINEGUN_2 27 -#define Q2MZ2_INFANTRY_MACHINEGUN_3 28 -#define Q2MZ2_INFANTRY_MACHINEGUN_4 29 -#define Q2MZ2_INFANTRY_MACHINEGUN_5 30 -#define Q2MZ2_INFANTRY_MACHINEGUN_6 31 -#define Q2MZ2_INFANTRY_MACHINEGUN_7 32 -#define Q2MZ2_INFANTRY_MACHINEGUN_8 33 -#define Q2MZ2_INFANTRY_MACHINEGUN_9 34 -#define Q2MZ2_INFANTRY_MACHINEGUN_10 35 -#define Q2MZ2_INFANTRY_MACHINEGUN_11 36 -#define Q2MZ2_INFANTRY_MACHINEGUN_12 37 -#define Q2MZ2_INFANTRY_MACHINEGUN_13 38 - -#define Q2MZ2_SOLDIER_BLASTER_1 39 -#define Q2MZ2_SOLDIER_BLASTER_2 40 -#define Q2MZ2_SOLDIER_SHOTGUN_1 41 -#define Q2MZ2_SOLDIER_SHOTGUN_2 42 -#define Q2MZ2_SOLDIER_MACHINEGUN_1 43 -#define Q2MZ2_SOLDIER_MACHINEGUN_2 44 - -#define Q2MZ2_GUNNER_MACHINEGUN_1 45 -#define Q2MZ2_GUNNER_MACHINEGUN_2 46 -#define Q2MZ2_GUNNER_MACHINEGUN_3 47 -#define Q2MZ2_GUNNER_MACHINEGUN_4 48 -#define Q2MZ2_GUNNER_MACHINEGUN_5 49 -#define Q2MZ2_GUNNER_MACHINEGUN_6 50 -#define Q2MZ2_GUNNER_MACHINEGUN_7 51 -#define Q2MZ2_GUNNER_MACHINEGUN_8 52 -#define Q2MZ2_GUNNER_GRENADE_1 53 -#define Q2MZ2_GUNNER_GRENADE_2 54 -#define Q2MZ2_GUNNER_GRENADE_3 55 -#define Q2MZ2_GUNNER_GRENADE_4 56 - -#define Q2MZ2_CHICK_ROCKET_1 57 - -#define Q2MZ2_FLYER_BLASTER_1 58 -#define Q2MZ2_FLYER_BLASTER_2 59 - -#define Q2MZ2_MEDIC_BLASTER_1 60 - -#define Q2MZ2_GLADIATOR_RAILGUN_1 61 - -#define Q2MZ2_HOVER_BLASTER_1 62 - -#define Q2MZ2_ACTOR_MACHINEGUN_1 63 - -#define Q2MZ2_SUPERTANK_MACHINEGUN_1 64 -#define Q2MZ2_SUPERTANK_MACHINEGUN_2 65 -#define Q2MZ2_SUPERTANK_MACHINEGUN_3 66 -#define Q2MZ2_SUPERTANK_MACHINEGUN_4 67 -#define Q2MZ2_SUPERTANK_MACHINEGUN_5 68 -#define Q2MZ2_SUPERTANK_MACHINEGUN_6 69 -#define Q2MZ2_SUPERTANK_ROCKET_1 70 -#define Q2MZ2_SUPERTANK_ROCKET_2 71 -#define Q2MZ2_SUPERTANK_ROCKET_3 72 - -#define Q2MZ2_BOSS2_MACHINEGUN_L1 73 -#define Q2MZ2_BOSS2_MACHINEGUN_L2 74 -#define Q2MZ2_BOSS2_MACHINEGUN_L3 75 -#define Q2MZ2_BOSS2_MACHINEGUN_L4 76 -#define Q2MZ2_BOSS2_MACHINEGUN_L5 77 -#define Q2MZ2_BOSS2_ROCKET_1 78 -#define Q2MZ2_BOSS2_ROCKET_2 79 -#define Q2MZ2_BOSS2_ROCKET_3 80 -#define Q2MZ2_BOSS2_ROCKET_4 81 - -#define Q2MZ2_FLOAT_BLASTER_1 82 - -#define Q2MZ2_SOLDIER_BLASTER_3 83 -#define Q2MZ2_SOLDIER_SHOTGUN_3 84 -#define Q2MZ2_SOLDIER_MACHINEGUN_3 85 -#define Q2MZ2_SOLDIER_BLASTER_4 86 -#define Q2MZ2_SOLDIER_SHOTGUN_4 87 -#define Q2MZ2_SOLDIER_MACHINEGUN_4 88 -#define Q2MZ2_SOLDIER_BLASTER_5 89 -#define Q2MZ2_SOLDIER_SHOTGUN_5 90 -#define Q2MZ2_SOLDIER_MACHINEGUN_5 91 -#define Q2MZ2_SOLDIER_BLASTER_6 92 -#define Q2MZ2_SOLDIER_SHOTGUN_6 93 -#define Q2MZ2_SOLDIER_MACHINEGUN_6 94 -#define Q2MZ2_SOLDIER_BLASTER_7 95 -#define Q2MZ2_SOLDIER_SHOTGUN_7 96 -#define Q2MZ2_SOLDIER_MACHINEGUN_7 97 -#define Q2MZ2_SOLDIER_BLASTER_8 98 -#define Q2MZ2_SOLDIER_SHOTGUN_8 99 -#define Q2MZ2_SOLDIER_MACHINEGUN_8 100 - -// --- Xian shit below --- -#define Q2MZ2_MAKRON_BFG 101 -#define Q2MZ2_MAKRON_BLASTER_1 102 -#define Q2MZ2_MAKRON_BLASTER_2 103 -#define Q2MZ2_MAKRON_BLASTER_3 104 -#define Q2MZ2_MAKRON_BLASTER_4 105 -#define Q2MZ2_MAKRON_BLASTER_5 106 -#define Q2MZ2_MAKRON_BLASTER_6 107 -#define Q2MZ2_MAKRON_BLASTER_7 108 -#define Q2MZ2_MAKRON_BLASTER_8 109 -#define Q2MZ2_MAKRON_BLASTER_9 110 -#define Q2MZ2_MAKRON_BLASTER_10 111 -#define Q2MZ2_MAKRON_BLASTER_11 112 -#define Q2MZ2_MAKRON_BLASTER_12 113 -#define Q2MZ2_MAKRON_BLASTER_13 114 -#define Q2MZ2_MAKRON_BLASTER_14 115 -#define Q2MZ2_MAKRON_BLASTER_15 116 -#define Q2MZ2_MAKRON_BLASTER_16 117 -#define Q2MZ2_MAKRON_BLASTER_17 118 -#define Q2MZ2_MAKRON_RAILGUN_1 119 -#define Q2MZ2_JORG_MACHINEGUN_L1 120 -#define Q2MZ2_JORG_MACHINEGUN_L2 121 -#define Q2MZ2_JORG_MACHINEGUN_L3 122 -#define Q2MZ2_JORG_MACHINEGUN_L4 123 -#define Q2MZ2_JORG_MACHINEGUN_L5 124 -#define Q2MZ2_JORG_MACHINEGUN_L6 125 -#define Q2MZ2_JORG_MACHINEGUN_R1 126 -#define Q2MZ2_JORG_MACHINEGUN_R2 127 -#define Q2MZ2_JORG_MACHINEGUN_R3 128 -#define Q2MZ2_JORG_MACHINEGUN_R4 129 -#define Q2MZ2_JORG_MACHINEGUN_R5 130 -#define Q2MZ2_JORG_MACHINEGUN_R6 131 -#define Q2MZ2_JORG_BFG_1 132 -#define Q2MZ2_BOSS2_MACHINEGUN_R1 133 -#define Q2MZ2_BOSS2_MACHINEGUN_R2 134 -#define Q2MZ2_BOSS2_MACHINEGUN_R3 135 -#define Q2MZ2_BOSS2_MACHINEGUN_R4 136 -#define Q2MZ2_BOSS2_MACHINEGUN_R5 137 - -//ROGUE -#define Q2MZ2_CARRIER_MACHINEGUN_L1 138 -#define Q2MZ2_CARRIER_MACHINEGUN_R1 139 -#define Q2MZ2_CARRIER_GRENADE 140 -#define Q2MZ2_TURRET_MACHINEGUN 141 -#define Q2MZ2_TURRET_ROCKET 142 -#define Q2MZ2_TURRET_BLASTER 143 -#define Q2MZ2_STALKER_BLASTER 144 -#define Q2MZ2_DAEDALUS_BLASTER 145 -#define Q2MZ2_MEDIC_BLASTER_2 146 -#define Q2MZ2_CARRIER_RAILGUN 147 -#define Q2MZ2_WIDOW_DISRUPTOR 148 -#define Q2MZ2_WIDOW_BLASTER 149 -#define Q2MZ2_WIDOW_RAIL 150 -#define Q2MZ2_WIDOW_PLASMABEAM 151 // PMM - not used -#define Q2MZ2_CARRIER_MACHINEGUN_L2 152 -#define Q2MZ2_CARRIER_MACHINEGUN_R2 153 -#define Q2MZ2_WIDOW_RAIL_LEFT 154 -#define Q2MZ2_WIDOW_RAIL_RIGHT 155 -#define Q2MZ2_WIDOW_BLASTER_SWEEP1 156 -#define Q2MZ2_WIDOW_BLASTER_SWEEP2 157 -#define Q2MZ2_WIDOW_BLASTER_SWEEP3 158 -#define Q2MZ2_WIDOW_BLASTER_SWEEP4 159 -#define Q2MZ2_WIDOW_BLASTER_SWEEP5 160 -#define Q2MZ2_WIDOW_BLASTER_SWEEP6 161 -#define Q2MZ2_WIDOW_BLASTER_SWEEP7 162 -#define Q2MZ2_WIDOW_BLASTER_SWEEP8 163 -#define Q2MZ2_WIDOW_BLASTER_SWEEP9 164 -#define Q2MZ2_WIDOW_BLASTER_100 165 -#define Q2MZ2_WIDOW_BLASTER_90 166 -#define Q2MZ2_WIDOW_BLASTER_80 167 -#define Q2MZ2_WIDOW_BLASTER_70 168 -#define Q2MZ2_WIDOW_BLASTER_60 169 -#define Q2MZ2_WIDOW_BLASTER_50 170 -#define Q2MZ2_WIDOW_BLASTER_40 171 -#define Q2MZ2_WIDOW_BLASTER_30 172 -#define Q2MZ2_WIDOW_BLASTER_20 173 -#define Q2MZ2_WIDOW_BLASTER_10 174 -#define Q2MZ2_WIDOW_BLASTER_0 175 -#define Q2MZ2_WIDOW_BLASTER_10L 176 -#define Q2MZ2_WIDOW_BLASTER_20L 177 -#define Q2MZ2_WIDOW_BLASTER_30L 178 -#define Q2MZ2_WIDOW_BLASTER_40L 179 -#define Q2MZ2_WIDOW_BLASTER_50L 180 -#define Q2MZ2_WIDOW_BLASTER_60L 181 -#define Q2MZ2_WIDOW_BLASTER_70L 182 -#define Q2MZ2_WIDOW_RUN_1 183 -#define Q2MZ2_WIDOW_RUN_2 184 -#define Q2MZ2_WIDOW_RUN_3 185 -#define Q2MZ2_WIDOW_RUN_4 186 -#define Q2MZ2_WIDOW_RUN_5 187 -#define Q2MZ2_WIDOW_RUN_6 188 -#define Q2MZ2_WIDOW_RUN_7 189 -#define Q2MZ2_WIDOW_RUN_8 190 -#define Q2MZ2_CARRIER_ROCKET_1 191 -#define Q2MZ2_CARRIER_ROCKET_2 192 -#define Q2MZ2_CARRIER_ROCKET_3 193 -#define Q2MZ2_CARRIER_ROCKET_4 194 -#define Q2MZ2_WIDOW2_BEAMER_1 195 -#define Q2MZ2_WIDOW2_BEAMER_2 196 -#define Q2MZ2_WIDOW2_BEAMER_3 197 -#define Q2MZ2_WIDOW2_BEAMER_4 198 -#define Q2MZ2_WIDOW2_BEAMER_5 199 -#define Q2MZ2_WIDOW2_BEAM_SWEEP_1 200 -#define Q2MZ2_WIDOW2_BEAM_SWEEP_2 201 -#define Q2MZ2_WIDOW2_BEAM_SWEEP_3 202 -#define Q2MZ2_WIDOW2_BEAM_SWEEP_4 203 -#define Q2MZ2_WIDOW2_BEAM_SWEEP_5 204 -#define Q2MZ2_WIDOW2_BEAM_SWEEP_6 205 -#define Q2MZ2_WIDOW2_BEAM_SWEEP_7 206 -#define Q2MZ2_WIDOW2_BEAM_SWEEP_8 207 -#define Q2MZ2_WIDOW2_BEAM_SWEEP_9 208 -#define Q2MZ2_WIDOW2_BEAM_SWEEP_10 209 -#define Q2MZ2_WIDOW2_BEAM_SWEEP_11 210 - - int nq_dp_protocol; @@ -1513,7 +1224,7 @@ void CL_ParseServerData (void) } CL_ClearState (); - R_Part_NewServer(); + P_NewServer(); Stats_NewMap(); cl.servercount = svcnt; @@ -1616,7 +1327,7 @@ void CL_ParseServerData (void) CG_Stop(); #endif #ifdef CSQC_DAT - CSQC_Shutdown(); + CSQC_Shutdown(); //revive it when we get the serverinfo saying the checksum. #endif } @@ -1869,9 +1580,6 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon); Cache_Report (); // print remaining memory #ifdef VM_CG CG_Start(); -#endif -#ifdef CSQC_DAT - CSQC_Init(); #endif break; @@ -3940,16 +3648,16 @@ void CL_ParseServerMessage (void) break; case svc_particle: - NQ_R_ParseParticleEffect (); + CLNQ_ParseParticleEffect (); break; case svc_particle2: - R_ParseParticleEffect2 (); + CL_ParseParticleEffect2 (); break; case svc_particle3: - R_ParseParticleEffect3 (); + CL_ParseParticleEffect3 (); break; case svc_particle4: - R_ParseParticleEffect4 (); + CL_ParseParticleEffect4 (); break; case svc_killedmonster: @@ -4568,7 +4276,7 @@ void CLNQ_ParseServerMessage (void) break; case svc_particle: - NQ_R_ParseParticleEffect (); + CLNQ_ParseParticleEffect (); break; case svc_killedmonster: diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index e82028c96..c303e409c 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -530,8 +530,8 @@ void CL_ParseTEnt (void) R_AddStain(pos, -10, 0, -10, 20); - if (R_RunParticleEffectType(pos, NULL, 1, pt_wizspike)) - R_RunParticleEffect (pos, vec3_origin, 20, 30); + if (P_RunParticleEffectType(pos, NULL, 1, pt_wizspike)) + P_RunParticleEffect (pos, vec3_origin, 20, 30); S_StartSound (-2, 0, cl_sfx_wizhit, pos, 1, 1); break; @@ -543,8 +543,8 @@ void CL_ParseTEnt (void) R_AddStain(pos, -10, -10, -10, 20); - if (R_RunParticleEffectType(pos, NULL, 1, pt_knightspike)) - R_RunParticleEffect (pos, vec3_origin, 226, 20); + if (P_RunParticleEffectType(pos, NULL, 1, pt_knightspike)) + P_RunParticleEffect (pos, vec3_origin, 226, 20); S_StartSound (-2, 0, cl_sfx_knighthit, pos, 1, 1); break; @@ -557,9 +557,9 @@ void CL_ParseTEnt (void) R_AddStain(pos, -10, -10, -10, 20); R_AddDecals(pos); - if (R_RunParticleEffectType(pos, NULL, 1, pt_spike)) - if (R_RunParticleEffectType(pos, NULL, 10, pt_gunshot)) - R_RunParticleEffect (pos, vec3_origin, 0, 10); + if (P_RunParticleEffectType(pos, NULL, 1, pt_spike)) + if (P_RunParticleEffectType(pos, NULL, 10, pt_gunshot)) + P_RunParticleEffect (pos, vec3_origin, 0, 10); if ( rand() % 5 ) S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1); @@ -582,10 +582,10 @@ void CL_ParseTEnt (void) R_AddStain(pos, -10, -10, -10, 20); R_AddDecals(pos); - if (R_RunParticleEffectType(pos, NULL, 1, pt_superspike)) - if (R_RunParticleEffectType(pos, NULL, 2, pt_spike)) - if (R_RunParticleEffectType(pos, NULL, 20, pt_gunshot)) - R_RunParticleEffect (pos, vec3_origin, 0, 20); + if (P_RunParticleEffectType(pos, NULL, 1, pt_superspike)) + if (P_RunParticleEffectType(pos, NULL, 2, pt_spike)) + if (P_RunParticleEffectType(pos, NULL, 20, pt_gunshot)) + P_RunParticleEffect (pos, vec3_origin, 0, 20); if ( rand() % 5 ) S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1); @@ -612,9 +612,9 @@ void CL_ParseTEnt (void) R_AddStain(pos, -10, -10, -10, 20); R_AddDecals(pos); - if (R_RunParticleEffectType(pos, NULL, 1, pt_bullet)) - if (R_RunParticleEffectType(pos, NULL, 10, pt_gunshot)) - R_RunParticleEffect (pos, vec3_origin, 0, 10); + if (P_RunParticleEffectType(pos, NULL, 1, pt_bullet)) + if (P_RunParticleEffectType(pos, NULL, 10, pt_gunshot)) + P_RunParticleEffect (pos, vec3_origin, 0, 10); if ( rand() % 5 ) S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1); @@ -637,10 +637,10 @@ void CL_ParseTEnt (void) R_AddStain(pos, -10, -10, -10, 20); R_AddDecals(pos); - if (R_RunParticleEffectType(pos, NULL, 1, pt_superbullet)) - if (R_RunParticleEffectType(pos, NULL, 2, pt_bullet)) - if (R_RunParticleEffectType(pos, NULL, 20, pt_gunshot)) - R_RunParticleEffect (pos, vec3_origin, 0, 20); + if (P_RunParticleEffectType(pos, NULL, 1, pt_superbullet)) + if (P_RunParticleEffectType(pos, NULL, 2, pt_bullet)) + if (P_RunParticleEffectType(pos, NULL, 20, pt_gunshot)) + P_RunParticleEffect (pos, vec3_origin, 0, 20); if ( rand() % 5 ) S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1); @@ -662,7 +662,7 @@ void CL_ParseTEnt (void) pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); - R_ParticleExplosion (pos); + P_ParticleExplosion (pos); // light dl = CL_AllocDlight (0); @@ -697,7 +697,7 @@ void CL_ParseTEnt (void) pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); - R_BlobExplosion (pos); + P_BlobExplosion (pos); S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1); break; @@ -714,14 +714,14 @@ void CL_ParseTEnt (void) pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); - R_LavaSplash (pos); + P_LavaSplash (pos); break; case TE_TELEPORT: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); - R_TeleportSplash (pos); + P_TeleportSplash (pos); break; case TE_GUNSHOT: // bullet hitting wall @@ -735,8 +735,8 @@ void CL_ParseTEnt (void) R_AddStain(pos, -10, -10, -10, 20); - if (R_RunParticleEffectType(pos, NULL, cnt, pt_gunshot)) - R_RunParticleEffect (pos, vec3_origin, 0, 20*cnt); + if (P_RunParticleEffectType(pos, NULL, cnt, pt_gunshot)) + P_RunParticleEffect (pos, vec3_origin, 0, 20*cnt); break; @@ -748,8 +748,8 @@ void CL_ParseTEnt (void) R_AddStain(pos, 0, -10, -10, 40); - if (R_RunParticleEffectType(pos, NULL, cnt, pt_blood)) - R_RunParticleEffect (pos, vec3_origin, 73, 20*cnt); + if (P_RunParticleEffectType(pos, NULL, cnt, pt_blood)) + P_RunParticleEffect (pos, vec3_origin, 73, 20*cnt); break; @@ -760,8 +760,8 @@ void CL_ParseTEnt (void) R_AddStain(pos, 1, -10, -10, 20); - if (R_RunParticleEffectType(pos, NULL, 1, pt_lightningblood)) - R_RunParticleEffect (pos, vec3_origin, 225, 50); + if (P_RunParticleEffectType(pos, NULL, 1, pt_lightningblood)) + P_RunParticleEffect (pos, vec3_origin, 225, 50); break; @@ -806,7 +806,7 @@ void CL_ParseTEnt (void) cnt = MSG_ReadByte (); { extern int pt_spark; - R_RunParticleEffectType(pos, pos2, cnt, pt_blood); + P_RunParticleEffectType(pos, pos2, cnt, pt_blood); } break; @@ -822,7 +822,7 @@ void CL_ParseTEnt (void) cnt = MSG_ReadByte (); { extern int pt_spark; - R_RunParticleEffectType(pos, pos2, cnt, pt_spark); + P_RunParticleEffectType(pos, pos2, cnt, pt_spark); } break; @@ -862,7 +862,7 @@ pos2[1] = MSG_ReadCoord (); pos2[2] = MSG_ReadCoord (); cnt = MSG_ReadByte (); -R_ParticleExplosion (pos); +P_ParticleExplosion (pos); break; case 75://TE_PLASMABURN @@ -871,7 +871,7 @@ pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); -R_ParticleExplosion (pos); +P_ParticleExplosion (pos); break; case 76: @@ -906,7 +906,7 @@ cnt = MSG_ReadByte (); { extern int pt_plasma; - R_RunParticleEffectType(pos, pos2, cnt, pt_plasma); + P_RunParticleEffectType(pos, pos2, cnt, pt_plasma); } break; @@ -955,7 +955,7 @@ void CL_ParseCustomTEnt(void) t->netstyle = MSG_ReadByte(); str = MSG_ReadString(); - t->particleeffecttype = AllocateParticleType(str); + t->particleeffecttype = P_AllocateParticleType(str); if (t->netstyle & CTE_STAINS) { @@ -993,7 +993,7 @@ void CL_ParseCustomTEnt(void) { MSG_ReadPos (pos); MSG_ReadPos (pos2); - R_RocketTrail(pos, pos2, t->particleeffecttype, NULL); + P_ParticleTrail(pos, pos2, t->particleeffecttype, NULL); } else { @@ -1008,9 +1008,9 @@ void CL_ParseCustomTEnt(void) if (t->netstyle & CTE_CUSTOMDIRECTION) { MSG_ReadDir (dir); - R_RunParticleEffectType(pos, dir, 1, t->particleeffecttype); + P_RunParticleEffectType(pos, dir, 1, t->particleeffecttype); } - else R_RunParticleEffectType(pos, NULL, 1, t->particleeffecttype); + else P_RunParticleEffectType(pos, NULL, 1, t->particleeffecttype); } if (t->netstyle & CTE_STAINS) @@ -1062,7 +1062,7 @@ void CL_ClearCustomTEnts(void) customtenttype[i].particleeffecttype = -1; } -void NQ_R_ParseParticleEffect (void) +void CLNQ_ParseParticleEffect (void) { vec3_t org, dir; int i, count, msgcount, color; @@ -1079,9 +1079,9 @@ void NQ_R_ParseParticleEffect (void) else count = msgcount; - R_RunParticleEffect (org, dir, color, count); + P_RunParticleEffect (org, dir, color, count); } -void R_ParseParticleEffect2 (void) +void CL_ParseParticleEffect2 (void) { vec3_t org, dmin, dmax; int i, msgcount, color, effect; @@ -1096,9 +1096,9 @@ void R_ParseParticleEffect2 (void) msgcount = MSG_ReadByte (); effect = MSG_ReadByte (); - R_RunParticleEffect2 (org, dmin, dmax, color, effect, msgcount); + P_RunParticleEffect2 (org, dmin, dmax, color, effect, msgcount); } -void R_ParseParticleEffect3 (void) +void CL_ParseParticleEffect3 (void) { vec3_t org, box; int i, msgcount, color, effect; @@ -1111,9 +1111,9 @@ void R_ParseParticleEffect3 (void) msgcount = MSG_ReadByte (); effect = MSG_ReadByte (); - R_RunParticleEffect3 (org, box, color, effect, msgcount); + P_RunParticleEffect3 (org, box, color, effect, msgcount); } -void R_ParseParticleEffect4 (void) +void CL_ParseParticleEffect4 (void) { vec3_t org; int i, msgcount, color, effect; @@ -1126,7 +1126,7 @@ void R_ParseParticleEffect4 (void) msgcount = MSG_ReadByte (); effect = MSG_ReadByte (); - R_RunParticleEffect4 (org, radius, color, effect, msgcount); + P_RunParticleEffect4 (org, radius, color, effect, msgcount); } @@ -1220,7 +1220,7 @@ void CLQ2_ParseTEnt (void) case Q2TE_BLOOD: // bullet hitting flesh MSG_ReadPos (pos); MSG_ReadDir (dir); - R_RunParticleEffectType(pos, dir, 1, pt_blood); + P_RunParticleEffectType(pos, dir, 1, pt_blood); R_AddStain(pos, 0, -10, -10, 40); break; @@ -1230,9 +1230,9 @@ void CLQ2_ParseTEnt (void) MSG_ReadPos (pos); MSG_ReadDir (dir); if (type == Q2TE_GUNSHOT) - R_RunParticleEffect (pos, dir, 0, 40); + P_RunParticleEffect (pos, dir, 0, 40); else - R_RunParticleEffect (pos, dir, 0xe0, 6); + P_RunParticleEffect (pos, dir, 0xe0, 6); R_AddStain(pos, -10, -10, -10, 20); @@ -1257,9 +1257,9 @@ void CLQ2_ParseTEnt (void) MSG_ReadPos (pos); MSG_ReadDir (dir); if (type == Q2TE_SCREEN_SPARKS) - R_RunParticleEffect (pos, dir, 0xd0, 40); + P_RunParticleEffect (pos, dir, 0xd0, 40); else - R_RunParticleEffect (pos, dir, 0xb0, 40); + P_RunParticleEffect (pos, dir, 0xb0, 40); //FIXME : replace or remove this sound // Q2S_StartSound (pos, 0, 0, q2cl_sfx_lashit, 1, ATTN_NORM, 0); break; @@ -1267,7 +1267,7 @@ void CLQ2_ParseTEnt (void) case Q2TE_SHOTGUN: // bullet hitting wall MSG_ReadPos (pos); MSG_ReadDir (dir); - R_RunParticleEffect (pos, dir, 0, 20); + P_RunParticleEffect (pos, dir, 0, 20); // CL_SmokeAndFlash(pos); R_AddStain(pos, -10, -10, -10, 20); break; @@ -1281,7 +1281,7 @@ void CLQ2_ParseTEnt (void) color = 0x00; else color = splash_color[r]; - R_RunParticleEffect (pos, dir, color, cnt); + P_RunParticleEffect (pos, dir, color, cnt); if (r == Q2SPLASH_SPARKS) { @@ -1300,21 +1300,21 @@ void CLQ2_ParseTEnt (void) MSG_ReadPos (pos); MSG_ReadDir (dir); color = MSG_ReadByte (); - R_RunParticleEffect (pos, dir, color, cnt); + P_RunParticleEffect (pos, dir, color, cnt); break; // RAFAEL case Q2TE_BLUEHYPERBLASTER: MSG_ReadPos (pos); MSG_ReadPos (dir); - R_BlasterParticles (pos, dir); + P_BlasterParticles (pos, dir); break; case Q2TE_BLASTER: // blaster hitting wall MSG_ReadPos (pos); MSG_ReadDir (dir); - R_BlasterParticles (pos, dir); + P_BlasterParticles (pos, dir); R_AddStain(pos, 0, -5, -10, 20); ex = CL_AllocExplosion (); @@ -1349,7 +1349,7 @@ void CLQ2_ParseTEnt (void) case Q2TE_GRENADE_EXPLOSION_WATER: MSG_ReadPos (pos); - R_ParticleExplosion (pos); + P_ParticleExplosion (pos); // light { @@ -1430,7 +1430,7 @@ void CLQ2_ParseTEnt (void) case Q2TE_EXPLOSION1_NP: // PMM MSG_ReadPos (pos); - R_ParticleExplosion (pos); + P_ParticleExplosion (pos); // light { @@ -1911,7 +1911,7 @@ void CL_UpdateBeams (void) } */ // if (part_type[rt_lightning1].loaded) - if (!R_RocketTrail(b->start, b->end, rt_lightning1, NULL)) + if (!P_ParticleTrail(b->start, b->end, rt_lightning1, NULL)) continue; // add new entities for the lightning @@ -2005,8 +2005,6 @@ void CL_UpdateExplosions (void) } } -void R_DarkFieldParticles (float *org, qbyte colour); -void R_EntityParticles (float *org, qbyte colour, float *radius); entity_state_t *CL_FindPacketEntity(int num); void CL_UpdateSEEFs(void) { @@ -2048,12 +2046,12 @@ void CL_UpdateSEEFs(void) org[0] = eorg[0]; org[1] = eorg[1]; org[2] = eorg[2] + cl_seef[i].offset; - R_EntityParticles(org, cl_seef[i].colour, cl_seef[i].efsize); + P_EntityParticles(org, cl_seef[i].colour, cl_seef[i].efsize); } break; case TE_SEEF_DARKFIELD: if (!cl.paused) - R_DarkFieldParticles(eorg, cl_seef[i].colour); + P_DarkFieldParticles(eorg, cl_seef[i].colour); break; case TE_SEEF_DARKLIGHT: dl = CL_AllocDlight (cl_seef[i].entnum); diff --git a/engine/client/client.h b/engine/client/client.h index b85d2b7d7..b74acbf64 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // client.h +#include "particles.h" + typedef struct { @@ -609,7 +611,7 @@ qboolean CL_DemoBehind(void); void CL_BeginServerConnect(void); void CLNQ_BeginServerConnect(void); -#define MAX_VISEDICTS 256 +#define MAX_VISEDICTS 1024 extern int cl_numvisedicts, cl_oldnumvisedicts; extern entity_t *cl_visedicts, *cl_oldvisedicts; extern entity_t cl_visedicts_list[2][MAX_VISEDICTS]; @@ -716,6 +718,11 @@ void CL_ClearCustomTEnts(void); void CL_ParseCustomTEnt(void); void CL_ParseEffect (qboolean effect2); +void CLNQ_ParseParticleEffect (void); +void CL_ParseParticleEffect2 (void); +void CL_ParseParticleEffect3 (void); +void CL_ParseParticleEffect4 (void); + // // cl_ents.c // @@ -754,7 +761,7 @@ void CG_Restart_f(void); //pr_csqc.c // #ifdef CSQC_DAT -void CSQC_Init (void); +qboolean CSQC_Init (unsigned int checksum); qboolean CSQC_DrawView(void); void CSQC_Shutdown(void); qboolean CSQC_StuffCmd(char *cmd); @@ -868,7 +875,7 @@ void CLNQ_ParseEntity(unsigned int bits); int CLQ2_RegisterTEntModels (void); #endif -void NQ_R_ParseParticleEffect (void); +void NQ_P_ParseParticleEffect (void); void CLNQ_SignonReply (void); void NQ_BeginConnect(char *to); void NQ_ContinueConnect(char *to); diff --git a/engine/client/clq2_ents.c b/engine/client/clq2_ents.c index 555e043ed..cc1564343 100644 --- a/engine/client/clq2_ents.c +++ b/engine/client/clq2_ents.c @@ -107,7 +107,7 @@ void CLQ2_BlasterTrail2(vec3_t oldorg, vec3_t neworg){}; void CLQ2_RocketTrail(vec3_t oldorg, vec3_t neworg, q2centity_t *ent) { extern int rt_rocket; - R_RocketTrail(oldorg, neworg, rt_rocket, &ent->trailstate); + P_ParticleTrail(oldorg, neworg, rt_rocket, &ent->trailstate); }; diff --git a/engine/client/console.c b/engine/client/console.c index 9ce3a8c8c..9a8813332 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -493,6 +493,8 @@ void Con_Init (void) #endif con_current = &con_main; + con_main.linebuffered = Con_ExecuteLine; + con_main.commandcompletion = true; con_main.linewidth = -1; Con_CheckResize (); @@ -834,8 +836,9 @@ void Con_DrawInput (void) int p; unsigned char *text, *fname; extern int con_commandmatch; + unsigned short maskedtext[MAXCMDLINE]; - int mask=CON_WHITEMASK; + unsigned short mask=CON_WHITEMASK; int maskstack[4]; int maskstackdepth = 0; @@ -846,16 +849,113 @@ void Con_DrawInput (void) if (key_dest != key_console && cls.state == ca_active) return; // don't draw anything (allways draw if not active) - if (con_current != &con_main) - return; + if (!con_current->linebuffered) + return; //fixme: draw any unfinished lines of the current console instead. - text = key_lines[edit_line]; + //copy it to an alternate buffer and fill in text colouration escape codes. + //if it's recognised as a command, colour it yellow. + //if it's not a command, and the cursor is at the end of the line, leave it as is, + // but add to the end to show what the compleation will be. + + for (i = 0; text[i]; i++) + { + if (text[i] == '^') //is this an escape code? + { + if (text[i+1]>='0' && text[i+1]<'8') + mask = (text[i+1]-'0')*256 + (mask&~CON_COLOURMASK); //change colour only. + else if (text[i+1] == 'b') + mask = (mask & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (mask & CON_BLINKTEXT)); + else if (text[i+1] == 'a') //alternate + mask = (mask & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (mask & CON_2NDCHARSETTEXT)); + else if (text[i+1] == 's') //store on stack (it's great for names) + { + if (maskstackdepth < sizeof(maskstack)/sizeof(maskstack[0])) + { + maskstack[maskstackdepth] = mask; + maskstackdepth++; + } + } + else if (text[i+1] == 'r') //restore from stack (it's great for names) + { + if (maskstackdepth) + { + maskstackdepth--; + mask = maskstack[maskstackdepth]; + } + } + else if (text[i+1] == '^')//next does nothing either + { + maskedtext[i] = (unsigned char)text[i] | mask; + i++; + } + } + + maskedtext[i] = (unsigned char)text[i] | mask; + } //that's the default compleation applied + + maskedtext[i] = '\0'; + maskedtext[i+1] = '\0'; //just in case + + if (con_current->commandcompletion) + { + if (text[1] == '/' || IsCommand(text+1)) + { //color the first token yellow, it's a valid command + for (p = 1; (maskedtext[p]&255)>' '; p++) + maskedtext[p] = (maskedtext[p]&255) | (COLOR_YELLOW<<8); + } + if (key_linepos == i) //cursor is at end + { + x = text[1] == '/'?2:1; + fname = Cmd_CompleteCommand(text+x, true, con_commandmatch); + if (fname) //we can compleate it to: + { + for (p = i-x; fname[p]>' '; p++) + maskedtext[p+x] = (unsigned char)fname[p] | (COLOR_GREEN<<8); + maskedtext[p+x] = '\0'; + } + } + } + + if (((int)(realtime*con_cursorspeed)&1)) + { + maskedtext[key_linepos] = 11|CON_WHITEMASK; //make it blink + } + + if (i >= con_current->linewidth) //work out the start point + si = i - con_current->linewidth; + else + si = 0; + + y = con_current->vislines-22; + + for (i=0,p=0,x=8; x<=con_current->linewidth*8 ; p++) //draw it + { + if (!maskedtext[p]) + break; + if (si <= i) + { + Draw_ColouredCharacter ( x, con_current->vislines - 22, maskedtext[p]); + x+=8; + } + i++; + } + + + + /* + + x = 1; if (text[1] == '/') x = 2; - fname = Cmd_CompleteCommand(text+x, true, con_commandmatch); + if (con_current->commandcompletion) + { + fname = Cmd_CompleteCommand(text+x, true, con_commandmatch); + } + else + fname = NULL; oc = text[key_linepos]; if (!oc) text[key_linepos+1] = 0; @@ -928,6 +1028,7 @@ void Con_DrawInput (void) } text[key_linepos] = oc; + */ } /* diff --git a/engine/client/keys.c b/engine/client/keys.c index 6b6117f88..85f4120a4 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -212,16 +212,16 @@ keyname_t keynames[] = ============================================================================== */ -qboolean CheckForCommand (void) +qboolean IsCommand (char *line) { char command[128]; char *cmd, *s; int i; - s = key_lines[edit_line]+1; + s = line; for (i=0 ; i<127 ; i++) - if (s[i] <= ' ') + if (s[i] <= ' ' || s[i] == ';') break; else command[i] = s[i]; @@ -326,15 +326,21 @@ void CompleteCommand (qboolean force) cmd = Cmd_CompleteCommand (s, false, 0); if (cmd) { - key_lines[edit_line][1] = '/'; - Q_strcpy (key_lines[edit_line]+2, cmd); - key_linepos = Q_strlen(cmd)+2; + i = key_lines[edit_line][1] == '/'?2:1; + if (i != 2 || strcmp(key_lines[edit_line]+i, cmd)) + { //if changed, compleate it + key_lines[edit_line][1] = '/'; + Q_strcpy (key_lines[edit_line]+2, cmd); + key_linepos = Q_strlen(cmd)+2; - s = key_lines[edit_line]+1; //readjust to cope with the insertion of a / - if (*s == '\\' || *s == '/') - s++; + s = key_lines[edit_line]+1; //readjust to cope with the insertion of a / + if (*s == '\\' || *s == '/') + s++; - key_lines[edit_line][key_linepos] = 0; + key_lines[edit_line][key_linepos] = 0; + + return; //don't alter con_commandmatch if we compleated a tiny bit more + } } con_commandmatch++; @@ -342,6 +348,37 @@ void CompleteCommand (qboolean force) con_commandmatch = 1; } +//lines typed at the main console enter here +void Con_ExecuteLine(console_t *con, char *line) +{ + con_commandmatch=1; + if (line[0] == '\\' || line[0] == '/') + Cbuf_AddText (line+1, RESTRICT_LOCAL); // skip the > + else if (IsCommand(line)) + Cbuf_AddText (line, RESTRICT_LOCAL); // valid command +#ifdef Q2CLIENT + else if (cls.q2server) + Cbuf_AddText (line, RESTRICT_LOCAL); // send the command to the server, and let the server convert to chat +#endif + else + { // convert to a chat message + if (cls.state >= ca_connected && (strncmp(line, "say ", 4))) + { + if (keydown[K_CTRL]) + Cbuf_AddText ("say_team ", RESTRICT_LOCAL); + else + Cbuf_AddText ("say ", RESTRICT_LOCAL); + } + Cbuf_AddText (line, RESTRICT_LOCAL); // skip the > + } + + Cbuf_AddText ("\n", RESTRICT_LOCAL); + Con_Printf ("]%s\n",line); + if (cls.state == ca_disconnected) + SCR_UpdateScreen (); // force an update, because the command + // may take some time +} + /* ==================== Key_Console @@ -372,46 +409,20 @@ void Key_Console (int key) if (key == K_ENTER) { // backslash text are commands, else chat - con_commandmatch=1; - if (key_lines[edit_line][1] == '\\')//irc - { - Cbuf_AddText ("irc ", RESTRICT_LOCAL); - Cbuf_AddText (key_lines[edit_line]+2, RESTRICT_LOCAL); // skip the > //irc - } - else if (key_lines[edit_line][1] == '\\' || key_lines[edit_line][1] == '/') - Cbuf_AddText (key_lines[edit_line]+2, RESTRICT_LOCAL); // skip the > - else if (CheckForCommand()) - Cbuf_AddText (key_lines[edit_line]+1, RESTRICT_LOCAL); // valid command -#ifdef Q2CLIENT - else if (cls.q2server) - Cbuf_AddText (key_lines[edit_line]+1, RESTRICT_LOCAL); // valid command -#endif - else - { // convert to a chat message - if (cls.state >= ca_connected && (strncmp(key_lines[edit_line]+1, "say ", 4))) - { - if (keydown[K_CTRL]) - Cbuf_AddText ("say_team ", RESTRICT_LOCAL); - else - Cbuf_AddText ("say ", RESTRICT_LOCAL); - } - Cbuf_AddText (key_lines[edit_line]+1, RESTRICT_LOCAL); // skip the > - } - - Cbuf_AddText ("\n", RESTRICT_LOCAL); - Con_Printf ("%s\n",key_lines[edit_line]); + int oldl = edit_line; edit_line = (edit_line + 1) & 31; history_line = edit_line; key_lines[edit_line][0] = ']'; key_lines[edit_line][1] = '\0'; key_linepos = 1; - if (cls.state == ca_disconnected) - SCR_UpdateScreen (); // force an update, because the command - // may take some time + + if (con_current->linebuffered) + con_current->linebuffered(con_current, key_lines[oldl]+1); + return; } - if (key == K_SPACE) + if (key == K_SPACE && con_current->commandcompletion) { if (keydown[K_SHIFT] && /*key_lines[edit_line][1] == '/' &&*/ !strchr(key_lines[edit_line], ' ')) { @@ -428,7 +439,8 @@ void Key_Console (int key) return; } - CompleteCommand (false); + if (con_current->commandcompletion) + CompleteCommand (false); return; } if (key != K_SHIFT) @@ -543,7 +555,7 @@ void Key_Console (int key) } #ifdef _WIN32 - if ((key=='V' || key=='v') && keydown[K_CTRL]) + if (((key=='V' || key=='v') && keydown[K_CTRL]) || keydown[K_SHIFT] && key == K_INS) { if (OpenClipboard(NULL)) { diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 9452460be..46cbcd773 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -8,36 +8,53 @@ progfuncs_t *csqcprogs; +unsigned int csqcchecksum; + +#define csqcglobals \ + globalfunction(init_function, "CSQC_Init"); \ + globalfunction(shutdown_function, "CSQC_Shutdown"); \ + globalfunction(draw_function, "CSQC_UpdateView"); \ + globalfunction(keydown_function, "CSQC_KeyDown"); \ + globalfunction(keyup_function, "CSQC_KeyUp"); \ + globalfunction(parse_stuffcmd, "CSQC_Parse_StuffCmd"); \ + globalfunction(parse_centerprint, "CSQC_Parse_CenterPrint"); \ + \ + globalfunction(ent_update, "CSQC_Ent_Update"); \ + globalfunction(ent_remove, "CSQC_Ent_Remove"); \ + \ + /*These are pointers to the csqc's globals.*/ \ + globalfloat(time, "time"); /*float Written before entering most qc functions*/ \ + globalentity(self, "self"); /*entity Written before entering most qc functions*/ \ + \ + globalvector(forward, "v_forward"); /*vector written by anglevectors*/ \ + globalvector(right, "v_right"); /*vector written by anglevectors*/ \ + globalvector(up, "v_up"); /*vector written by anglevectors*/ \ + \ + globalfloat(trace_allsolid, "trace_allsolid"); /*bool written by traceline*/ \ + globalfloat(trace_startsolid, "trace_startsolid"); /*bool written by traceline*/ \ + globalfloat(trace_fraction, "trace_fraction"); /*float written by traceline*/ \ + globalfloat(trace_inwater, "trace_inwater"); /*bool written by traceline*/ \ + globalfloat(trace_inopen, "trace_inopen"); /*bool written by traceline*/ \ + globalvector(trace_endpos, "trace_endpos"); /*vector written by traceline*/ \ + globalvector(trace_plane_normal, "trace_plane_normal"); /*vector written by traceline*/ \ + globalfloat(trace_plane_dist, "trace_plane_dist"); /*float written by traceline*/ \ + globalentity(trace_ent, "trace_ent"); /*entity written by traceline*/ \ + typedef struct { +#define globalfloat(name,qcname) float *name +#define globalvector(name,qcname) float *name +#define globalentity(name,qcname) int *name +#define globalstring(name,qcname) string_t *name +#define globalfunction(name,qcname) func_t name //These are the functions the engine will call to, found by name. - func_t init_function; - func_t shutdown_function; - func_t draw_function; - func_t keydown_function; - func_t keyup_function; - func_t parse_stuffcmd; - func_t parse_centerprint; - func_t ent_update; - func_t ent_remove; + csqcglobals -//These are pointers to the csqc's globals. - float *time; //float Written before entering most qc functions - int *self; //entity Written before entering most qc functions - - float *forward; //vector written by anglevectors - float *right; //vector written by anglevectors - float *up; //vector written by anglevectors - - float *trace_allsolid; //bool written by traceline - float *trace_startsolid; //bool written by traceline - float *trace_fraction; //float written by traceline - float *trace_inwater; //bool written by traceline - float *trace_inopen; //bool written by traceline - float *trace_endpos; //vector written by traceline - float *trace_plane_normal; //vector written by traceline - float *trace_plane_dist; //float written by traceline - int *trace_ent; //entity written by traceline +#undef globalfloat +#undef globalvector +#undef globalentity +#undef globalstring +#undef globalfunction } csqcglobals_t; static csqcglobals_t csqcg; @@ -45,29 +62,21 @@ static csqcglobals_t csqcg; void CSQC_FindGlobals(void) { - csqcg.time = (float*)PR_FindGlobal(csqcprogs, "time", 0); +#define globalfloat(name,qcname) csqcg.name = (float*)PR_FindGlobal(csqcprogs, qcname, 0); +#define globalvector(name,qcname) csqcg.name = (float*)PR_FindGlobal(csqcprogs, qcname, 0); +#define globalentity(name,qcname) csqcg.name = (int*)PR_FindGlobal(csqcprogs, qcname, 0); +#define globalstring(name,qcname) csqcg.name = (string_t*)PR_FindGlobal(csqcprogs, qcname, 0); +#define globalfunction(name,qcname) csqcg.name = PR_FindFunction(csqcprogs,qcname,PR_ANY); + + csqcglobals + +#undef globalfloat +#undef globalvector +#undef globalentity +#undef globalstring +#undef globalfunction if (csqcg.time) *csqcg.time = Sys_DoubleTime(); - - csqcg.self = (int*)PR_FindGlobal(csqcprogs, "self", 0); - - - csqcg.forward = (float*)PR_FindGlobal(csqcprogs, "v_forward", 0); - csqcg.right = (float*)PR_FindGlobal(csqcprogs, "v_right", 0); - csqcg.up = (float*)PR_FindGlobal(csqcprogs, "v_up", 0); - - - csqcg.init_function = PR_FindFunction(csqcprogs, "CSQC_Init", PR_ANY); - csqcg.shutdown_function = PR_FindFunction(csqcprogs, "CSQC_Shutdown", PR_ANY); - csqcg.draw_function = PR_FindFunction(csqcprogs, "CSQC_UpdateView", PR_ANY); - csqcg.keydown_function = PR_FindFunction(csqcprogs, "CSQC_KeyDown", PR_ANY); - csqcg.keyup_function = PR_FindFunction(csqcprogs, "CSQC_KeyUp", PR_ANY); - - csqcg.parse_stuffcmd = PR_FindFunction(csqcprogs, "CSQC_Parse_StuffCmd", PR_ANY); - csqcg.parse_centerprint = PR_FindFunction(csqcprogs, "CSQC_Parse_CenterPrint", PR_ANY); - - csqcg.ent_update = PR_FindFunction(csqcprogs, "CSQC_Ent_Update", PR_ANY); - csqcg.ent_remove = PR_FindFunction(csqcprogs, "CSQC_Ent_Remove", PR_ANY); } @@ -611,6 +620,17 @@ static void PF_CSQC_SetOrigin(progfuncs_t *prinst, struct globalvars_s *pr_globa //fixme: add some sort of fast area grid } +static void PF_CSQC_SetSize(progfuncs_t *prinst, struct globalvars_s *pr_globals) +{ + csqcedict_t *ent = (void*)G_EDICT(prinst, OFS_PARM0); + float *mins = G_VECTOR(OFS_PARM1); + float *maxs = G_VECTOR(OFS_PARM1); + + //fixme: set the size. :p + + //fixme: add some sort of fast area grid +} + //FIXME: Not fully functional static void PF_CSQC_traceline(progfuncs_t *prinst, struct globalvars_s *pr_globals) { @@ -857,6 +877,28 @@ static void PF_cs_setsensativityscaler (progfuncs_t *prinst, struct globalvars_s in_sensitivityscale = G_FLOAT(OFS_PARM0); } +static void PF_cs_pointparticles (progfuncs_t *prinst, struct globalvars_s *pr_globals) +{ + char *effectname = PR_GetStringOfs(prinst, OFS_PARM0); + float *org = G_VECTOR(OFS_PARM1); + float *vel = G_VECTOR(OFS_PARM2); + float count = G_FLOAT(OFS_PARM3); + int effectnum = P_AllocateParticleType(effectname); + + if (*prinst->callargc < 3) + vel = vec3_origin; + if (*prinst->callargc < 4) + count = 1; + + P_RunParticleEffectType(org, vel, count, effectnum); +} + +static void PF_cs_particlesloaded (progfuncs_t *prinst, struct globalvars_s *pr_globals) +{ + char *effectname = PR_GetStringOfs(prinst, OFS_PARM0); + G_FLOAT(OFS_RETURN) = P_DescriptionIsLoaded(effectname); +} + #define PF_FixTen PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme //warning: functions that depend on globals are bad, mkay? @@ -866,7 +908,7 @@ builtin_t csqc_builtins[] = { PF_makevectors, PF_CSQC_SetOrigin, //PF_setorigin PF_CSQC_SetModel, //PF_setmodel - PF_Fixme, //PF_setsize + PF_CSQC_SetSize, //PF_setsize PF_Fixme, PF_Fixme, //PF_break, PF_random, @@ -1053,8 +1095,8 @@ PF_CSQC_ModelnameForIndex, PF_cs_setsensativityscaler, PF_csqc_centerprint, PF_print, -PF_Fixme, -PF_Fixme, +PF_cs_pointparticles, +PF_cs_particlesloaded, //160 PF_FixTen, @@ -1096,8 +1138,6 @@ PF_FixTen, //250 PF_FixTen, -PF_FixTen, - //260 PF_FixTen, @@ -1217,21 +1257,37 @@ void CSQC_Shutdown(void) in_sensitivityscale = 1; } -double csqctime; -void CSQC_Init (void) +//when the qclib needs a file, it calls out to this function. +qbyte *CSQC_PRLoadFile (char *path, void *buffer, int bufsize) { + qbyte *file; + //pretend it doesn't + file = COM_LoadStackFile(path, buffer, bufsize); + + if (!strcmp(path, "csprogs.dat")) //Fail to load any csprogs who's checksum doesn't match. + if (Com_BlockChecksum(buffer, com_filesize) != csqcchecksum) + return NULL; + + return file; +} + +double csqctime; +qboolean CSQC_Init (unsigned int checksum) +{ + csqcchecksum = checksum; + CSQC_Shutdown(); if (!qrenderer) { - return; + return false; } memset(cl.model_csqcname, 0, sizeof(cl.model_csqcname)); memset(cl.model_csqcprecache, 0, sizeof(cl.model_csqcprecache)); csqcprogparms.progsversion = PROGSTRUCT_VERSION; - csqcprogparms.ReadFile = COM_LoadStackFile;//char *(*ReadFile) (char *fname, void *buffer, int *len); + csqcprogparms.ReadFile = CSQC_PRLoadFile;//char *(*ReadFile) (char *fname, void *buffer, int *len); csqcprogparms.FileSize = COM_FileSize;//int (*FileSize) (char *fname); //-1 if file does not exist csqcprogparms.WriteFile = QC_WriteFile;//bool (*WriteFile) (char *name, void *data, int len); csqcprogparms.printf = (void *)Con_Printf;//Con_Printf;//void (*printf) (char *, ...); @@ -1279,12 +1335,12 @@ void CSQC_Init (void) { CSQC_Shutdown(); //failed to load or something - return; + return false; } if (setjmp(csqc_abort)) { CSQC_Shutdown(); - return; + return false; } memset(csqcent, 0, sizeof(csqcent)); @@ -1303,11 +1359,13 @@ void CSQC_Init (void) Con_Printf("Loaded csqc\n"); } + + return true; //success! } qboolean CSQC_DrawView(void) { - if (!csqcg.draw_function || !csqcprogs) + if (!csqcg.draw_function || !csqcprogs || !cl.worldmodel) return false; r_secondaryview = 0; diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index 9105dc17b..5779d4a69 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -1386,7 +1386,7 @@ void MP_Init (void) menuprogparms.globalbuiltins = menu_builtins;//builtin_t *globalbuiltins; //these are available to all progs menuprogparms.numglobalbuiltins = menu_numbuiltins; - menuprogparms.autocompile = PR_COMPILECHANGED;//enum {PR_NOCOMPILE, PR_COMPILENEXIST, PR_COMPILECHANGED, PR_COMPILEALWAYS} autocompile; + menuprogparms.autocompile = PR_COMPILEEXISTANDCHANGED;//enum {PR_NOCOMPILE, PR_COMPILENEXIST, PR_COMPILECHANGED, PR_COMPILEALWAYS} autocompile; menuprogparms.gametime = &menutime; diff --git a/engine/client/r_part.c b/engine/client/r_part.c index 05dedad37..86d3ac7d0 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -18,6 +18,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* +The aim of this particle system is to have as much as possible configurable. +Some parts still fail here, and are marked FIXME +Effects are flushed on new maps. +The engine has a few builtins. +*/ + #include "quakedef.h" #ifdef SWQUAKE #include "r_local.h" @@ -67,17 +74,14 @@ int rt_blastertrail, static double sint[7] = {0.000000, 0.781832, 0.974928, 0.433884, -0.433884, -0.974928, -0.781832}; static double cost[7] = {1.000000, 0.623490, -0.222521, -0.900969, -0.900969, -0.222521, 0.623490}; -void R_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count); -void R_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count); -void R_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count); - -int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum); #define crand() (rand()%32767/16383.5f-1) void D_DrawParticleTrans (particle_t *pparticle); void D_DrawSparkTrans (particle_t *pparticle, vec3_t src, vec3_t dest); +void P_ReadPointFile_f (void); + #define MAX_BEAMS 2048 // default max # of beam segments #define MAX_PARTICLES 32768 // default max # of particles at one // time @@ -212,7 +216,7 @@ typedef struct part_type_s { int numparticletypes; part_type_t *part_type; -part_type_t *GetParticleType(char *name) +static part_type_t *P_GetParticleType(char *name) { int i; part_type_t *ptype; @@ -238,16 +242,16 @@ part_type_t *GetParticleType(char *name) return ptype; } -int AllocateParticleType(char *name) +int P_AllocateParticleType(char *name) //guarentees that the particle type exists, returning it's index. { - return GetParticleType(name) - part_type; + return P_GetParticleType(name) - part_type; } -int ParticleTypeForName(char *name) +int P_ParticleTypeForName(char *name) { int to; - to = GetParticleType(name) - part_type; + to = P_GetParticleType(name) - part_type; if (to < 0 || to >= numparticletypes) { return -1; @@ -256,7 +260,7 @@ int ParticleTypeForName(char *name) return to; } -int FindParticleType(char *name) +static int P_FindParticleType(char *name) //checks if particle description 'name' exists, returns -1 if not. { int i; for (i = 0; i < numparticletypes; i++) @@ -268,7 +272,17 @@ int FindParticleType(char *name) return -1; } -static void R_Part_Modified(void) +qboolean P_DescriptionIsLoaded(char *name) +{ + int i = P_FindParticleType(name); + part_type_t *ptype; + if (i < 0) + return false; + ptype = &part_type[i]; + return ptype->loaded; +} + +static void P_SetModified(void) //called when the particle system changes (from console). { if (Cmd_FromServer()) return; //server stuffed particle descriptions don't count. @@ -281,11 +295,11 @@ static void R_Part_Modified(void) Cbuf_AddText("say particles description has changed\n", RESTRICT_LOCAL); } } -int CheckAssosiation(char *name, int from) +static int CheckAssosiation(char *name, int from) { int to, orig; - orig = to = FindParticleType(name); + orig = to = P_FindParticleType(name); if (to < 0) { return -1; @@ -303,7 +317,9 @@ int CheckAssosiation(char *name, int from) return orig; } -void R_ParticleEffect_f(void) +//Uses FTE's multiline console stuff. +//This is the function that loads the effect descriptions (via console). +void P_ParticleEffect_f(void) { char *var, *value; char *buf; @@ -330,14 +346,14 @@ void R_ParticleEffect_f(void) return; } - ptype = GetParticleType(Cmd_Argv(1)); + ptype = P_GetParticleType(Cmd_Argv(1)); if (!ptype) { Con_Printf("Bad name\n"); return; } - R_Part_Modified(); + P_SetModified(); pnum = ptype-part_type; @@ -567,7 +583,7 @@ void R_ParticleEffect_f(void) else if (!strcmp(var, "cliptype")) { - assoc = ParticleTypeForName(value);//careful - this can realloc all the particle types + assoc = P_ParticleTypeForName(value);//careful - this can realloc all the particle types ptype = &part_type[pnum]; ptype->cliptype = assoc; } @@ -576,7 +592,7 @@ void R_ParticleEffect_f(void) else if (!strcmp(var, "emit")) { - assoc = ParticleTypeForName(value);//careful - this can realloc all the particle types + assoc = P_ParticleTypeForName(value);//careful - this can realloc all the particle types ptype = &part_type[pnum]; ptype->emit = assoc; } @@ -714,7 +730,10 @@ void R_ParticleEffect_f(void) #endif } -void R_AssosiateEffect_f (void) +//assosiate a point effect with a model. +//the effect will be spawned every frame with count*frametime +//has the capability to hide models. +void P_AssosiateEffect_f (void) { char *modelname = Cmd_Argv(1); char *effectname = Cmd_Argv(2); @@ -739,14 +758,16 @@ void R_AssosiateEffect_f (void) Con_Printf("Sorry: You may not assosiate effects with item model \"%s\"\n", modelname); return; } - effectnum = AllocateParticleType(effectname); + effectnum = P_AllocateParticleType(effectname); model->particleeffect = effectnum; model->particleengulphs = atoi(Cmd_Argv(3)); - R_Part_Modified(); + P_SetModified(); //make it appear in f_modified. } -void R_AssosiateTrail_f (void) +//assosiate a particle trail with a model. +//the effect will be spawned between two points when an entity with the model moves. +void P_AssosiateTrail_f (void) { char *modelname = Cmd_Argv(1); char *effectname = Cmd_Argv(2); @@ -764,14 +785,14 @@ void R_AssosiateTrail_f (void) } model = Mod_FindName(modelname); - effectnum = AllocateParticleType(effectname); + effectnum = P_AllocateParticleType(effectname); model->particletrail = effectnum; model->nodefaulttrail = true; //we could have assigned the trail to a model that wasn't loaded. - R_Part_Modified(); + P_SetModified(); //make it appear in f_modified. } -void R_DefaultTrail (model_t *model) +void P_DefaultTrail (model_t *model) { if (model->nodefaulttrail == true) return; @@ -781,82 +802,82 @@ void R_DefaultTrail (model_t *model) switch((int)r_rockettrail.value) { case 0: - model->particletrail = AllocateParticleType("t_null"); + model->particletrail = P_AllocateParticleType("t_null"); break; case 1: default: model->particletrail = rt_rocket;//q2 models do this without flags. break; case 2: - model->particletrail = AllocateParticleType("t_grenade"); + model->particletrail = P_AllocateParticleType("t_grenade"); break; case 3: - model->particletrail = AllocateParticleType("t_altrocket"); + model->particletrail = P_AllocateParticleType("t_altrocket"); break; case 4: - model->particletrail = AllocateParticleType("t_gib"); + model->particletrail = P_AllocateParticleType("t_gib"); break; case 5: - model->particletrail = AllocateParticleType("t_zomgib"); + model->particletrail = P_AllocateParticleType("t_zomgib"); break; case 6: - model->particletrail = AllocateParticleType("t_tracer"); + model->particletrail = P_AllocateParticleType("t_tracer"); break; case 7: - model->particletrail = AllocateParticleType("t_tracer2"); + model->particletrail = P_AllocateParticleType("t_tracer2"); break; case 8: - model->particletrail = AllocateParticleType("t_tracer3"); + model->particletrail = P_AllocateParticleType("t_tracer3"); break; } } else if (model->flags & EF_GRENADE) { if (r_grenadetrail.value) - model->particletrail = AllocateParticleType("t_grenade"); + model->particletrail = P_AllocateParticleType("t_grenade"); else - model->particletrail = AllocateParticleType("t_null"); + model->particletrail = P_AllocateParticleType("t_null"); } else if (model->flags & EF_GIB) - model->particletrail = AllocateParticleType("t_gib"); + model->particletrail = P_AllocateParticleType("t_gib"); else if (model->flags & EF_TRACER) - model->particletrail = AllocateParticleType("t_tracer"); + model->particletrail = P_AllocateParticleType("t_tracer"); else if (model->flags & EF_ZOMGIB) - model->particletrail = AllocateParticleType("t_zomgib"); + model->particletrail = P_AllocateParticleType("t_zomgib"); else if (model->flags & EF_TRACER2) - model->particletrail = AllocateParticleType("t_tracer2"); + model->particletrail = P_AllocateParticleType("t_tracer2"); else if (model->flags & EF_TRACER3) - model->particletrail = AllocateParticleType("t_tracer3"); + model->particletrail = P_AllocateParticleType("t_tracer3"); else if (model->flags & EF_BLOODSHOT) //these are the hexen2 ones. - model->particletrail = AllocateParticleType("t_bloodshot"); + model->particletrail = P_AllocateParticleType("t_bloodshot"); else if (model->flags & EF_FIREBALL) - model->particletrail = AllocateParticleType("t_fireball"); + model->particletrail = P_AllocateParticleType("t_fireball"); else if (model->flags & EF_ACIDBALL) - model->particletrail = AllocateParticleType("t_acidball"); + model->particletrail = P_AllocateParticleType("t_acidball"); else if (model->flags & EF_ICE) - model->particletrail = AllocateParticleType("t_ice"); + model->particletrail = P_AllocateParticleType("t_ice"); else if (model->flags & EF_SPIT) - model->particletrail = AllocateParticleType("t_spit"); + model->particletrail = P_AllocateParticleType("t_spit"); else if (model->flags & EF_SPELL) - model->particletrail = AllocateParticleType("t_spell"); + model->particletrail = P_AllocateParticleType("t_spell"); else if (model->flags & EF_VORP_MISSILE) - model->particletrail = AllocateParticleType("t_vorpmissile"); + model->particletrail = P_AllocateParticleType("t_vorpmissile"); else if (model->flags & EF_SET_STAFF) - model->particletrail = AllocateParticleType("t_setstaff"); + model->particletrail = P_AllocateParticleType("t_setstaff"); else if (model->flags & EF_MAGICMISSILE) - model->particletrail = AllocateParticleType("t_magicmissile"); + model->particletrail = P_AllocateParticleType("t_magicmissile"); else if (model->flags & EF_BONESHARD) - model->particletrail = AllocateParticleType("t_boneshard"); + model->particletrail = P_AllocateParticleType("t_boneshard"); else if (model->flags & EF_SCARAB) - model->particletrail = AllocateParticleType("t_scarab"); + model->particletrail = P_AllocateParticleType("t_scarab"); else model->particletrail = -1; } #if _DEBUG // R_BeamInfo_f - debug junk -void R_BeamInfo_f (void) +void P_BeamInfo_f (void) { beamseg_t *bs; int i, j, k, l, m; @@ -890,7 +911,7 @@ void R_BeamInfo_f (void) } } -void R_PartInfo_f (void) +void P_PartInfo_f (void) { particle_t *p; @@ -920,7 +941,7 @@ void R_PartInfo_f (void) R_InitParticles =============== */ -void R_InitParticles (void) +void P_InitParticles (void) { char *particlecvargroupname = "Particle effects"; int i; @@ -947,13 +968,15 @@ void R_InitParticles (void) beams = (beamseg_t *) Hunk_AllocName (r_numbeams * sizeof(beamseg_t), "beams"); - Cmd_AddCommand("r_part", R_ParticleEffect_f); - Cmd_AddCommand("r_effect", R_AssosiateEffect_f); - Cmd_AddCommand("r_trail", R_AssosiateTrail_f); + Cmd_AddCommand("pointfile", P_ReadPointFile_f); //load the leak info produced from qbsp into the particle system to show a line. :) + + Cmd_AddCommand("r_part", P_ParticleEffect_f); + Cmd_AddCommand("r_effect", P_AssosiateEffect_f); + Cmd_AddCommand("r_trail", P_AssosiateTrail_f); #if _DEBUG - Cmd_AddCommand("r_partinfo", R_PartInfo_f); - Cmd_AddCommand("r_beaminfo", R_BeamInfo_f); + Cmd_AddCommand("r_partinfo", P_PartInfo_f); + Cmd_AddCommand("r_beaminfo", P_BeamInfo_f); #endif //particles @@ -969,49 +992,49 @@ void R_InitParticles (void) Cvar_Register(&r_rockettrail, particlecvargroupname); Cvar_Register(&r_grenadetrail, particlecvargroupname); - pt_explosion = AllocateParticleType("te_explosion"); - pt_emp = AllocateParticleType("te_emp"); - pt_pointfile = AllocateParticleType("te_pointfile"); - pt_entityparticles = AllocateParticleType("ef_entityparticles"); - pt_darkfield = AllocateParticleType("ef_darkfield"); - pt_blob = AllocateParticleType("te_blob"); + pt_explosion = P_AllocateParticleType("te_explosion"); + pt_emp = P_AllocateParticleType("te_emp"); + pt_pointfile = P_AllocateParticleType("te_pointfile"); + pt_entityparticles = P_AllocateParticleType("ef_entityparticles"); + pt_darkfield = P_AllocateParticleType("ef_darkfield"); + pt_blob = P_AllocateParticleType("te_blob"); - pt_blood = AllocateParticleType("te_blood"); - pt_lightningblood = AllocateParticleType("te_lightningblood"); - pt_gunshot = AllocateParticleType("te_gunshot"); - pt_lavasplash = AllocateParticleType("te_lavasplash"); - pt_teleportsplash = AllocateParticleType("te_teleportsplash"); - rt_blastertrail = AllocateParticleType("t_blastertrail"); - pt_blasterparticles = AllocateParticleType("te_blasterparticles"); - pt_wizspike = AllocateParticleType("te_wizspike"); - pt_knightspike = AllocateParticleType("te_knightspike"); - pt_spike = AllocateParticleType("te_spike"); - pt_superspike = AllocateParticleType("te_superspike"); - rt_railtrail = AllocateParticleType("t_railtrail"); - rt_bubbletrail = AllocateParticleType("t_bubbletrail"); - rt_rocket = AllocateParticleType("t_rocket"); + pt_blood = P_AllocateParticleType("te_blood"); + pt_lightningblood = P_AllocateParticleType("te_lightningblood"); + pt_gunshot = P_AllocateParticleType("te_gunshot"); + pt_lavasplash = P_AllocateParticleType("te_lavasplash"); + pt_teleportsplash = P_AllocateParticleType("te_teleportsplash"); + rt_blastertrail = P_AllocateParticleType("t_blastertrail"); + pt_blasterparticles = P_AllocateParticleType("te_blasterparticles"); + pt_wizspike = P_AllocateParticleType("te_wizspike"); + pt_knightspike = P_AllocateParticleType("te_knightspike"); + pt_spike = P_AllocateParticleType("te_spike"); + pt_superspike = P_AllocateParticleType("te_superspike"); + rt_railtrail = P_AllocateParticleType("t_railtrail"); + rt_bubbletrail = P_AllocateParticleType("t_bubbletrail"); + rt_rocket = P_AllocateParticleType("t_rocket"); - rt_lightning1 = AllocateParticleType("t_lightning1"); - rt_lightning2 = AllocateParticleType("t_lightning2"); - rt_lightning3 = AllocateParticleType("t_lightning3"); + rt_lightning1 = P_AllocateParticleType("t_lightning1"); + rt_lightning2 = P_AllocateParticleType("t_lightning2"); + rt_lightning3 = P_AllocateParticleType("t_lightning3"); - pt_superbullet = AllocateParticleType("te_superbullet"); - pt_bullet = AllocateParticleType("te_bullet"); - pe_default = AllocateParticleType("pe_default"); - pe_size2 = AllocateParticleType("pe_size2"); - pe_size3 = AllocateParticleType("pe_size3"); + pt_superbullet = P_AllocateParticleType("te_superbullet"); + pt_bullet = P_AllocateParticleType("te_bullet"); + pe_default = P_AllocateParticleType("pe_default"); + pe_size2 = P_AllocateParticleType("pe_size2"); + pe_size3 = P_AllocateParticleType("pe_size3"); - pt_spark = AllocateParticleType("pe_spark"); - pt_plasma = AllocateParticleType("pe_plasma"); + pt_spark = P_AllocateParticleType("pe_spark"); + pt_plasma = P_AllocateParticleType("pe_plasma"); } /* =============== -R_ClearParticles +P_ClearParticles =============== */ -void R_ClearParticles (void) +void P_ClearParticles (void) { int i; @@ -1056,7 +1079,7 @@ void R_ClearParticles (void) } } -void R_Part_NewServer(void) +void P_NewServer(void) { extern model_t mod_known[]; extern int mod_numknown; @@ -1080,7 +1103,7 @@ void R_Part_NewServer(void) mod->particletrail = -1; mod->nodefaulttrail = false; - R_DefaultTrail(mod); + P_DefaultTrail(mod); } f_modified_particles = false; @@ -1139,7 +1162,7 @@ void R_Part_NewServer(void) } } -void R_ReadPointFile_f (void) +void P_ReadPointFile_f (void) { FILE *f; vec3_t org; @@ -1157,7 +1180,7 @@ void R_ReadPointFile_f (void) return; } - R_ClearParticles(); + P_ClearParticles(); //so overflows arn't as bad. Con_Printf ("Reading %s...\n", name); c = 0; @@ -1176,14 +1199,14 @@ void R_ReadPointFile_f (void) Con_Printf ("Not enough free particles\n"); break; } - R_RunParticleEffectType(org, NULL, 1, pt_pointfile); + P_RunParticleEffectType(org, NULL, 1, pt_pointfile); } fclose (f); Con_Printf ("%i points read\n", c); } -void R_AddRainParticles(void) +void P_AddRainParticles(void) { float x; float y; @@ -1290,10 +1313,10 @@ glEnable(GL_DEPTH_TEST); vdist[0] = -st->face->plane->normal[0]; vdist[1] = -st->face->plane->normal[1]; vdist[2] = -st->face->plane->normal[2]; - R_RunParticleEffectType(org, vdist, 1, ptype); + P_RunParticleEffectType(org, vdist, 1, ptype); } else - R_RunParticleEffectType(org, st->face->plane->normal, 1, ptype); + P_RunParticleEffectType(org, st->face->plane->normal, 1, ptype); } } } @@ -1341,7 +1364,7 @@ void R_Part_SkyTri(float *v1, float *v2, float *v3, msurface_t *surf) -void R_EmitSkyEffectTris(model_t *mod, msurface_t *fa) +void P_EmitSkyEffectTris(model_t *mod, msurface_t *fa) { vec3_t verts[64]; int v1; @@ -1383,7 +1406,8 @@ void R_EmitSkyEffectTris(model_t *mod, msurface_t *fa) } } -void R_DarkFieldParticles (float *org, qbyte colour) +//FIXME! +void P_DarkFieldParticles (float *org, qbyte colour) { int i, j, k; vec3_t dir, norg; @@ -1403,7 +1427,7 @@ void R_DarkFieldParticles (float *org, qbyte colour) dir[1] = i; dir[2] = k; - R_RunParticleEffectType(norg, dir, 1, pt_darkfield); + P_RunParticleEffectType(norg, dir, 1, pt_darkfield); } } @@ -1423,13 +1447,13 @@ vec2_t avelocities[NUMVERTEXNORMALS]; // float partstep = 0.01; // float timescale = 0.01; -void R_EntityParticles (float *org, qbyte colour, float *radius) +void P_EntityParticles (float *org, qbyte colour, float *radius) { part_type[pt_entityparticles].areaspread = radius[0]*0.5 + radius[1]*0.5; part_type[pt_entityparticles].areaspreadvert = radius[2]; part_type[pt_entityparticles].colorindex = colour; - R_RunParticleEffectType(org, NULL, 1, pt_entityparticles); + P_RunParticleEffectType(org, NULL, 1, pt_entityparticles); } /* @@ -1438,12 +1462,12 @@ R_ParticleExplosion =============== */ -void R_ParticleExplosion (vec3_t org) +void P_ParticleExplosion (vec3_t org) { // int i, j; // particle_t *p; - R_RunParticleEffectType(org, NULL, 1, pt_explosion); + P_RunParticleEffectType(org, NULL, 1, pt_explosion); R_AddStain(org, -1, -1, -1, 100); /* @@ -1522,12 +1546,12 @@ R_BlobExplosion =============== */ -void R_BlobExplosion (vec3_t org) +void P_BlobExplosion (vec3_t org) { - R_RunParticleEffectType(org, NULL, 1, pt_blob); + P_RunParticleEffectType(org, NULL, 1, pt_blob); } -int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum) +int P_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum) { part_type_t *ptype = &part_type[typenum]; int i, j, k, l; @@ -1821,65 +1845,65 @@ R_RunParticleEffect =============== */ -void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count) +void P_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count) { int ptype; #if 0 if (color == 73) { //blood - R_RunParticleEffectType(org, dir, count, pt_blood); + P_RunParticleEffectType(org, dir, count, pt_blood); return; } if (color == 225) { //lightning blood //a brighter red... - R_RunParticleEffectType(org, dir, count, pt_lightningblood); + P_RunParticleEffectType(org, dir, count, pt_lightningblood); return; } if (color == 0) { //lightning blood - R_RunParticleEffectType(org, dir, count, pt_gunshot); + P_RunParticleEffectType(org, dir, count, pt_gunshot); return; } #endif - ptype = FindParticleType(va("pe_%i", color)); - if (R_RunParticleEffectType(org, dir, count, ptype)) + ptype = P_FindParticleType(va("pe_%i", color)); + if (P_RunParticleEffectType(org, dir, count, ptype)) { if (count > 130 && part_type[pe_size3].loaded) { part_type[pe_size3].colorindex = color & ~0x7; part_type[pe_size3].colorrand = 8; - R_RunParticleEffectType(org, dir, count, pe_size3); + P_RunParticleEffectType(org, dir, count, pe_size3); return; } if (count > 20 && part_type[pe_size2].loaded) { part_type[pe_size2].colorindex = color & ~0x7; part_type[pe_size2].colorrand = 8; - R_RunParticleEffectType(org, dir, count, pe_size2); + P_RunParticleEffectType(org, dir, count, pe_size2); return; } part_type[pe_default].colorindex = color & ~0x7; part_type[pe_default].colorrand = 8; - R_RunParticleEffectType(org, dir, count, pe_default); + P_RunParticleEffectType(org, dir, count, pe_default); return; } } //h2 stylie -void R_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count) +void P_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count) { int i, j; float num; float invcount; vec3_t nvel; - int ptype = FindParticleType(va("pe2_%i_%i", effect, color)); + int ptype = P_FindParticleType(va("pe2_%i_%i", effect, color)); if (ptype < 0) { - ptype = FindParticleType(va("pe2_%i", effect)); + ptype = P_FindParticleType(va("pe2_%i", effect)); if (ptype < 0) ptype = pe_default; @@ -1899,7 +1923,7 @@ void R_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int num = rand() / (float)RAND_MAX; nvel[j] = dmin[j] + ((dmax[j] - dmin[j]) * num); } - R_RunParticleEffectType(org, nvel, invcount, ptype); + P_RunParticleEffectType(org, nvel, invcount, ptype); } } @@ -1911,17 +1935,17 @@ R_RunParticleEffect3 =============== */ //h2 stylie -void R_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count) +void P_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count) { int i, j; vec3_t nvel; float num; float invcount; - int ptype = FindParticleType(va("pe3_%i_%i", effect, color)); + int ptype = P_FindParticleType(va("pe3_%i_%i", effect, color)); if (ptype < 0) { - ptype = FindParticleType(va("pe3_%i", effect)); + ptype = P_FindParticleType(va("pe3_%i", effect)); if (ptype < 0) ptype = pe_default; @@ -1942,7 +1966,7 @@ void R_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int co nvel[j] = (box[j] * num * 2) - box[j]; } - R_RunParticleEffectType(org, nvel, invcount, ptype); + P_RunParticleEffectType(org, nvel, invcount, ptype); } } @@ -1953,17 +1977,17 @@ R_RunParticleEffect4 =============== */ //h2 stylie -void R_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count) +void P_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count) { int i, j; vec3_t nvel; float num; float invcount; - int ptype = FindParticleType(va("pe4_%i_%i", effect, color)); + int ptype = P_FindParticleType(va("pe4_%i_%i", effect, color)); if (ptype < 0) { - ptype = FindParticleType(va("pe4_%i", effect)); + ptype = P_FindParticleType(va("pe4_%i", effect)); if (ptype < 0) ptype = pe_default; @@ -1983,7 +2007,7 @@ void R_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int num = rand() / (float)RAND_MAX; nvel[j] = (radius * num * 2) - radius; } - R_RunParticleEffectType(org, nvel, invcount, ptype); + P_RunParticleEffectType(org, nvel, invcount, ptype); } } @@ -1997,9 +2021,9 @@ R_LavaSplash =============== */ -void R_LavaSplash (vec3_t org) +void P_LavaSplash (vec3_t org) { - R_RunParticleEffectType(org, NULL, 1, pt_lavasplash); + P_RunParticleEffectType(org, NULL, 1, pt_lavasplash); } /* @@ -2008,18 +2032,18 @@ R_TeleportSplash =============== */ -void R_TeleportSplash (vec3_t org) +void P_TeleportSplash (vec3_t org) { - R_RunParticleEffectType(org, NULL, 1, pt_teleportsplash); + P_RunParticleEffectType(org, NULL, 1, pt_teleportsplash); } void CLQ2_BlasterTrail (vec3_t start, vec3_t end) { - R_RocketTrail(start, end, rt_blastertrail, NULL); + P_ParticleTrail(start, end, rt_blastertrail, NULL); } -void R_BlasterParticles (vec3_t start, vec3_t dir) +void P_BlasterParticles (vec3_t start, vec3_t dir) { - R_RunParticleEffectType(start, dir, 1, pt_blasterparticles); + P_RunParticleEffectType(start, dir, 1, pt_blasterparticles); } void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up) @@ -2040,10 +2064,10 @@ void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up) void CLQ2_RailTrail (vec3_t start, vec3_t end) { - R_RocketTrail(start, end, rt_railtrail, NULL); + P_ParticleTrail(start, end, rt_railtrail, NULL); } -int R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts) +int P_ParticleTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts) { vec3_t vec, right, up; float len; @@ -2068,10 +2092,10 @@ int R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts) { trailstate_t nts; memcpy(&nts, ts, sizeof(nts)); - R_RocketTrail(vec, end, ptype->assoc, &nts); + P_ParticleTrail(vec, end, ptype->assoc, &nts); } else - R_RocketTrail(vec, end, ptype->assoc, NULL); + P_ParticleTrail(vec, end, ptype->assoc, NULL); } else if (!ptype->die) ts = NULL; @@ -2321,7 +2345,7 @@ int R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts) return 0; } -void R_TorchEffect (vec3_t pos, int type) +void P_TorchEffect (vec3_t pos, int type) { #ifdef SIDEVIEWS if (r_secondaryview) //this is called when the models are actually drawn. @@ -2330,12 +2354,12 @@ void R_TorchEffect (vec3_t pos, int type) if (cl.paused) return; - R_RunParticleEffectType(pos, NULL, host_frametime, type); + P_RunParticleEffectType(pos, NULL, host_frametime, type); } void CLQ2_BubbleTrail (vec3_t start, vec3_t end) { - R_RocketTrail(start, end, rt_bubbletrail, NULL); + P_ParticleTrail(start, end, rt_bubbletrail, NULL); } #ifdef Q2BSPS @@ -3162,11 +3186,11 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void if (type->emit >= 0) { if (type->emittime < 0) - R_RocketTrail(oldorg, p->org, type->emit, NULL); + P_ParticleTrail(oldorg, p->org, type->emit, NULL); else if (p->nextemit < particletime) { p->nextemit = particletime + type->emittime + frandom()*type->emitrand; - R_RunParticleEffectType(p->org, p->vel, 1, type->emit); + P_RunParticleEffectType(p->org, p->vel, 1, type->emit); } } @@ -3197,7 +3221,7 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void { p->die = -1; VectorNormalize(p->vel); - R_RunParticleEffectType(stop, p->vel, type->clipcount/part_type[type->cliptype].count, type->cliptype); + P_RunParticleEffectType(stop, p->vel, type->clipcount/part_type[type->cliptype].count, type->cliptype); } continue; @@ -3330,9 +3354,9 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void R_DrawParticles =============== */ -void R_DrawParticles (void) +void P_DrawParticles (void) { - R_AddRainParticles(); + P_AddRainParticles(); #if defined(RGLQUAKE) if (qrenderer == QR_OPENGL) { diff --git a/engine/client/render.h b/engine/client/render.h index c283dafcc..150d41b8d 100644 --- a/engine/client/render.h +++ b/engine/client/render.h @@ -199,29 +199,6 @@ void MediaSW_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *p void MediaSW_ShowFrameRGBA_32(qbyte *framedata, int inwidth, int inheight); //top down void MediaSW_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight); //input is bottom up... #endif -void R_ParseParticleEffect (void); -void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count); - -typedef struct { - float lastdist; - struct beamseg_s *lastbeam; // last beam point -} trailstate_t; -int R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *oldpoint); -int R_RunParticleEffectType(vec3_t org, vec3_t dir, float count, int type); -void R_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count); -void R_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count); -void R_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count); -int AllocateParticleType(char *name); - -void R_DefaultTrail (struct model_s *model); -void R_TorchEffect (vec3_t pos, int type); - -void R_EntityParticles (float *org, qbyte colour, float *radius); -void R_BlobExplosion (vec3_t org); -qboolean R_EMPExplosion (vec3_t org); -void R_ParticleExplosion (vec3_t org); -void R_LavaSplash (vec3_t org); -void R_TeleportSplash (vec3_t org); void R_AddEfrags (entity_t *ent); void R_RemoveEfrags (entity_t *ent); @@ -284,15 +261,9 @@ void Media_CaptureDemoEnd(void); void Media_RecordAudioFrame (short *sample_buffer, int samples); void Media_RecordFrame (void); -void R_Part_SkyTri(float *v1, float *v2, float *v3, struct msurface_s *surf); -void R_ClearParticles (void); -void R_Part_NewServer(void); -int ParticleTypeForName(char *name); void R_SetRenderer(int wanted); -void R_DrawParticles (void); -void R_InitParticles (void); void RQ_Init(void); -void R_BlasterParticles (vec3_t org, vec3_t dir); + void CLQ2_RailTrail (vec3_t start, vec3_t end); void CLQ2_BubbleTrail (vec3_t start, vec3_t end); void CLQ2_EntityEvent(entity_state_t *es); diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 5349c96f8..10390b16a 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -538,7 +538,7 @@ void Renderer_Init(void) Cmd_AddCommand("bul_make", R_BulletenForce_f); - R_InitParticles(); + P_InitParticles(); R_InitTextures(); RQ_Init(); } diff --git a/engine/client/skin.c b/engine/client/skin.c index 292ae5ad4..59b870e6c 100644 --- a/engine/client/skin.c +++ b/engine/client/skin.c @@ -491,9 +491,6 @@ void Skin_NextDownload (void) if (cls.state != ca_active) { // get next signon phase -#ifdef CSQC_DAT - CSQC_Init(); -#endif CL_SendClientCommand("begin %i", cl.servercount); Cache_Report (); // print remaining memory } diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index d0ea32a7e..f3d77c682 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -98,7 +98,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define EMAILSERVER //smtp/pop3 server should you feel a need #define EMAILCLIENT //smtp/pop3 clients (email notifications) #define RUNTIMELIGHTING //calculate lit/lux files the first time the map is loaded and doesn't have a loadable lit. - #define QTERM //qterm... adds a console command that allows running programs from within quake - bit like xterm. +// #define QTERM //qterm... adds a console command that allows running programs from within quake - bit like xterm. #define CL_MASTER //query master servers and stuff for a dynamic server listing. #define SERIALMOUSE //means that the engine talks to a serial mouse directly via the com/serial port. Thus allowing duel mice with seperate inputs. #define R_XFLIP //allow view to be flipped horizontally @@ -108,9 +108,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PLUGINS -#ifdef _DEBUG #define CSQC_DAT //support for csqc -#endif #define MENU_DAT //support for menu.dat #define Q3SHADERS diff --git a/engine/common/console.h b/engine/common/console.h index 648b5c3ae..16c431996 100644 --- a/engine/common/console.h +++ b/engine/common/console.h @@ -67,7 +67,9 @@ typedef struct console_s int linewidth; int totallines; int vislines; - void (*redirect) (struct console_s *con, int key); + int commandcompletion; //allows tab completion of quake console commands + void (*linebuffered) (struct console_s *con, char *line); //if present, called on enter, causes the standard console input to appear. + void (*redirect) (struct console_s *con, int key); //if present, called every characture. void *userdata; struct console_s *next; } console_t; @@ -99,6 +101,8 @@ void Con_DrawNotify (void); void Con_ClearNotify (void); void Con_ToggleConsole_f (void); +void Con_ExecuteLine(console_t *con, char *line); //takes normal console commands + void Con_CycleConsole (void); qboolean Con_IsActive (console_t *con); diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 161d282a1..edd590c44 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -3431,7 +3431,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned #ifndef SERVERONLY mod->radius = RadiusFromBounds (mod->mins, mod->maxs); - R_DefaultTrail(mod); + P_DefaultTrail(mod); #endif } } diff --git a/engine/common/math.s b/engine/common/math.s index 49b6ce6e2..a3d240e7c 100644 --- a/engine/common/math.s +++ b/engine/common/math.s @@ -56,53 +56,6 @@ LOutOfRange: movl $0xFFFFFFFF,%eax ret -#define in 4 -#define out 8 -#ifndef SERVERONLY - .align 2 -.globl C(TransformVector) -C(TransformVector): - movl in(%esp),%eax - movl out(%esp),%edx - - flds (%eax) // in[0] - fmuls C(vright) // in[0]*vright[0] - flds (%eax) // in[0] | in[0]*vright[0] - fmuls C(vup) // in[0]*vup[0] | in[0]*vright[0] - flds (%eax) // in[0] | in[0]*vup[0] | in[0]*vright[0] - fmuls C(vpn) // in[0]*vpn[0] | in[0]*vup[0] | in[0]*vright[0] - - flds 4(%eax) // in[1] | ... - fmuls C(vright)+4 // in[1]*vright[1] | ... - flds 4(%eax) // in[1] | in[1]*vright[1] | ... - fmuls C(vup)+4 // in[1]*vup[1] | in[1]*vright[1] | ... - flds 4(%eax) // in[1] | in[1]*vup[1] | in[1]*vright[1] | ... - fmuls C(vpn)+4 // in[1]*vpn[1] | in[1]*vup[1] | in[1]*vright[1] | ... - fxch %st(2) // in[1]*vright[1] | in[1]*vup[1] | in[1]*vpn[1] | ... - - faddp %st(0),%st(5) // in[1]*vup[1] | in[1]*vpn[1] | ... - faddp %st(0),%st(3) // in[1]*vpn[1] | ... - faddp %st(0),%st(1) // vpn_accum | vup_accum | vright_accum - - flds 8(%eax) // in[2] | ... - fmuls C(vright)+8 // in[2]*vright[2] | ... - flds 8(%eax) // in[2] | in[2]*vright[2] | ... - fmuls C(vup)+8 // in[2]*vup[2] | in[2]*vright[2] | ... - flds 8(%eax) // in[2] | in[2]*vup[2] | in[2]*vright[2] | ... - fmuls C(vpn)+8 // in[2]*vpn[2] | in[2]*vup[2] | in[2]*vright[2] | ... - fxch %st(2) // in[2]*vright[2] | in[2]*vup[2] | in[2]*vpn[2] | ... - - faddp %st(0),%st(5) // in[2]*vup[2] | in[2]*vpn[2] | ... - faddp %st(0),%st(3) // in[2]*vpn[2] | ... - faddp %st(0),%st(1) // vpn_accum | vup_accum | vright_accum - - fstps 8(%edx) // out[2] - fstps 4(%edx) // out[1] - fstps (%edx) // out[0] - - ret -#endif - #define EMINS 4+4 #define EMAXS 4+8 #define P 4+12 diff --git a/engine/common/particles.h b/engine/common/particles.h index ab0424ecd..4ea4404a4 100644 --- a/engine/common/particles.h +++ b/engine/common/particles.h @@ -86,4 +86,52 @@ typedef struct beamseg_s #define crandom() (rand()*(2.0f/RAND_MAX)-1.0f) #define hrandom() (rand()*(1.0f/RAND_MAX)-0.5f) +//main functions +void P_DrawParticles (void); +void P_InitParticles (void); +void P_ClearParticles (void); +void P_NewServer(void); + +//allocate a new effect +int P_ParticleTypeForName(char *name); +int P_AllocateParticleType(char *name); + +void P_SkyTri(float *v1, float *v2, float *v3, struct msurface_s *surf); + +//wierd effects +void P_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count); //aka: the particle builtin. +void P_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count); //these three are needed for hexen2. +void P_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count); +void P_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count); + +void P_DarkFieldParticles (float *org, qbyte colour); +void P_EntityParticles (float *org, qbyte colour, float *radius); //nq's EF_BRIGHTFIELD +void P_TorchEffect (vec3_t pos, int type); //particles centered around a model, called every frame for those models. + +//functions that spawn trails (basically just pass throughs) +void P_BlasterParticles (vec3_t org, vec3_t dir); + +//functions that spawn point effects (basically just pass throughs) +void P_BlobExplosion (vec3_t org); //tarbaby explosion or TF emp. +void P_ParticleExplosion (vec3_t org); //rocket explosion (sprite is allocated seperatly :( ) +void P_LavaSplash (vec3_t org); //cthon dying, or a gas grenade. +void P_TeleportSplash (vec3_t org); //teleporter effect. + + + +typedef struct { + float lastdist; + struct beamseg_s *lastbeam; // last beam point +} trailstate_t; +//the core spawn function for trails. (trailstate can be null) +int P_ParticleTrail (vec3_t start, vec3_t end, int type, trailstate_t *trailstate); + +void P_DefaultTrail (struct model_s *model); //fills in the default particle properties for a loaded model. Should already have the model flags set. + +//the core spawn function for point effects +int P_RunParticleEffectType(vec3_t org, vec3_t dir, float count, int type); //1 if failed. + + +void P_EmitSkyEffectTris(struct model_s *mod, struct msurface_s *fa); + #endif diff --git a/engine/common/plugin.c b/engine/common/plugin.c index 99be860c7..74cfdecaa 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -24,6 +24,8 @@ typedef struct plugin_s { struct plugin_s *next; } plugin_t; +void Plug_SubConsoleCommand(console_t *con, char *line); + plugin_t *currentplug; //custom plugin builtins. @@ -756,6 +758,12 @@ int Plug_Con_SubPrint(void *offset, unsigned int mask, const long *arg) { con = Con_Create(name); Con_SetVisible(con); + + if (currentplug->conexecutecommand) + { + con->userdata = currentplug; + con->linebuffered = Plug_SubConsoleCommand; + } } Con_PrintCon(con, text); @@ -1180,6 +1188,18 @@ qboolean Plugin_ExecuteString(void) return false; } +void Plug_SubConsoleCommand(console_t *con, char *line) +{ + char buffer[2048]; + plugin_t *oldplug = currentplug; //shouldn't really be needed, but oh well + currentplug = con->userdata; + + Q_strncpyz(buffer, va("%s %s", con->name, line), sizeof(buffer)); + Cmd_TokenizeString(buffer, false, false); + VM_Call(currentplug->vm, currentplug->conexecutecommand, 0); + currentplug = oldplug; +} + qboolean Plug_Menu_Event(int eventtype, int param) //eventtype = draw/keydown/keyup, param = time/key { plugin_t *oc=currentplug; diff --git a/engine/common/protocol.h b/engine/common/protocol.h index cae845f0c..a4dbfdbcc 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -56,9 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PEXT_SHOWPIC 0x04000000 #define PEXT_SETATTACHMENT 0x08000000 //md3 tags (needs networking, they need to lerp). //#define PEXT_PK3DOWNLOADS 0x10000000 //retrieve a list of pk3s/pk3s/paks for downloading (with optional URL and crcs) -#ifdef _DEBUG #define PEXT_CHUNKEDDOWNLOADS 0x20000000 //alternate file download method. Hopefully it'll give quadroupled download speed, especially on higher pings. -#endif #ifdef CSQC_DAT #define PEXT_CSQC 0x40000000 //csqc additions @@ -863,6 +861,297 @@ typedef struct q1usercmd_s //ROGUE + + +#define Q2SND_VOLUME (1<<0) // a qbyte +#define Q2SND_ATTENUATION (1<<1) // a qbyte +#define Q2SND_POS (1<<2) // three coordinates +#define Q2SND_ENT (1<<3) // a short 0-2: channel, 3-12: entity +#define Q2SND_OFFSET (1<<4) // a qbyte, msec offset from frame start + +#define Q2DEFAULT_SOUND_PACKET_VOLUME 1.0 +#define Q2DEFAULT_SOUND_PACKET_ATTENUATION 1.0 + + +#define ATTN_NONE 0 +#define ATTN_NORM 1 +#define CHAN_AUTO 0 +#define CHAN_WEAPON 1 +#define CHAN_VOICE 2 +#define CHAN_ITEM 3 +#define CHAN_BODY 4 + +#define Q2MZ_BLASTER 0 +#define Q2MZ_MACHINEGUN 1 +#define Q2MZ_SHOTGUN 2 +#define Q2MZ_CHAINGUN1 3 +#define Q2MZ_CHAINGUN2 4 +#define Q2MZ_CHAINGUN3 5 +#define Q2MZ_RAILGUN 6 +#define Q2MZ_ROCKET 7 +#define Q2MZ_GRENADE 8 +#define Q2MZ_LOGIN 9 +#define Q2MZ_LOGOUT 10 +#define Q2MZ_RESPAWN 11 +#define Q2MZ_BFG 12 +#define Q2MZ_SSHOTGUN 13 +#define Q2MZ_HYPERBLASTER 14 +#define Q2MZ_ITEMRESPAWN 15 +// RAFAEL +#define Q2MZ_IONRIPPER 16 +#define Q2MZ_BLUEHYPERBLASTER 17 +#define Q2MZ_PHALANX 18 +#define Q2MZ_SILENCED 128 // bit flag ORed with one of the above numbers + +//ROGUE +#define Q2MZ_ETF_RIFLE 30 +#define Q2MZ_UNUSED 31 +#define Q2MZ_SHOTGUN2 32 +#define Q2MZ_HEATBEAM 33 +#define Q2MZ_BLASTER2 34 +#define Q2MZ_TRACKER 35 +#define Q2MZ_NUKE1 36 +#define Q2MZ_NUKE2 37 +#define Q2MZ_NUKE4 38 +#define Q2MZ_NUKE8 39 +//ROGUE + +// +// monster muzzle flashes +// +#define Q2MZ2_TANK_BLASTER_1 1 +#define Q2MZ2_TANK_BLASTER_2 2 +#define Q2MZ2_TANK_BLASTER_3 3 +#define Q2MZ2_TANK_MACHINEGUN_1 4 +#define Q2MZ2_TANK_MACHINEGUN_2 5 +#define Q2MZ2_TANK_MACHINEGUN_3 6 +#define Q2MZ2_TANK_MACHINEGUN_4 7 +#define Q2MZ2_TANK_MACHINEGUN_5 8 +#define Q2MZ2_TANK_MACHINEGUN_6 9 +#define Q2MZ2_TANK_MACHINEGUN_7 10 +#define Q2MZ2_TANK_MACHINEGUN_8 11 +#define Q2MZ2_TANK_MACHINEGUN_9 12 +#define Q2MZ2_TANK_MACHINEGUN_10 13 +#define Q2MZ2_TANK_MACHINEGUN_11 14 +#define Q2MZ2_TANK_MACHINEGUN_12 15 +#define Q2MZ2_TANK_MACHINEGUN_13 16 +#define Q2MZ2_TANK_MACHINEGUN_14 17 +#define Q2MZ2_TANK_MACHINEGUN_15 18 +#define Q2MZ2_TANK_MACHINEGUN_16 19 +#define Q2MZ2_TANK_MACHINEGUN_17 20 +#define Q2MZ2_TANK_MACHINEGUN_18 21 +#define Q2MZ2_TANK_MACHINEGUN_19 22 +#define Q2MZ2_TANK_ROCKET_1 23 +#define Q2MZ2_TANK_ROCKET_2 24 +#define Q2MZ2_TANK_ROCKET_3 25 + +#define Q2MZ2_INFANTRY_MACHINEGUN_1 26 +#define Q2MZ2_INFANTRY_MACHINEGUN_2 27 +#define Q2MZ2_INFANTRY_MACHINEGUN_3 28 +#define Q2MZ2_INFANTRY_MACHINEGUN_4 29 +#define Q2MZ2_INFANTRY_MACHINEGUN_5 30 +#define Q2MZ2_INFANTRY_MACHINEGUN_6 31 +#define Q2MZ2_INFANTRY_MACHINEGUN_7 32 +#define Q2MZ2_INFANTRY_MACHINEGUN_8 33 +#define Q2MZ2_INFANTRY_MACHINEGUN_9 34 +#define Q2MZ2_INFANTRY_MACHINEGUN_10 35 +#define Q2MZ2_INFANTRY_MACHINEGUN_11 36 +#define Q2MZ2_INFANTRY_MACHINEGUN_12 37 +#define Q2MZ2_INFANTRY_MACHINEGUN_13 38 + +#define Q2MZ2_SOLDIER_BLASTER_1 39 +#define Q2MZ2_SOLDIER_BLASTER_2 40 +#define Q2MZ2_SOLDIER_SHOTGUN_1 41 +#define Q2MZ2_SOLDIER_SHOTGUN_2 42 +#define Q2MZ2_SOLDIER_MACHINEGUN_1 43 +#define Q2MZ2_SOLDIER_MACHINEGUN_2 44 + +#define Q2MZ2_GUNNER_MACHINEGUN_1 45 +#define Q2MZ2_GUNNER_MACHINEGUN_2 46 +#define Q2MZ2_GUNNER_MACHINEGUN_3 47 +#define Q2MZ2_GUNNER_MACHINEGUN_4 48 +#define Q2MZ2_GUNNER_MACHINEGUN_5 49 +#define Q2MZ2_GUNNER_MACHINEGUN_6 50 +#define Q2MZ2_GUNNER_MACHINEGUN_7 51 +#define Q2MZ2_GUNNER_MACHINEGUN_8 52 +#define Q2MZ2_GUNNER_GRENADE_1 53 +#define Q2MZ2_GUNNER_GRENADE_2 54 +#define Q2MZ2_GUNNER_GRENADE_3 55 +#define Q2MZ2_GUNNER_GRENADE_4 56 + +#define Q2MZ2_CHICK_ROCKET_1 57 + +#define Q2MZ2_FLYER_BLASTER_1 58 +#define Q2MZ2_FLYER_BLASTER_2 59 + +#define Q2MZ2_MEDIC_BLASTER_1 60 + +#define Q2MZ2_GLADIATOR_RAILGUN_1 61 + +#define Q2MZ2_HOVER_BLASTER_1 62 + +#define Q2MZ2_ACTOR_MACHINEGUN_1 63 + +#define Q2MZ2_SUPERTANK_MACHINEGUN_1 64 +#define Q2MZ2_SUPERTANK_MACHINEGUN_2 65 +#define Q2MZ2_SUPERTANK_MACHINEGUN_3 66 +#define Q2MZ2_SUPERTANK_MACHINEGUN_4 67 +#define Q2MZ2_SUPERTANK_MACHINEGUN_5 68 +#define Q2MZ2_SUPERTANK_MACHINEGUN_6 69 +#define Q2MZ2_SUPERTANK_ROCKET_1 70 +#define Q2MZ2_SUPERTANK_ROCKET_2 71 +#define Q2MZ2_SUPERTANK_ROCKET_3 72 + +#define Q2MZ2_BOSS2_MACHINEGUN_L1 73 +#define Q2MZ2_BOSS2_MACHINEGUN_L2 74 +#define Q2MZ2_BOSS2_MACHINEGUN_L3 75 +#define Q2MZ2_BOSS2_MACHINEGUN_L4 76 +#define Q2MZ2_BOSS2_MACHINEGUN_L5 77 +#define Q2MZ2_BOSS2_ROCKET_1 78 +#define Q2MZ2_BOSS2_ROCKET_2 79 +#define Q2MZ2_BOSS2_ROCKET_3 80 +#define Q2MZ2_BOSS2_ROCKET_4 81 + +#define Q2MZ2_FLOAT_BLASTER_1 82 + +#define Q2MZ2_SOLDIER_BLASTER_3 83 +#define Q2MZ2_SOLDIER_SHOTGUN_3 84 +#define Q2MZ2_SOLDIER_MACHINEGUN_3 85 +#define Q2MZ2_SOLDIER_BLASTER_4 86 +#define Q2MZ2_SOLDIER_SHOTGUN_4 87 +#define Q2MZ2_SOLDIER_MACHINEGUN_4 88 +#define Q2MZ2_SOLDIER_BLASTER_5 89 +#define Q2MZ2_SOLDIER_SHOTGUN_5 90 +#define Q2MZ2_SOLDIER_MACHINEGUN_5 91 +#define Q2MZ2_SOLDIER_BLASTER_6 92 +#define Q2MZ2_SOLDIER_SHOTGUN_6 93 +#define Q2MZ2_SOLDIER_MACHINEGUN_6 94 +#define Q2MZ2_SOLDIER_BLASTER_7 95 +#define Q2MZ2_SOLDIER_SHOTGUN_7 96 +#define Q2MZ2_SOLDIER_MACHINEGUN_7 97 +#define Q2MZ2_SOLDIER_BLASTER_8 98 +#define Q2MZ2_SOLDIER_SHOTGUN_8 99 +#define Q2MZ2_SOLDIER_MACHINEGUN_8 100 + +// --- Xian shit below --- +#define Q2MZ2_MAKRON_BFG 101 +#define Q2MZ2_MAKRON_BLASTER_1 102 +#define Q2MZ2_MAKRON_BLASTER_2 103 +#define Q2MZ2_MAKRON_BLASTER_3 104 +#define Q2MZ2_MAKRON_BLASTER_4 105 +#define Q2MZ2_MAKRON_BLASTER_5 106 +#define Q2MZ2_MAKRON_BLASTER_6 107 +#define Q2MZ2_MAKRON_BLASTER_7 108 +#define Q2MZ2_MAKRON_BLASTER_8 109 +#define Q2MZ2_MAKRON_BLASTER_9 110 +#define Q2MZ2_MAKRON_BLASTER_10 111 +#define Q2MZ2_MAKRON_BLASTER_11 112 +#define Q2MZ2_MAKRON_BLASTER_12 113 +#define Q2MZ2_MAKRON_BLASTER_13 114 +#define Q2MZ2_MAKRON_BLASTER_14 115 +#define Q2MZ2_MAKRON_BLASTER_15 116 +#define Q2MZ2_MAKRON_BLASTER_16 117 +#define Q2MZ2_MAKRON_BLASTER_17 118 +#define Q2MZ2_MAKRON_RAILGUN_1 119 +#define Q2MZ2_JORG_MACHINEGUN_L1 120 +#define Q2MZ2_JORG_MACHINEGUN_L2 121 +#define Q2MZ2_JORG_MACHINEGUN_L3 122 +#define Q2MZ2_JORG_MACHINEGUN_L4 123 +#define Q2MZ2_JORG_MACHINEGUN_L5 124 +#define Q2MZ2_JORG_MACHINEGUN_L6 125 +#define Q2MZ2_JORG_MACHINEGUN_R1 126 +#define Q2MZ2_JORG_MACHINEGUN_R2 127 +#define Q2MZ2_JORG_MACHINEGUN_R3 128 +#define Q2MZ2_JORG_MACHINEGUN_R4 129 +#define Q2MZ2_JORG_MACHINEGUN_R5 130 +#define Q2MZ2_JORG_MACHINEGUN_R6 131 +#define Q2MZ2_JORG_BFG_1 132 +#define Q2MZ2_BOSS2_MACHINEGUN_R1 133 +#define Q2MZ2_BOSS2_MACHINEGUN_R2 134 +#define Q2MZ2_BOSS2_MACHINEGUN_R3 135 +#define Q2MZ2_BOSS2_MACHINEGUN_R4 136 +#define Q2MZ2_BOSS2_MACHINEGUN_R5 137 + +//ROGUE +#define Q2MZ2_CARRIER_MACHINEGUN_L1 138 +#define Q2MZ2_CARRIER_MACHINEGUN_R1 139 +#define Q2MZ2_CARRIER_GRENADE 140 +#define Q2MZ2_TURRET_MACHINEGUN 141 +#define Q2MZ2_TURRET_ROCKET 142 +#define Q2MZ2_TURRET_BLASTER 143 +#define Q2MZ2_STALKER_BLASTER 144 +#define Q2MZ2_DAEDALUS_BLASTER 145 +#define Q2MZ2_MEDIC_BLASTER_2 146 +#define Q2MZ2_CARRIER_RAILGUN 147 +#define Q2MZ2_WIDOW_DISRUPTOR 148 +#define Q2MZ2_WIDOW_BLASTER 149 +#define Q2MZ2_WIDOW_RAIL 150 +#define Q2MZ2_WIDOW_PLASMABEAM 151 // PMM - not used +#define Q2MZ2_CARRIER_MACHINEGUN_L2 152 +#define Q2MZ2_CARRIER_MACHINEGUN_R2 153 +#define Q2MZ2_WIDOW_RAIL_LEFT 154 +#define Q2MZ2_WIDOW_RAIL_RIGHT 155 +#define Q2MZ2_WIDOW_BLASTER_SWEEP1 156 +#define Q2MZ2_WIDOW_BLASTER_SWEEP2 157 +#define Q2MZ2_WIDOW_BLASTER_SWEEP3 158 +#define Q2MZ2_WIDOW_BLASTER_SWEEP4 159 +#define Q2MZ2_WIDOW_BLASTER_SWEEP5 160 +#define Q2MZ2_WIDOW_BLASTER_SWEEP6 161 +#define Q2MZ2_WIDOW_BLASTER_SWEEP7 162 +#define Q2MZ2_WIDOW_BLASTER_SWEEP8 163 +#define Q2MZ2_WIDOW_BLASTER_SWEEP9 164 +#define Q2MZ2_WIDOW_BLASTER_100 165 +#define Q2MZ2_WIDOW_BLASTER_90 166 +#define Q2MZ2_WIDOW_BLASTER_80 167 +#define Q2MZ2_WIDOW_BLASTER_70 168 +#define Q2MZ2_WIDOW_BLASTER_60 169 +#define Q2MZ2_WIDOW_BLASTER_50 170 +#define Q2MZ2_WIDOW_BLASTER_40 171 +#define Q2MZ2_WIDOW_BLASTER_30 172 +#define Q2MZ2_WIDOW_BLASTER_20 173 +#define Q2MZ2_WIDOW_BLASTER_10 174 +#define Q2MZ2_WIDOW_BLASTER_0 175 +#define Q2MZ2_WIDOW_BLASTER_10L 176 +#define Q2MZ2_WIDOW_BLASTER_20L 177 +#define Q2MZ2_WIDOW_BLASTER_30L 178 +#define Q2MZ2_WIDOW_BLASTER_40L 179 +#define Q2MZ2_WIDOW_BLASTER_50L 180 +#define Q2MZ2_WIDOW_BLASTER_60L 181 +#define Q2MZ2_WIDOW_BLASTER_70L 182 +#define Q2MZ2_WIDOW_RUN_1 183 +#define Q2MZ2_WIDOW_RUN_2 184 +#define Q2MZ2_WIDOW_RUN_3 185 +#define Q2MZ2_WIDOW_RUN_4 186 +#define Q2MZ2_WIDOW_RUN_5 187 +#define Q2MZ2_WIDOW_RUN_6 188 +#define Q2MZ2_WIDOW_RUN_7 189 +#define Q2MZ2_WIDOW_RUN_8 190 +#define Q2MZ2_CARRIER_ROCKET_1 191 +#define Q2MZ2_CARRIER_ROCKET_2 192 +#define Q2MZ2_CARRIER_ROCKET_3 193 +#define Q2MZ2_CARRIER_ROCKET_4 194 +#define Q2MZ2_WIDOW2_BEAMER_1 195 +#define Q2MZ2_WIDOW2_BEAMER_2 196 +#define Q2MZ2_WIDOW2_BEAMER_3 197 +#define Q2MZ2_WIDOW2_BEAMER_4 198 +#define Q2MZ2_WIDOW2_BEAMER_5 199 +#define Q2MZ2_WIDOW2_BEAM_SWEEP_1 200 +#define Q2MZ2_WIDOW2_BEAM_SWEEP_2 201 +#define Q2MZ2_WIDOW2_BEAM_SWEEP_3 202 +#define Q2MZ2_WIDOW2_BEAM_SWEEP_4 203 +#define Q2MZ2_WIDOW2_BEAM_SWEEP_5 204 +#define Q2MZ2_WIDOW2_BEAM_SWEEP_6 205 +#define Q2MZ2_WIDOW2_BEAM_SWEEP_7 206 +#define Q2MZ2_WIDOW2_BEAM_SWEEP_8 207 +#define Q2MZ2_WIDOW2_BEAM_SWEEP_9 208 +#define Q2MZ2_WIDOW2_BEAM_SWEEP_10 209 +#define Q2MZ2_WIDOW2_BEAM_SWEEP_11 210 + + + + + + #define MAX_MAP_AREA_BYTES 32 // edict->drawflags (hexen2 stuff) diff --git a/engine/common/qvm.c b/engine/common/qvm.c index 1cefe351d..943f3cb0e 100644 --- a/engine/common/qvm.c +++ b/engine/common/qvm.c @@ -1047,6 +1047,8 @@ void *VM_MemoryBase(vm_t *vm) return NULL; case VM_BYTECODE: return ((qvm_t*)vm->hInst)->ds; + default: + return NULL; } } diff --git a/engine/common/vm.h b/engine/common/vm.h index 762bda57a..29ea76e31 100644 --- a/engine/common/vm.h +++ b/engine/common/vm.h @@ -27,6 +27,7 @@ vm_t *VM_Create(vm_t *vm, const char *name, sys_call_t syscall, sys_callex_t sys void VM_Destroy(vm_t *vm); qboolean VM_Restart(vm_t *vm); int VARGS VM_Call(vm_t *vm, int instruction, ...); +void *VM_MemoryBase(vm_t *vm); diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 936254ddd..a09dbf93d 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -548,7 +548,7 @@ model_t *GLMod_LoadModel (model_t *mod, qboolean crash) { Mod_LoadQ2BrushModel (mod, buf); mod->needload = false; - R_DefaultTrail(mod); + P_DefaultTrail(mod); return mod; } #endif @@ -582,7 +582,7 @@ model_t *GLMod_LoadModel (model_t *mod, qboolean crash) { mod->needload = false; GLMod_LoadDoomSprite(mod); - R_DefaultTrail(mod); + P_DefaultTrail(mod); return mod; } #endif @@ -600,7 +600,7 @@ couldntload: mod->maxs[1] = 16; mod->maxs[2] = 16; mod->needload = true; - R_DefaultTrail(mod); + P_DefaultTrail(mod); return mod; return NULL; } @@ -682,7 +682,7 @@ couldntload: goto couldntload; } - R_DefaultTrail(mod); + P_DefaultTrail(mod); return mod; } @@ -966,7 +966,7 @@ TRACE(("dbg: GLMod_LoadTextures: inittexturedescs\n")); tx->width = mt->width; tx->height = mt->height; - tx->parttype = ParticleTypeForName(va("tex_%s", tx->name)); + tx->parttype = P_ParticleTypeForName(va("tex_%s", tx->name)); if (!mt->offsets[0]) //this is a hl external style texture, load it a little later (from a wad) { @@ -2685,7 +2685,7 @@ void GLMod_LoadBrushModel (model_t *mod, void *buffer) strcpy (loadmodel->name, name); mod = loadmodel; - R_DefaultTrail(mod); + P_DefaultTrail(mod); } } #ifdef RUNTIMELIGHTING diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index 4db9c850a..0e7307af0 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -742,7 +742,7 @@ void GLR_DrawEntitiesOnList (void) { if (gl_part_flame.value) { - R_TorchEffect(currententity->origin, currententity->model->particleeffect); + P_TorchEffect(currententity->origin, currententity->model->particleeffect); currententity->model = NULL; continue; } @@ -751,7 +751,7 @@ void GLR_DrawEntitiesOnList (void) { if (gl_part_torch.value) { - R_TorchEffect(currententity->origin, currententity->model->particleeffect); + P_TorchEffect(currententity->origin, currententity->model->particleeffect); } } } @@ -875,7 +875,7 @@ void GLR_DrawViewModel (void) { if (gl_part_flame.value) { - R_TorchEffect(currententity->origin, currententity->model->particleeffect); + P_TorchEffect(currententity->origin, currententity->model->particleeffect); currententity->model = NULL; return; } @@ -884,7 +884,7 @@ void GLR_DrawViewModel (void) { if (gl_part_torch.value) { - R_TorchEffect(currententity->origin, currententity->model->particleeffect); + P_TorchEffect(currententity->origin, currententity->model->particleeffect); } } } @@ -1461,7 +1461,7 @@ void R_RenderScene (void) if (cl.worldmodel) { TRACE(("dbg: calling R_DrawParticles\n")); - R_DrawParticles (); + P_DrawParticles (); } #ifdef GLTEST diff --git a/engine/gl/gl_rmisc.c b/engine/gl/gl_rmisc.c index 1d1d458d1..11c477ae4 100644 --- a/engine/gl/gl_rmisc.c +++ b/engine/gl/gl_rmisc.c @@ -650,7 +650,6 @@ void GLR_Init (void) { Cmd_AddRemCommand ("timerefresh", GLR_TimeRefresh_f); Cmd_AddRemCommand ("envmap", R_Envmap_f); - Cmd_AddRemCommand ("pointfile", R_ReadPointFile_f); // Cmd_AddRemCommand ("makewad", R_MakeTexWad_f); @@ -977,7 +976,7 @@ void GLR_NewMap (void) r_oldviewcluster = 0; r_viewcluster2 = -1; TRACE(("dbg: GLR_NewMap: clear particles\n")); - R_ClearParticles (); + P_ClearParticles (); TRACE(("dbg: GLR_NewMap: wiping them stains (getting the cloth out)\n")); GLR_WipeStains(); TRACE(("dbg: GLR_NewMap: building lightmaps\n")); diff --git a/engine/gl/gl_rsurf.c b/engine/gl/gl_rsurf.c index 37815cfd5..ca6350137 100644 --- a/engine/gl/gl_rsurf.c +++ b/engine/gl/gl_rsurf.c @@ -3965,7 +3965,7 @@ void GL_BuildLightmaps (void) } GL_CreateSurfaceLightmap (m->surfaces + i); - R_EmitSkyEffectTris(m, &m->surfaces[i]); + P_EmitSkyEffectTris(m, &m->surfaces[i]); if (m->surfaces[i].polys) //there are some surfaces that have a display list already (the subdivided ones) continue; BuildSurfaceDisplayList (m->surfaces + i); diff --git a/engine/gl/glquake.h b/engine/gl/glquake.h index 4f965256d..2f4298597 100644 --- a/engine/gl/glquake.h +++ b/engine/gl/glquake.h @@ -48,7 +48,6 @@ void GL_InitFogTexture(void); void GL_BeginRendering (int *x, int *y, int *width, int *height); void GL_EndRendering (void); -void R_EmitSkyEffectTris(model_t *mod, msurface_t *fa); void GLR_BrightenScreen (void); void GLR_NetGraph (void); void GLR_DrawAlphaSurfaces (void); @@ -154,7 +153,6 @@ extern int glx, gly, glwidth, glheight; void R_TimeRefresh_f (void); -void R_ReadPointFile_f (void); texture_t *SWR_TextureAnimation (texture_t *base); texture_t *GLR_TextureAnimation (texture_t *base); diff --git a/engine/qclib/pr_edict.c b/engine/qclib/pr_edict.c index 8685ce870..c56742128 100644 --- a/engine/qclib/pr_edict.c +++ b/engine/qclib/pr_edict.c @@ -2287,7 +2287,7 @@ retry: } //progs contains enough info for use to recompile it. - if (trysleft && externs->autocompile == PR_COMPILECHANGED && pr_progs->version == PROG_EXTENDEDVERSION) + if (trysleft && (externs->autocompile == PR_COMPILECHANGED || externs->autocompile == PR_COMPILEEXISTANDCHANGED) && pr_progs->version == PROG_EXTENDEDVERSION) { if (PR_TestRecompile(progfuncs)) { diff --git a/engine/qclib/progslib.h b/engine/qclib/progslib.h index 7437603a7..61963f565 100644 --- a/engine/qclib/progslib.h +++ b/engine/qclib/progslib.h @@ -157,7 +157,7 @@ typedef struct progexterns_s { builtin_t *globalbuiltins; //these are available to all progs int numglobalbuiltins; - enum {PR_NOCOMPILE, PR_COMPILENEXIST, PR_COMPILECHANGED, PR_COMPILEALWAYS, PR_COMPILEIGNORE} autocompile; + enum {PR_NOCOMPILE, PR_COMPILENEXIST, PR_COMPILEEXISTANDCHANGED, PR_COMPILECHANGED, PR_COMPILEALWAYS, PR_COMPILEIGNORE} autocompile; double *gametime; diff --git a/engine/qclib/qcc.h b/engine/qclib/qcc.h index 41a8e2cee..2a3bf0a56 100644 --- a/engine/qclib/qcc.h +++ b/engine/qclib/qcc.h @@ -867,6 +867,7 @@ void inline QCC_PR_Expect (char *string) void editbadfile(char *fname, int line); char *TypeName(QCC_type_t *type); void QCC_PR_IncludeChunk (char *data, pbool duplicate, char *filename); +pbool QCC_PR_UnInclude(void); extern void *(*pHash_Get)(hashtable_t *table, char *name); extern void *(*pHash_GetNext)(hashtable_t *table, char *name, void *old); extern void *(*pHash_Add)(hashtable_t *table, char *name, void *data, bucket_t *); diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index 92bd233f5..aefa100df 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -7254,7 +7254,7 @@ void QCC_PR_ParseDefs (char *classname) extern int ForcedCRC; if (ForcedCRC) QCC_PR_ParseError(ERR_BADEXTENSION, "progs crc was already specified - only one is allowed"); - ForcedCRC = pr_immediate._float; + ForcedCRC = (int)pr_immediate._float; QCC_PR_Lex(); QCC_PR_Expect(";"); return; diff --git a/engine/server/server.h b/engine/server/server.h index 4c3ccdaf1..fb7306dea 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -472,10 +472,11 @@ typedef struct client_s double stats_started; #endif + qboolean csqcactive; #ifdef PROTOCOL_VERSION_FTE - unsigned long fteprotocolextensions; + unsigned long fteprotocolextensions; #endif - unsigned long zquake_extensions; + unsigned long zquake_extensions; int isq2client; //contains protocol version too. //speed cheat testing @@ -503,6 +504,7 @@ typedef struct client_s struct client_s *controller; struct client_s *controlled; + int rate; int drate; } client_t; @@ -973,6 +975,8 @@ int SV_HullNumForPlayer(int h2hull, float *mins, float *maxs); void SV_GibFilterInit(void); void SV_CleanupEnts(void); +void SV_CSQC_DroppedPacket(client_t *client, int sequence); + // // sv_nchan.c // @@ -1118,6 +1122,7 @@ extern cvar_t sv_demoMaxSize; extern cvar_t sv_demoMaxDirSize; void SV_MVDInit(void); +char *SV_MVDNum(int num); //filename for demonum void SV_SendMVDMessage(void); qboolean SV_ReadMVD (void); void SV_FlushDemoSignon (void); diff --git a/engine/server/sv_ents.c b/engine/server/sv_ents.c index 2ca218c0d..9663c112d 100644 --- a/engine/server/sv_ents.c +++ b/engine/server/sv_ents.c @@ -278,7 +278,7 @@ static qboolean SV_AddCSQCUpdate (client_t *client, edict_t *ent) #ifndef PEXT_CSQC return false; #else - if (!(client->fteprotocolextensions & PEXT_CSQC)) + if (!(client->csqcactive)) return false; if (!ent->v.SendEntity) @@ -304,7 +304,7 @@ void SV_EmitCSQCUpdate(client_t *client, sizebuf_t *msg) // if (!csqcnuments) // return; - if (!(client->fteprotocolextensions & PEXT_CSQC)) + if (!(client->csqcactive)) return; //FIXME: prioritise the list of csqc ents somehow @@ -406,15 +406,19 @@ void SV_EmitCSQCUpdate(client_t *client, sizebuf_t *msg) #endif } +#ifdef PEXT_CSQC void SV_CSQC_DroppedPacket(client_t *client, int sequence) { -#ifdef PEXT_CSQC int i; + + if (!(client->csqcactive)) //we don't need this, but it might be a little faster. + return; + for (i = 0; i < sv.num_edicts; i++) if (client->csqcentsequence[i] == sequence) client->csqcentversions[i]--; //do that update thang (but later). -#endif } +#endif //============================================================================= diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index b1e4d776f..bac1d6b16 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -695,6 +695,18 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us Info_SetValueForStarKey(svs.info, "*cheats", "", MAX_SERVERINFO_STRING); } + //do we allow csprogs? +#ifdef PEXT_CSQC + file = COM_LoadTempFile("csprogs.dat"); + if (file) + { + char text[64]; + sprintf(text, "0x%x", Com_BlockChecksum(file, com_filesize)); + Info_SetValueForStarKey(svs.info, "*csprogs", text, MAX_SERVERINFO_STRING); + } + else + Info_SetValueForStarKey(svs.info, "*csprogs", "", MAX_SERVERINFO_STRING); +#endif if (svprogfuncs) //we don't want the q1 stuff anymore. { CloseProgs(svprogfuncs); diff --git a/engine/server/sv_sys_unix.c b/engine/server/sv_sys_unix.c index 2d3283109..c98c3fbea 100644 --- a/engine/server/sv_sys_unix.c +++ b/engine/server/sv_sys_unix.c @@ -309,7 +309,13 @@ int main(int argc, char *argv[]) oldtime = Sys_DoubleTime () - 0.1; while (1) { - stdin_ready = NET_Sleep(100, true); + if (do_stdin) + stdin_ready = NET_Sleep(100, true); + else + { + NET_Sleep(100, false); + stdin_ready = false; + } // find time passed since last cycle newtime = Sys_DoubleTime (); diff --git a/engine/server/sv_sys_win.c b/engine/server/sv_sys_win.c index 66c140502..3607e4539 100644 --- a/engine/server/sv_sys_win.c +++ b/engine/server/sv_sys_win.c @@ -513,12 +513,12 @@ void Sys_HideConsole(void) if (!consolewindowhandle) { char old[512]; -#define STRING "Trying to hide" +#define STRINGH "Trying to hide" //msvc sucks GetConsoleTitle(old, sizeof(old)); - SetConsoleTitle(STRING); - consolewindowhandle = FindWindow(NULL, STRING); + SetConsoleTitle(STRINGH); + consolewindowhandle = FindWindow(NULL, STRINGH); SetConsoleTitle(old); -#undef STRING +#undef STRINGH } if (consolewindowhandle) @@ -585,12 +585,12 @@ void Sys_ServerActivity(void) if (!wnd) { char old[512]; -#define STRING "About To Flash" +#define STRINGF "About To Flash" //msvc sucks GetConsoleTitle(old, sizeof(old)); - SetConsoleTitle(STRING); - wnd = FindWindow(NULL, STRING); + SetConsoleTitle(STRINGF); + wnd = FindWindow(NULL, STRINGF); SetConsoleTitle(old); -#undef STRING +#undef STRINGF } if (wnd) diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 4d4be5d86..bb412bdcc 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -245,6 +245,8 @@ void SV_New_f (void) else MSG_WriteString (&host_client->netchan.message, va("fullserverinfo \"%s\"\n", svs.info) ); + host_client->csqcactive = false; + // send music MSG_WriteByte (&host_client->netchan.message, svc_cdtrack); if (svprogfuncs) @@ -1333,7 +1335,7 @@ void SV_NextChunkedDownload(int chunknum) { #define CHUNKSIZE 1024 char buffer[1024]; - if (host_client->datagram.cursize + CHUNKSIZE+5 > host_client->datagram.maxsize) + if (host_client->datagram.cursize + CHUNKSIZE+5+50 > host_client->datagram.maxsize) return; //choked! fseek (host_client->download, chunknum*CHUNKSIZE, SEEK_SET); fread (buffer, 1, CHUNKSIZE, host_client->download); @@ -2770,6 +2772,11 @@ void Cmd_Observe_f (void) host_client->sendinfo = true; } +void SV_EnableClientsCSQC(void) +{ + host_client->csqcactive = true; +} + void SV_MVDList_f (void); void SV_MVDInfo_f (void); typedef struct @@ -2814,6 +2821,7 @@ ucmd_t ucmds[] = {"nextdl", SV_NextDownload_f}, {"ptrack", SV_PTrack_f}, //ZOID - used with autocam + {"enablecsqc", SV_EnableClientsCSQC}, {"snap", SV_NoSnap_f}, {"vote", SV_Vote_f}, @@ -4112,10 +4120,10 @@ void SV_ExecuteClientMessage (client_t *cl) if (cl->lastsequence_acknoledged + UPDATE_BACKUP > cl->netchan.incoming_acknowledged) frame->ping_time = realtime - frame->senttime; //no more phenomanally low pings please - +#ifdef PEXT_CSQC for (i = cl->lastsequence_acknoledged+1; i < cl->netchan.incoming_acknowledged; i++) SV_CSQC_DroppedPacket(cl, i); - +#endif cl->lastsequence_acknoledged = cl->netchan.incoming_acknowledged; } else diff --git a/engine/sw/r_drawa.s b/engine/sw/r_drawa.s index ed1fa92fe..2827943fa 100644 --- a/engine/sw/r_drawa.s +++ b/engine/sw/r_drawa.s @@ -835,5 +835,53 @@ LClampP2: LClampP3: ret + + +#define in 4 +#define out 8 + .align 2 +.globl C(TransformVector) +C(TransformVector): + movl in(%esp),%eax + movl out(%esp),%edx + + flds (%eax) // in[0] + fmuls C(vright) // in[0]*vright[0] + flds (%eax) // in[0] | in[0]*vright[0] + fmuls C(vup) // in[0]*vup[0] | in[0]*vright[0] + flds (%eax) // in[0] | in[0]*vup[0] | in[0]*vright[0] + fmuls C(vpn) // in[0]*vpn[0] | in[0]*vup[0] | in[0]*vright[0] + + flds 4(%eax) // in[1] | ... + fmuls C(vright)+4 // in[1]*vright[1] | ... + flds 4(%eax) // in[1] | in[1]*vright[1] | ... + fmuls C(vup)+4 // in[1]*vup[1] | in[1]*vright[1] | ... + flds 4(%eax) // in[1] | in[1]*vup[1] | in[1]*vright[1] | ... + fmuls C(vpn)+4 // in[1]*vpn[1] | in[1]*vup[1] | in[1]*vright[1] | ... + fxch %st(2) // in[1]*vright[1] | in[1]*vup[1] | in[1]*vpn[1] | ... + + faddp %st(0),%st(5) // in[1]*vup[1] | in[1]*vpn[1] | ... + faddp %st(0),%st(3) // in[1]*vpn[1] | ... + faddp %st(0),%st(1) // vpn_accum | vup_accum | vright_accum + + flds 8(%eax) // in[2] | ... + fmuls C(vright)+8 // in[2]*vright[2] | ... + flds 8(%eax) // in[2] | in[2]*vright[2] | ... + fmuls C(vup)+8 // in[2]*vup[2] | in[2]*vright[2] | ... + flds 8(%eax) // in[2] | in[2]*vup[2] | in[2]*vright[2] | ... + fmuls C(vpn)+8 // in[2]*vpn[2] | in[2]*vup[2] | in[2]*vright[2] | ... + fxch %st(2) // in[2]*vright[2] | in[2]*vup[2] | in[2]*vpn[2] | ... + + faddp %st(0),%st(5) // in[2]*vup[2] | in[2]*vpn[2] | ... + faddp %st(0),%st(3) // in[2]*vpn[2] | ... + faddp %st(0),%st(1) // vpn_accum | vup_accum | vright_accum + + fstps 8(%edx) // out[2] + fstps 4(%edx) // out[1] + fstps (%edx) // out[0] + + ret + + #endif // id386 diff --git a/engine/sw/r_local.h b/engine/sw/r_local.h index 6d848f75f..dc92fa996 100644 --- a/engine/sw/r_local.h +++ b/engine/sw/r_local.h @@ -242,14 +242,6 @@ qboolean R_AliasCheckBBox (void); #define AMP2 3 #define SPEED 20 -//========================================================= -// particle stuff - -void R_DrawParticles (void); -void R_InitParticles (void); -void R_EmitSkyEffectTris(model_t *mod, msurface_t *fa); -void R_ClearParticles (void); -void R_ReadPointFile_f (void); void R_SurfacePatch (void); extern int r_amodels_drawn; diff --git a/engine/sw/r_main.c b/engine/sw/r_main.c index b54dec545..30130a8b3 100644 --- a/engine/sw/r_main.c +++ b/engine/sw/r_main.c @@ -228,7 +228,6 @@ void SWR_Init (void) R_InitTurb (); Cmd_AddRemCommand ("timerefresh", SWR_TimeRefresh_f); - Cmd_AddRemCommand ("pointfile", R_ReadPointFile_f); Cvar_SetValue (&r_maxedges, (float)NUMSTACKEDGES); Cvar_SetValue (&r_maxsurfs, (float)NUMSTACKSURFACES); @@ -273,7 +272,7 @@ void SWR_NewMap (void) cl.worldmodel->leafs[i].efrags = NULL; r_viewleaf = NULL; - R_ClearParticles (); + P_ClearParticles (); r_cnumsurfs = r_maxsurfs.value; @@ -678,7 +677,7 @@ void SWR_DrawEntitiesOnList (void) { if (gl_part_flame.value) { - R_TorchEffect(currententity->origin, currententity->model->particleeffect); + P_TorchEffect(currententity->origin, currententity->model->particleeffect); continue; } } @@ -686,7 +685,7 @@ void SWR_DrawEntitiesOnList (void) { if (gl_part_torch.value) { - R_TorchEffect(currententity->origin, currententity->model->particleeffect); + P_TorchEffect(currententity->origin, currententity->model->particleeffect); } } } @@ -1413,7 +1412,7 @@ SetVisibilityByPassages (); dp_time1 = Sys_DoubleTime (); } - R_DrawParticles (); + P_DrawParticles (); if (r_dspeeds.value) dp_time2 = Sys_DoubleTime (); diff --git a/engine/sw/r_misc.c b/engine/sw/r_misc.c index 24ca20e1a..06dd20f36 100644 --- a/engine/sw/r_misc.c +++ b/engine/sw/r_misc.c @@ -369,7 +369,7 @@ void TransformVector (vec3_t in, vec3_t out) { out[0] = DotProduct(in,vright); out[1] = DotProduct(in,vup); - out[2] = DotProduct(in,vpn); + out[2] = DotProduct(in,vpn); } #endif diff --git a/engine/sw/r_surf.c b/engine/sw/r_surf.c index 41f282300..ca1351a6d 100644 --- a/engine/sw/r_surf.c +++ b/engine/sw/r_surf.c @@ -395,7 +395,7 @@ void SWR_BuildLightmaps(void) for (i=0 ; inumsurfaces ; i++, surf++) { if ( cl.worldmodel->surfaces[i].flags & SURF_DRAWSKY ) - R_EmitSkyEffectTris(cl.worldmodel, &cl.worldmodel->surfaces[i]); + P_EmitSkyEffectTris(cl.worldmodel, &cl.worldmodel->surfaces[i]); SWR_CreateSurfaceLightmap(surf); } } diff --git a/engine/sw/sw_draw.c b/engine/sw/sw_draw.c index b392d1ba8..bed1bcfb2 100644 --- a/engine/sw/sw_draw.c +++ b/engine/sw/sw_draw.c @@ -446,14 +446,24 @@ void SWDraw_Init (void) int width; int height; qbyte *image; + qbyte *src, *dest; extern qbyte default_conchar[11356]; image = ReadTargaFile(default_conchar, sizeof(default_conchar), &width, &height, false); + COM_WriteFile("test.dat", image, 256*256*4); - draw_chars = BZ_Malloc(256*256); + draw_chars = BZ_Malloc(128*128); + + //downsample the 256 image to quake's 128 wide. + for (i = 0; i < 128;i++) + { + src = image+i*8*16*16; + dest = draw_chars + i*16*8; + for (x = 0; x < 128; x++) + dest[x] = src[(x*2)*4]?15:0;//GetPalette(image[i*4], image[i*4+1], image[i*4+2]); + } - for (i = 0; i < 256*256; i++) - draw_chars[i] = image[i*4]?15:0;//GetPalette(image[i*4], image[i*4+1], image[i*4+2]); + COM_WriteFile("test2.dat", draw_chars, 128*128); BZ_Free(image); } diff --git a/engine/sw/sw_model.c b/engine/sw/sw_model.c index 57f5d63e2..500b3a25a 100644 --- a/engine/sw/sw_model.c +++ b/engine/sw/sw_model.c @@ -302,7 +302,7 @@ model_t *SWMod_LoadModel (model_t *mod, qboolean crash) loadmodel = mod; mod->needload = false; Mod_LoadQ2BrushModel(mod, NULL); - R_DefaultTrail(mod); + P_DefaultTrail(mod); return mod; } #endif @@ -344,6 +344,7 @@ model_t *SWMod_LoadModel (model_t *mod, qboolean crash) mod->maxs[1] = 16; mod->maxs[2] = 16; mod->needload = true; + P_DefaultTrail(mod); return mod; return NULL; } @@ -412,10 +413,11 @@ model_t *SWMod_LoadModel (model_t *mod, qboolean crash) mod->maxs[1] = 16; mod->maxs[2] = 16; mod->needload = true; + P_DefaultTrail(mod); return mod; } - R_DefaultTrail(mod); + P_DefaultTrail(mod); return mod; } @@ -2020,7 +2022,7 @@ void SWMod_LoadBrushModel (model_t *mod, void *buffer) strcpy (loadmodel->name, name); mod = loadmodel; - R_DefaultTrail(mod); + P_DefaultTrail(mod); } } }