X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmapobjects%2Ffunc%2Fplat.qc;h=08faae9ebef1a1ca05f9c5b380ac41254d54c7b6;hb=e4c6c6d7f00f23fe23a2145278a15c308e70ec28;hp=53dbed02fa42a50580b69efe7ef80143ba0b0f5e;hpb=31cefbf89224b89cec59dc8c54ea4cdc4c4b870b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mapobjects/func/plat.qc b/qcsrc/common/mapobjects/func/plat.qc index 53dbed02f..08faae9eb 100644 --- a/qcsrc/common/mapobjects/func/plat.qc +++ b/qcsrc/common/mapobjects/func/plat.qc @@ -7,7 +7,9 @@ void plat_link(entity this); void plat_delayedinit(entity this) { plat_link(this); - plat_spawn_inside_trigger(this); // the "start moving" trigger + // Q3 uses only a truth check of .targetname to decide whether to spawn a trigger + if(!Q3COMPAT_COMMON || this.targetname == "") + plat_spawn_inside_trigger(this); // the "start moving" trigger } float plat_send(entity this, entity to, float sf) @@ -31,9 +33,7 @@ float plat_send(entity this, entity to, float sf) WriteVector(MSG_ENTITY, this.size); - WriteAngle(MSG_ENTITY, this.mangle_x); - WriteAngle(MSG_ENTITY, this.mangle_y); - WriteAngle(MSG_ENTITY, this.mangle_z); + WriteAngleVector(MSG_ENTITY, this.mangle); WriteShort(MSG_ENTITY, this.speed); WriteShort(MSG_ENTITY, this.height); @@ -58,16 +58,21 @@ void plat_link(entity this) spawnfunc(func_plat) { - if (this.spawnflags & CRUSH) + if (q3compat) + { + this.spawnflags = 0; // Q3 plats have no spawnflags + if (!this.dmg) this.dmg = 2; + } + else if (this.spawnflags & CRUSH) { this.dmg = 10000; } - if (this.dmg && (this.message == "")) + if (this.dmg && (this.message == "")) { this.message = "was squished"; } - if (this.dmg && (this.message2 == "")) + if (this.dmg && (this.message2 == "")) { this.message2 = "was squished by"; } @@ -78,8 +83,9 @@ spawnfunc(func_plat) this.noise1 = "plats/plat2.wav"; } - if (this.sounds == 2) + if (this.sounds == 2 || q3compat) { + // Plats in Q3 always have sounds (they're hard coded in Q3 engine) this.noise = "plats/medplat1.wav"; this.noise1 = "plats/medplat2.wav"; } @@ -90,6 +96,32 @@ spawnfunc(func_plat) if (this.sound2) this.noise1 = this.sound2; + if (q3compat) + { + // CPMA adds these fields for overriding the Q3 default sounds + string s = GetField_fullspawndata(this, "sound_start", true); + string e = GetField_fullspawndata(this, "sound_end", true); + + if (s) + this.noise = strzone(s); + else + { + // PK3s supporting Q3A sometimes include custom sounds at Q3 default paths + s = "sound/movers/plats/pt1_strt.wav"; + if (FindFileInMapPack(s)) + this.noise = s; + } + + if (e) + this.noise1 = strzone(e); + else + { + e = "sound/movers/plats/pt1_end.wav"; + if (FindFileInMapPack(e)) + this.noise1 = e; + } + } + if(this.noise && this.noise != "") { precache_sound(this.noise); @@ -111,8 +143,8 @@ spawnfunc(func_plat) setblocked(this, plat_crush); - if (!this.speed) this.speed = 150; - if (!this.lip) this.lip = 16; + if (!this.speed) this.speed = q3compat ? 200 : 150; + if (!this.lip) this.lip = q3compat ? 8 : 16; if (!this.height) this.height = this.size.z - this.lip; this.pos1 = this.origin; @@ -152,9 +184,7 @@ NET_HANDLE(ENT_CLIENT_PLAT, bool isnew) this.size = ReadVector(); - this.mangle_x = ReadAngle(); - this.mangle_y = ReadAngle(); - this.mangle_z = ReadAngle(); + this.mangle = ReadAngleVector(); this.speed = ReadShort(); this.height = ReadShort(); @@ -177,7 +207,8 @@ NET_HANDLE(ENT_CLIENT_PLAT, bool isnew) set_movetype(this, MOVETYPE_PUSH); this.move_time = time; - plat_spawn_inside_trigger(this); + if(!Q3COMPAT_COMMON || this.targetname == "") + plat_spawn_inside_trigger(this); } if(sf & SF_TRIGGER_RESET)