Sector Texture Rotation

By Richard Clark

Sector Texture Rotation
Figure 1: Sector Texture Rotation

A really cool feature of ZDoom is the texture manipulation specials that Randy has included in the engine. You can now align, scale and rotate floor and ceiling textures. This adds a level of precision to Doom map making that are in the more advanced engines like Unreal. Although it is hard to see the rotation in the picture, the example map shows this special in action.

The Sector_SetRotation special is the most interesting of the specials, in my opinion, because it is a great way to simulate moving sectors. Although it is really just the texture that is rotating, using the effect in combination with other specials and objects, adds another level of interesting interaction to a map.

Sector_SetRotation (tag, floor-angle, ceiling-angle)
tag: Tag of affected sector
floor-angle: Angle to rotate floor 0 to 359
ceiling-angle: Angle to rotate ceiling 0 to 359

The following is the script used in the example map to continuously rotate the texture on the pedestal:

#include "zcommon.acs"

script 100 OPEN
	// These are the texture angles
	// Angles: 0 to 359
	int fa;
	int ca;

	// Rotate the sector
	Sector_SetRotation (1, fa, ca);
	// Inc the angle amount
	ca = ca + 10;
	fa = fa + 10;
	// Wrap around the angles
	if (ca > 359) ca = 0;
	if (fa > 359) fa = 0;
	// Slight delay here
	// Do it all again

This is an OPEN script so it will be started when the level loads. The initial values of ca and fa will be zero. This is acceptable since the rotation angle ranges from 0 to 359. The script then calls the special to rotate the texture.

The variables ca and fa are then incremented by 10. If the value of the variables is greater than 359, then the variables are reset to zero. The delay is included to prevent a runaway script error and the restart statement is used to create an endless loop. The effect is quite nice. The sector appears to rotate in a circle.

Using this special can really enhance the visuals of a map and give the player something to look at besides the usual static floors and ceilings.


ZDoom reference by Randy Heit.