User:Nightmareci/SRS: Difference between revisions
Nightmareci (talk | contribs) No edit summary |
Nightmareci (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
==True Rotations== | == True Rotations == | ||
[http://ul.meroigo.com/f/SRS-true-rotations.png Fix Special:Upload DeHackEd/Mufunyo!] | [http://ul.meroigo.com/f/SRS-true-rotations.png Fix Special:Upload DeHackEd/Mufunyo!] | ||
==Offsets== | == Offsets == | ||
{| border="1" style="font-family: Monospace;" | {| border="1" style="font-family: Monospace;" | ||
|+ I | |+ I | ||
Line 52: | Line 52: | ||
|} | |} | ||
==Explanation of Offsets== | == Explanation of Offsets == | ||
Upon pressing a rotation input, clockwise or counterclockwise, there is orientation-start (the orientation before the rotation input is sent) and orientation-end (the orientation that will possibly be changed to). True rotation is performed from orientation-start to orientation-end, even if intersection occurs. Next, the first offset pair is attempted; given (a, b) as the first offset for orientation-start and (c, d) as the offset for orientation-end, the number of columns the offset attempt goes rightward is a-c when a-c is positive and leftward if a-c is negative, and the number of rows upward is b-d if b-d is positive and downward if b-d is negative. If applying the first pair of offsets results in some intersection with the field or walls, then the next offset pair is tried, and so on, until an offset pair succeeds; if none succeed, then no change in state will have occurred. | Upon pressing a rotation input, clockwise or counterclockwise, there is orientation-start (the orientation before the rotation input is sent) and orientation-end (the orientation that will possibly be changed to). True rotation is performed from orientation-start to orientation-end, even if intersection occurs. Next, the first offset pair is attempted; given (a, b) as the first offset for orientation-start and (c, d) as the offset for orientation-end, the number of columns the offset attempt goes rightward is a-c when a-c is positive and leftward if a-c is negative, and the number of rows upward is b-d if b-d is positive and downward if b-d is negative. If applying the first pair of offsets results in some intersection with the field or walls, then the next offset pair is tried, and so on, until an offset pair succeeds; if none succeed, then no change in state will have occurred. | ||
== Examples == | |||
This is an example of I rotating from 0° to 90°, which is one clockwise rotation input in-game, with the true rotation center marked all the way through: | |||
<playfield> | |||
..... | |||
..... | |||
.ICII | |||
..... | |||
..... | |||
</playfield> | |||
Start. | |||
<playfield> | |||
..... | |||
..I.. | |||
..C.. | |||
..I.. | |||
..I.. | |||
</playfield> | |||
<tt>0° -> 90°</tt>, true rotation. | |||
<playfield> | |||
..... | |||
...I. | |||
...C. | |||
...I. | |||
...I. | |||
</playfield> | |||
<pre> | |||
Subtract | |||
|----------|----------| | |||
v v v | |||
(+0, +0) - (-1, +0) => +1 horizontal offset, +0 vertical offset. Success. | |||
^ ^ ^ | |||
|----------|----------------------------| | |||
Subtract | |||
</pre> | |||
<playfield> | |||
..... | |||
...I. | |||
...C. | |||
...I. | |||
...I. | |||
</playfield> | |||
End. | |||
<!-- | |||
This is a rather contrived example, but it shows how the offsets are tried in order until one works: | |||
<playfield> | |||
GGGGGG | |||
GICIIG | |||
GGGG.G | |||
GGGG.G | |||
GGGG.G | |||
GGGG.G | |||
GGGGGG | |||
</playfield> | |||
Start. | |||
<playfield> | |||
GGIGGG | |||
G.C..G | |||
GGIG.G | |||
GGIG.G | |||
GGGG.G | |||
GGGG.G | |||
GGGGGG | |||
</playfield> | |||
<tt>0° -> 90°</tt>, true rotation. | |||
<playfield> | |||
GGGXGG | |||
G..C.G | |||
GGGX.G | |||
GGGX.G | |||
GGGG.G | |||
GGGG.G | |||
GGGGGG | |||
</playfield> | |||
<tt>(+0, +0) - (-1, +0) =></tt> Intersection, fail. | |||
<playfield> | |||
GGIGGG | |||
G.C..G | |||
GGIG.G | |||
GGIG.G | |||
GGGG.G | |||
GGGG.G | |||
GGGGGG | |||
</playfield> | |||
Undo previous offset, change back to true rotation. | |||
<playfield> | |||
GXGGGG | |||
GC...G | |||
GXGG.G | |||
GXGG.G | |||
GGGG.G | |||
GGGG.G | |||
GGGGGG | |||
</playfield> | |||
<tt>(-1, +0) - (+0, +0) =></tt> Intersection, fail. | |||
<playfield> | |||
GGIGGG | |||
G.C..G | |||
GGIG.G | |||
GGIG.G | |||
GGGG.G | |||
GGGG.G | |||
GGGGGG | |||
</playfield> | |||
Undo previous offset, change back to true rotation. | |||
<playfield> | |||
GGGGXG | |||
G...CG | |||
GGGGIG | |||
GGGGIG | |||
GGGG.G | |||
GGGG.G | |||
GGGGGG | |||
</playfield> | |||
<tt>(+2, +0) - (+0, +0) =></tt> Intersection, fail. | |||
<playfield> | |||
GGIGGG | |||
G.C..G | |||
GGIG.G | |||
GGIG.G | |||
GGGG.G | |||
GGGG.G | |||
GGGGGG | |||
</playfield> | |||
Undo previous offset, change back to true rotation. | |||
<playfield> | |||
GGGGGG | |||
GI...G | |||
GCGG.G | |||
GXGG.G | |||
GXGG.G | |||
GGGG.G | |||
GGGGGG | |||
</playfield> | |||
<tt>(-1, +0) - (+0, +1) =></tt> Intersection, fail; the true rotation center is intersecting, too. | |||
<playfield> | |||
GGIGGG | |||
G.C..G | |||
GGIG.G | |||
GGIG.G | |||
GGGG.G | |||
GGGG.G | |||
GGGGGG | |||
</playfield> | |||
Undo previous offset, change back to true rotation. | |||
<playfield> | |||
GGIGGG | |||
G.C..G | |||
GGIG.G | |||
GGIG.G | |||
GGGG.G | |||
GGGG.G | |||
GGGGGG | |||
</playfield> | |||
<tt>(+2, +0) - (+0, +0) =></tt> Success. | |||
--> |
Revision as of 10:59, 4 July 2009
True Rotations
Fix Special:Upload DeHackEd/Mufunyo!
Offsets
0° | (+0, +0) | (-1, +0) | (+2, +0) | (-1, +0) | (+2, +0) |
---|---|---|---|---|---|
90° | (-1, +0) | (+0, +0) | (+0, +0) | (+0, +1) | (+0, -2) |
180° | (-1, +1) | (+1, +1) | (-2, +1) | (+1, +0) | (-2, +0) |
270° | (+0, +1) | (+0, +1) | (+0, +1) | (+0, -1) | (+0, +2) |
0° | (+0, +0) | (+0, +0) | (+0, +0) | (+0, +0) | (+0, +0) |
---|---|---|---|---|---|
90° | (+0, +0) | (+1, +0) | (+1, -1) | (+0, +2) | (+1, +2) |
180° | (+0, +0) | (+0, +0) | (+0, +0) | (+0, +0) | (+0, +0) |
270° | (+0, +0) | (-1, +0) | (-1, -1) | (+0, +2) | (-1, +2) |
0° | (+0, +0) |
---|---|
90° | (+0, -1) |
180° | (-1, -1) |
270° | (-1, +0) |
Explanation of Offsets
Upon pressing a rotation input, clockwise or counterclockwise, there is orientation-start (the orientation before the rotation input is sent) and orientation-end (the orientation that will possibly be changed to). True rotation is performed from orientation-start to orientation-end, even if intersection occurs. Next, the first offset pair is attempted; given (a, b) as the first offset for orientation-start and (c, d) as the offset for orientation-end, the number of columns the offset attempt goes rightward is a-c when a-c is positive and leftward if a-c is negative, and the number of rows upward is b-d if b-d is positive and downward if b-d is negative. If applying the first pair of offsets results in some intersection with the field or walls, then the next offset pair is tried, and so on, until an offset pair succeeds; if none succeed, then no change in state will have occurred.
Examples
This is an example of I rotating from 0° to 90°, which is one clockwise rotation input in-game, with the true rotation center marked all the way through:
Start.
0° -> 90°, true rotation.
Subtract |----------|----------| v v v (+0, +0) - (-1, +0) => +1 horizontal offset, +0 vertical offset. Success. ^ ^ ^ |----------|----------------------------| Subtract
End.