Skip to content

Fix quake epicenter calculation for first person and awayviewmobjs

Unmatched Bracket requested to merge UnmatchedBracket/SRB2:quakefpsfix into next

(Closes #1296 (closed))
This fixes an issue with quakes containing epicenter data while going into first person (caused by the camera position freezing) by making the radius calculation relative to the first-person mobj, if applicable.
srb20945
Test script:

local target = nil
addHook("PlayerThink", function (p)
	if p.cmd.buttons & BT_CUSTOM1 then
		target = P_SpawnMobjFromMobj(p.mo, 0, 0, 0, MT_BLUEBERRYBUSH)
	end
	if p.cmd.buttons & BT_CUSTOM2 then
		p.awayviewmobj = target
		p.awayviewtics = 2
	end
	P_StartQuake(50*FU, 100, {0, 0, 0}, 1000*FU)
end)

Warp to GFZ1. Press Custom 1 to spawn a bush, hold Custom 2 to awayview the last bush placed. Note that going into first person and leaving the area will stop the screenshake, and viewing the bush will correctly start or stop the quake depending on where it is.

Merge request reports

Loading