Duke4.net Forums: Fix for "hall of mirrors" when using F7 view mode - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Fix for "hall of mirrors" when using F7 view mode  "some CON code for fixing that"

User is online   Danukem 

  • Duke Plus Developer

#1

Yesterday, Eddy Zykov asked me if there was a way to fix an issue with using F7 view mode (the 3rd person camera in Duke 3D). The issue is that if the player is pressed up against a wall (such as on the street of E1L1 or E1L2) and then turns the camera a little bit off to the side, about half the screen becomes unrendered, resulting in the infamous "hall of mirrors" effect (or in the case of polymer, something different but also bad).

This is what I came up with. The code will check if there is nullspace just off to the side of the camera, and if so, move it to the other side. Originally I had it checking/moving a distance of 256, but Eddy found that 64 build units was sufficient. It seems to work well, and everyone is free to use this code, of course.

define CAMERAMOVEDIST 64
gamevar temp 0 0
gamevar angvar 0 0
gamevar x 0 0
gamevar mx 0 0
gamevar my 0 0
// note that the vars camerax, cameray etc are hardcoded
onevent EVENT_DISPLAYROOMS

ifvare player[THISACTOR].over_shoulder_on 1
{
	setvarvar x camerax
	setvarvar angvar cameraang
	addvar angvar 512
	addvar x CAMERAMOVEDIST
	rotatepoint camerax cameray x cameray angvar mx my
	updatesectorz mx my cameraz temp
	ifvare temp -1 
	{ 
		setvarvar angvar cameraang
		subvar angvar 512
		rotatepoint camerax cameray x cameray angvar mx my
		updatesectorz mx my cameraz temp
		ifvarn temp -1 { setvarvar camerasect temp setvarvar camerax mx setvarvar cameray my }
	}
	else
	{
		subvar angvar 1024
		rotatepoint camerax cameray x cameray angvar mx my
		updatesectorz mx my cameraz temp
		ifvare temp -1
		{
			setvarvar angvar cameraang
			addvar angvar 512
			rotatepoint camerax cameray x cameray angvar mx my
			updatesectorz mx my cameraz temp
			ifvarn temp -1 { setvarvar camerasect temp setvarvar camerax mx setvarvar cameray my }
		}
	}
}
endevent

4

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options