diff src/wktables.c @ 0:c84446dfb3f5

initial add
author paulo@localhost
date Fri, 13 Mar 2009 00:39:12 -0700
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/wktables.c	Fri Mar 13 00:39:12 2009 -0700
     1.3 @@ -0,0 +1,454 @@
     1.4 +/* Wall kick tables for LOCKJAW, an implementation of the Soviet Mind Game
     1.5 +
     1.6 +Copyright (C) 2006 Damian Yerrick <tepples+lj@spamcop.net>
     1.7 +
     1.8 +This work is free software; you can redistribute it and/or modify
     1.9 +it under the terms of the GNU General Public License as published by
    1.10 +the Free Software Foundation; either version 2 of the License, or
    1.11 +(at your option) any later version.
    1.12 +
    1.13 +This program is distributed in the hope that it will be useful,
    1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 +GNU General Public License for more details.
    1.17 +
    1.18 +You should have received a copy of the GNU General Public License
    1.19 +along with this program; if not, write to the Free Software
    1.20 +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.21 +
    1.22 +Original game concept and design by Alexey Pajitnov.
    1.23 +The Software is not sponsored or endorsed by Alexey Pajitnov, Elorg,
    1.24 +or The Tetris Company LLC.
    1.25 +
    1.26 +*/
    1.27 +
    1.28 +#define LJ_INTERNAL
    1.29 +#include "lj.h"
    1.30 +
    1.31 +
    1.32 +// These wall kicks are for rotation TO a given orientation.
    1.33 +// Based on http://www.the-shell.net/img/srs_study.html
    1.34 +static const LJRotSystem rotSRS = {
    1.35 +  .kicksL = {1, 0, 0, -1, 0, 0, 0, -1, 0, -1},
    1.36 +  .kicksR = {3, 2, 2, -1, 2, 2, 2, -1, 2, -3},
    1.37 +  .kickTables = {
    1.38 +
    1.39 +    // 0: JLSTZ counterclockwise
    1.40 +    {
    1.41 +      { WK( 0, 0),WK( 1, 0),WK( 1,-1),WK( 0, 2),WK( 1, 2) },  // R->U
    1.42 +      { WK( 0, 0),WK(-1, 0),WK(-1, 1),WK( 0,-2),WK(-1,-2) },  // D->R
    1.43 +      { WK( 0, 0),WK(-1, 0),WK(-1,-1),WK( 0, 2),WK(-1, 2) },  // L->D
    1.44 +      { WK( 0, 0),WK( 1, 0),WK( 1, 1),WK( 0,-2),WK( 1,-2) }   // U->L
    1.45 +    },
    1.46 +
    1.47 +    // 1: I counterclockwise
    1.48 +    {
    1.49 +      { WK( 0, 0),WK(-1, 0),WK( 2, 0),WK(-1,-2),WK( 2, 1) },  // R->U
    1.50 +      { WK( 0, 0),WK( 1, 0),WK(-2, 0),WK( 1,-1),WK(-2, 1) },  // D->R
    1.51 +      { WK( 0, 0),WK( 1, 0),WK(-2, 0),WK(-2,-1),WK( 1, 2) },  // L->D
    1.52 +      { WK( 0, 0),WK(-1, 0),WK( 2, 0),WK( 2,-1),WK(-1, 2) }   // U->L
    1.53 +    },
    1.54 +
    1.55 +    // 2: JLSTZ clockwise
    1.56 +    {
    1.57 +      { WK( 0, 0),WK(-1, 0),WK(-1,-1),WK( 0, 2),WK(-1, 2) },  // L->U
    1.58 +      { WK( 0, 0),WK(-1, 0),WK(-1, 1),WK( 0,-2),WK(-1,-2) },  // U->R
    1.59 +      { WK( 0, 0),WK( 1, 0),WK( 1,-1),WK( 0, 2),WK( 1, 2) },  // R->D
    1.60 +      { WK( 0, 0),WK( 1, 0),WK( 1, 1),WK( 0,-2),WK( 1,-2) },  // D->L
    1.61 +    },
    1.62 +
    1.63 +    // 3: I clockwise
    1.64 +    {
    1.65 +      { WK( 0, 0),WK( 1, 0),WK(-2, 0),WK( 1,-2),WK(-2, 1) },  // L->U
    1.66 +      { WK( 0, 0),WK( 1, 0),WK(-2, 0),WK(-2,-1),WK( 1, 2) },  // U->R
    1.67 +      { WK( 0, 0),WK(-1, 0),WK( 2, 0),WK( 2,-1),WK(-1, 2) },  // R->D
    1.68 +      { WK( 0, 0),WK(-1, 0),WK( 2, 0),WK(-1,-1),WK( 2, 1) }   // D->L
    1.69 +    }
    1.70 +  }
    1.71 +};
    1.72 +
    1.73 +// I: round to top right
    1.74 +// J, L, T: round to bottom
    1.75 +// S: round to bottom left (constant center column)
    1.76 +// Z: round to bottom right (constant center column)
    1.77 +static const LJRotSystem rotSega = {
    1.78 +  .colorScheme = 1,
    1.79 +  .entryOffset = {
    1.80 +    WK( 0, 0),WK( 0, 1),WK( 0, 1),WK( 0, 0),WK( 0, 0),WK( 0, 1),WK( 0, 0),
    1.81 +    WK( 0, 0),WK( 0, 0),WK( 0, 0)
    1.82 +  },
    1.83 +  .entryTheta = { 0, 2, 2, 0, 0, 2, 0, 0, 0, 2 },
    1.84 +  .kicksL = {0, 1, 1, -1, 2, 1, 3, 0, -1, -1},
    1.85 +  .kicksR = {4, 5, 5, -1, 6, 5, 7, 4, -1, -1},
    1.86 +
    1.87 +  .kickTables = {
    1.88 +
    1.89 +    // 0: I counterclockwise
    1.90 +    {
    1.91 +      { WK( 0, 0),WK_END },  // R->U
    1.92 +      { WK( 0,-1),WK_END },  // D->R
    1.93 +      { WK(-1, 1),WK_END },  // L->D
    1.94 +      { WK( 1, 0),WK_END }   // U->L
    1.95 +    },
    1.96 +
    1.97 +    // 1: JLT counterclockwise
    1.98 +    {
    1.99 +      { WK( 0,-1),WK_END },  // R->U
   1.100 +      { WK( 0, 0),WK_END },  // D->R
   1.101 +      { WK( 0, 0),WK_END },  // L->D
   1.102 +      { WK( 0, 1),WK_END }   // U->L
   1.103 +    },
   1.104 +
   1.105 +    // 2: S counterclockwise (round left, like Game Boy)
   1.106 +    {
   1.107 +      { WK( 1,-1),WK_END },  // R->U
   1.108 +      { WK(-1, 0),WK_END },  // D->R
   1.109 +      { WK( 0, 0),WK_END },  // L->D
   1.110 +      { WK( 0, 1),WK_END }   // U->L
   1.111 +    },
   1.112 +
   1.113 +    // 3: Z counterclockwise (round right, like NES)
   1.114 +    {
   1.115 +      { WK( 0,-1),WK_END },  // R->U
   1.116 +      { WK( 0, 0),WK_END },  // D->R
   1.117 +      { WK(-1, 0),WK_END },  // L->D
   1.118 +      { WK( 1, 1),WK_END }   // U->L
   1.119 +    },
   1.120 +
   1.121 +    // 4: I clockwise
   1.122 +    {
   1.123 +      { WK(-1, 0),WK_END },  // L->U
   1.124 +      { WK( 0, 0),WK_END },  // U->R
   1.125 +      { WK( 0, 1),WK_END },  // R->D
   1.126 +      { WK( 1,-1),WK_END }   // D->L
   1.127 +    },
   1.128 +
   1.129 +    // 5: JLT clockwise
   1.130 +    {
   1.131 +      { WK( 0,-1),WK_END },  // L->U
   1.132 +      { WK( 0, 1),WK_END },  // U->R
   1.133 +      { WK( 0, 0),WK_END },  // R->D
   1.134 +      { WK( 0, 0),WK_END }   // D->L
   1.135 +    },
   1.136 +
   1.137 +    // 6: S clockwise (round left)
   1.138 +    {
   1.139 +      { WK( 0,-1),WK_END },  // L->U
   1.140 +      { WK(-1, 1),WK_END },  // U->R
   1.141 +      { WK( 1, 0),WK_END },  // R->D
   1.142 +      { WK( 0, 0),WK_END }   // D->L
   1.143 +    },
   1.144 +
   1.145 +    // 7: Z clockwise (round right)
   1.146 +    {
   1.147 +      { WK(-1,-1),WK_END },  // L->U
   1.148 +      { WK( 0, 1),WK_END },  // U->R
   1.149 +      { WK( 0, 0),WK_END },  // R->D
   1.150 +      { WK( 1, 0),WK_END }   // D->L
   1.151 +    }
   1.152 +  }
   1.153 +};
   1.154 +
   1.155 +// Arika is based on Sega but with a few wall kicks.
   1.156 +// Each free-space kick should be followed by Right, then Left
   1.157 +// but for J, L, and T, kicks to vertical positions (point-right and
   1.158 +// point-left) 
   1.159 +// T when rotating to point-up can also floor kick by one,
   1.160 +// and I when rotating to vertical can floor kick by one or two.
   1.161 +static const LJRotSystem rotArika = {
   1.162 +  .colorScheme = 1,
   1.163 +  .entryOffset = {
   1.164 +    WK( 0, 0),WK( 0, 1),WK( 0, 1),WK( 0, 0),WK( 0, 0),WK( 0, 1),WK( 0, 0),
   1.165 +    WK( 0, 0),WK( 0, 0),WK( 0, 0)
   1.166 +  },
   1.167 +  .entryTheta = { 0, 2, 2, 0, 0, 2, 0, 0, 0, 2 },
   1.168 +  .kicksL = {0, 1, 1, -1, 2, 8, 3, 0, -1, -1},
   1.169 +  .kicksR = {4, 5, 5, -1, 6, 9, 7, 4, -1, -1},
   1.170 +  .kickTables = {
   1.171 +
   1.172 +    // 0: I counterclockwise
   1.173 +    {
   1.174 +      { WK( 0, 0),WK_END },  // R->U
   1.175 +      { WK( 0,-1),WK( 0, 0),WK( 0, 1),WK_END },  // D->R
   1.176 +      { WK(-1, 1),WK_END },  // L->D
   1.177 +      { WK( 1, 0),WK( 1, 1),WK( 1, 2),WK_END }   // U->L
   1.178 +    },
   1.179 +
   1.180 +    // 1: JL counterclockwise
   1.181 +    {
   1.182 +      { WK( 0,-1),WK( 1,-1),WK(-1,-1),WK_END },  // R->U
   1.183 +      { WK( 0, 0),ARIKA_IF_NOT_CENTER,WK( 1, 0),WK(-1, 0),WK_END },  // D->R
   1.184 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK_END },  // L->D
   1.185 +      { WK( 0, 1),ARIKA_IF_NOT_CENTER,WK( 1, 1),WK(-1, 1),WK_END }   // U->L
   1.186 +    },
   1.187 +
   1.188 +    // 2: S counterclockwise (round left, like Game Boy with WK)
   1.189 +    {
   1.190 +      { WK( 1,-1),WK( 2,-1),WK( 0,-1),WK_END },  // R->U
   1.191 +      { WK(-1, 0),WK( 0, 0),WK(-2, 0),WK_END },  // D->R
   1.192 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK_END },  // L->D
   1.193 +      { WK( 0, 1),WK( 1, 1),WK(-1, 1),WK_END }   // U->L
   1.194 +    },
   1.195 +
   1.196 +    // 3: Z counterclockwise (round right, like NES with WK)
   1.197 +    {
   1.198 +      { WK( 0,-1),WK( 1,-1),WK(-1,-1),WK_END },  // R->U
   1.199 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK_END },  // D->R
   1.200 +      { WK(-1, 0),WK( 0, 0),WK(-2, 0),WK_END },  // L->D
   1.201 +      { WK( 1, 1),WK( 2, 1),WK( 0, 1),WK_END }   // U->L
   1.202 +    },
   1.203 +
   1.204 +    // 4: I clockwise
   1.205 +    {
   1.206 +      { WK(-1, 0),WK_END },  // L->U
   1.207 +      { WK( 0, 0),WK( 0, 1),WK( 0, 2),WK_END },  // U->R
   1.208 +      { WK( 0, 1),WK_END },  // R->D
   1.209 +      { WK( 1,-1),WK( 1, 0),WK( 1, 1),WK_END }   // D->L
   1.210 +    },
   1.211 +
   1.212 +    // 5: JLT clockwise
   1.213 +    {
   1.214 +      { WK( 0,-1),WK( 1,-1),WK(-1,-1),WK_END },  // L->U
   1.215 +      { WK( 0, 1),ARIKA_IF_NOT_CENTER,WK( 1, 1),WK(-1, 1),WK_END },  // U->R
   1.216 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK_END },  // R->D
   1.217 +      { WK( 0, 0),ARIKA_IF_NOT_CENTER,WK( 1, 0),WK(-1, 0),WK_END }   // D->L
   1.218 +    },
   1.219 +
   1.220 +    // 6: S clockwise (round left)
   1.221 +    {
   1.222 +      { WK( 0,-1),WK( 1,-1),WK(-1,-1),WK_END },  // L->U
   1.223 +      { WK(-1, 1),WK( 0, 1),WK(-2, 1),WK_END },  // U->R
   1.224 +      { WK( 1, 0),WK( 2, 0),WK( 0, 0),WK_END },  // R->D
   1.225 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK_END }   // D->L
   1.226 +    },
   1.227 +
   1.228 +    // 7: Z clockwise (round right)
   1.229 +    {
   1.230 +      { WK(-1,-1),WK( 0,-1),WK(-2,-1),WK_END },  // L->U
   1.231 +      { WK( 0, 1),WK( 1, 1),WK(-1, 1),WK_END },  // U->R
   1.232 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK_END },  // R->D
   1.233 +      { WK( 1, 0),WK( 2, 0),WK( 0, 0),WK_END }   // D->L
   1.234 +    },
   1.235 +
   1.236 +    // 8: T counterclockwise (with TI floorkick)
   1.237 +    {
   1.238 +      { WK( 0,-1),WK( 1,-1),WK(-1,-1),WK( 0, 0),WK_END },  // R->U
   1.239 +      { WK( 0, 0),ARIKA_IF_NOT_CENTER,WK( 1, 0),WK(-1, 0),WK_END },  // D->R
   1.240 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK_END },  // L->D
   1.241 +      { WK( 0, 1),ARIKA_IF_NOT_CENTER,WK( 1, 1),WK(-1, 1),WK_END }   // U->L
   1.242 +    },
   1.243 +
   1.244 +    // 9: T clockwise (with TI floorkick)
   1.245 +    {
   1.246 +      { WK( 0,-1),WK( 1,-1),WK(-1,-1),WK( 0, 0),WK_END },  // L->U
   1.247 +      { WK( 0, 1),ARIKA_IF_NOT_CENTER,WK( 1, 1),WK(-1, 1),WK_END },  // U->R
   1.248 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK_END },  // R->D
   1.249 +      { WK( 0, 0),ARIKA_IF_NOT_CENTER,WK( 1, 0),WK(-1, 0),WK_END }   // D->L
   1.250 +    }
   1.251 +  }
   1.252 +};
   1.253 +
   1.254 +// All pieces are started with their left side in column 5 and flat side up.
   1.255 +// All pieces stick to the top of the bounding box.
   1.256 +// All 3-wide pieces stick to the left side of the bounding box.
   1.257 +// I sticks to the top when left and right and occupies the second column
   1.258 +// when up and down.
   1.259 +// Try here, then try kicking one space left.  Discovered by zaphod77:
   1.260 +// http://www.tetrisconcept.com/forum/viewtopic.php?t=877
   1.261 +static const LJRotSystem rotTengen = {
   1.262 +  .colorScheme = 1,
   1.263 +  .entryOffset = {
   1.264 +    WK( 1, 0),WK( 1, 1),WK( 1, 1),WK( 0, 0),WK( 1, 0),WK( 1, 1),WK( 1, 0),
   1.265 +    WK( 0, 0),WK( 1, 0),WK( 0, 0)
   1.266 +  },
   1.267 +  .entryTheta = { 0, 2, 2, 0, 0, 2, 0, 0, 0, 2 },
   1.268 +  .kicksL = {0, 3, 3, -1, 3, 3, 3, 0, 2, 5},
   1.269 +  .kicksR = {1, 4, 4, -1, 4, 4, 4, 1, 3, 5},
   1.270 +  .kickTables = {
   1.271 +
   1.272 +    // 0: I counterclockwise
   1.273 +    {
   1.274 +      { WK( 1, 1),WK( 0, 1),WK_END },  // R->U
   1.275 +      { WK(-1,-2),WK(-2,-2),WK_END },  // D->R
   1.276 +      { WK( 0, 2),WK(-1, 2),WK_END },  // L->D
   1.277 +      { WK( 0,-1),WK(-1,-1),WK_END }   // U->L
   1.278 +    },
   1.279 +
   1.280 +    // 1: I clockwise
   1.281 +    {
   1.282 +      { WK( 0, 1),WK(-1, 1),WK_END },  // L->U
   1.283 +      { WK(-1,-1),WK(-2,-1),WK_END },  // U->R
   1.284 +      { WK( 1, 2),WK( 0, 2),WK_END },  // R->D
   1.285 +      { WK( 0,-2),WK(-1,-2),WK_END }   // D->L
   1.286 +    },
   1.287 +
   1.288 +    // 2: I3
   1.289 +    {
   1.290 +      { WK( 0, 1),WK(-1, 1),WK_END },  // L->U
   1.291 +      { WK( 0,-1),WK(-1,-1),WK_END },  // U->R
   1.292 +      { WK( 0, 1),WK(-1, 1),WK_END },  // R->D
   1.293 +      { WK( 0,-1),WK(-1,-1),WK_END }   // D->L
   1.294 +    },
   1.295 +
   1.296 +    // 3: JLSTZ counterclockwise
   1.297 +    {
   1.298 +      { WK( 1, 0),WK( 0, 0),WK_END },  // R->U
   1.299 +      { WK(-1,-1),WK(-2,-1),WK_END },  // D->R
   1.300 +      { WK( 0, 1),WK(-1, 1),WK_END },  // L->D
   1.301 +      { WK( 0, 0),WK(-1, 0),WK_END }   // U->L
   1.302 +    },
   1.303 +
   1.304 +    // 4: JLSTZ clockwise
   1.305 +    {
   1.306 +      { WK( 0, 0),WK(-1, 0),WK_END },  // L->U
   1.307 +      { WK(-1, 0),WK(-2, 0),WK_END },  // U->R
   1.308 +      { WK( 1, 1),WK( 0, 1),WK_END },  // R->D
   1.309 +      { WK( 0,-1),WK(-1,-1),WK_END }   // D->L
   1.310 +    },
   1.311 +
   1.312 +    // 5: L3
   1.313 +    {
   1.314 +      { WK( 0, 0),WK(-1, 0),WK_END },  // L->U
   1.315 +      { WK(-1, 0),WK(-2, 0),WK_END },  // U->R
   1.316 +      { WK( 1, 1),WK( 0, 1),WK_END },  // R->D
   1.317 +      { WK( 0,-1),WK(-1,-1),WK_END }   // D->L
   1.318 +    }
   1.319 +  }
   1.320 +};
   1.321 +
   1.322 +// NES: No wall kick
   1.323 +// 3-wide pieces start out one block to the right
   1.324 +// I, S and Z round to the right and use effective positions R and D
   1.325 +static const LJRotSystem rotNES = {
   1.326 +  .colorScheme = 1,
   1.327 +  .entryOffset = {
   1.328 +    WK( 0, 0),WK( 1, 1),WK( 1, 1),WK( 0, 0),WK( 1, 0),WK( 1, 1),WK( 1, 0),
   1.329 +    WK( 0, 0),WK( 0, 0),WK( 0, 0)
   1.330 +  },
   1.331 +  .entryTheta = { 0, 2, 2, 0, 0, 2, 0, 0, 0, 2 },
   1.332 +  .kicksL = {0, -1, -1, -1, 0, -1, 0, 0, -1, -1},
   1.333 +  .kicksR = {1, -1, -1, -1, 1, -1, 1, 1, -1, -1},
   1.334 +  .kickTables = {
   1.335 +
   1.336 +    // 0: counterclockwise (round right)
   1.337 +    {
   1.338 +      { WK( 0,-1),WK_END },  // R->U
   1.339 +      { WK( 0, 0),WK_END },  // D->R
   1.340 +      { WK(-1, 0),WK_END },  // L->D
   1.341 +      { WK( 1, 1),WK_END }   // U->L
   1.342 +    },
   1.343 +    // 1: clockwise (round right)
   1.344 +    {
   1.345 +      { WK(-1,-1),WK_END },  // L->U
   1.346 +      { WK( 0, 1),WK_END },  // U->R
   1.347 +      { WK( 0, 0),WK_END },  // R->D
   1.348 +      { WK( 1, 0),WK_END }   // D->L
   1.349 +    }
   1.350 +  }
   1.351 +};
   1.352 +
   1.353 +// GB: No wall kick
   1.354 +// I, S and Z round to the left and use effective positions L and D
   1.355 +static const LJRotSystem rotGB = {
   1.356 +  .colorScheme = 1,
   1.357 +  .entryOffset = {
   1.358 +    WK( 0, 0),WK( 0, 1),WK( 0, 1),WK( 0, 0),WK( 0, 0),WK( 0, 1),WK( 0, 0),
   1.359 +    WK( 0, 0),WK( 0, 0),WK( 0, 0)
   1.360 +  },
   1.361 +  .entryTheta = { 0, 2, 2, 0, 0, 2, 0, 0, 0, 2 },
   1.362 +  .kicksL = {0, -1, -1, -1, 0, -1, 0, 0, -1, -1},
   1.363 +  .kicksR = {1, -1, -1, -1, 1, -1, 1, 1, -1, -1},
   1.364 +  .kickTables = {
   1.365 +
   1.366 +    // 0: counterclockwise (round left)
   1.367 +    {
   1.368 +      { WK( 1,-1),WK_END },  // R->U
   1.369 +      { WK(-1, 0),WK_END },  // D->R
   1.370 +      { WK( 0, 0),WK_END },  // L->D
   1.371 +      { WK( 0, 1),WK_END }   // U->L
   1.372 +    },
   1.373 +    // 1: clockwise (round left)
   1.374 +    {
   1.375 +      { WK( 0,-1),WK_END },  // L->U
   1.376 +      { WK(-1, 1),WK_END },  // U->R
   1.377 +      { WK( 1, 0),WK_END },  // R->D
   1.378 +      { WK( 0, 0),WK_END }   // D->L
   1.379 +    },
   1.380 +  }
   1.381 +};
   1.382 +
   1.383 +
   1.384 +// The rotation system of LOCKJAW: The Overdose (GBA) and
   1.385 +// Tetramino (NES) TOD is simple.  In free space it behaves like SRS.
   1.386 +// If that's blocked, kick right, kick left, kick up.
   1.387 +static const LJRotSystem rotTOD = {
   1.388 +  .kicksL = {0, 0, 0, -1, 0, 0, 0, 0, 0, 0},
   1.389 +  .kicksR = {0, 0, 0, -1, 0, 0, 0, 0, 0, 0},
   1.390 +  .kickTables = {
   1.391 +
   1.392 +    // 0: JLSTZ counterclockwise
   1.393 +    {
   1.394 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK( 0, 1),WK_END },  // ->U
   1.395 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK( 0, 1),WK_END },  // ->R
   1.396 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK( 0, 1),WK_END },  // ->D
   1.397 +      { WK( 0, 0),WK( 1, 0),WK(-1, 0),WK( 0, 1),WK_END }   // ->L
   1.398 +    },
   1.399 +
   1.400 +    // 1: I counterclockwise
   1.401 +    {
   1.402 +      { WK( 0, 0),WK(-1, 0),WK( 2, 0),WK(-1,-2),WK( 2, 1) },  // R->U
   1.403 +      { WK( 0, 0),WK( 1, 0),WK(-2, 0),WK( 1,-1),WK(-2, 1) },  // D->R
   1.404 +      { WK( 0, 0),WK( 1, 0),WK(-2, 0),WK(-2,-1),WK( 1, 2) },  // L->D
   1.405 +      { WK( 0, 0),WK(-1, 0),WK( 2, 0),WK( 2,-1),WK(-1, 2) }   // U->L
   1.406 +    },
   1.407 +
   1.408 +    // 2: JLSTZ clockwise
   1.409 +    {
   1.410 +      { WK( 0, 0),WK(-1, 0),WK(-1,-1),WK( 0, 2),WK(-1, 2) },  // L->U
   1.411 +      { WK( 0, 0),WK(-1, 0),WK(-1, 1),WK( 0,-2),WK(-1,-2) },  // U->R
   1.412 +      { WK( 0, 0),WK( 1, 0),WK( 1,-1),WK( 0, 2),WK( 1, 2) },  // R->D
   1.413 +      { WK( 0, 0),WK( 1, 0),WK( 1, 1),WK( 0,-2),WK( 1,-2) },  // D->L
   1.414 +    },
   1.415 +
   1.416 +    // 3: I clockwise
   1.417 +    {
   1.418 +      { WK( 0, 0),WK( 1, 0),WK(-2, 0),WK( 1,-2),WK(-2, 1) },  // L->U
   1.419 +      { WK( 0, 0),WK( 1, 0),WK(-2, 0),WK(-2,-1),WK( 1, 2) },  // U->R
   1.420 +      { WK( 0, 0),WK(-1, 0),WK( 2, 0),WK( 2,-1),WK(-1, 2) },  // R->D
   1.421 +      { WK( 0, 0),WK(-1, 0),WK( 2, 0),WK(-1,-1),WK( 2, 1) }   // D->L
   1.422 +    }
   1.423 +  }
   1.424 +};
   1.425 +
   1.426 +static const LJRotSystem rotTDX = {
   1.427 +  .entryOffset = {
   1.428 +    WK( 0, 0),WK( 1, 1),WK( 1, 1),WK( 0, 0),WK( 1, 0),WK( 1, 1),WK( 1, 0),
   1.429 +    WK( 0, 0),WK( 0, 0),WK( 0, 0)
   1.430 +  },
   1.431 +  .entryTheta = { 0, 2, 2, 0, 0, 2, 0, 0, 0, 2 },
   1.432 +  .kicksL = {0, 0, 0, -1, 0, 0, 0, 0, 0, 0},
   1.433 +  .kicksR = {1, 1, 1, -1, 1, 1, 1, 1, 1, 1},
   1.434 +  .kickTables = {
   1.435 +
   1.436 +    // 0: counterclockwise
   1.437 +    {
   1.438 +      { WK( 0, 0),WK( 1,-1),WK_END },  // R->U
   1.439 +      { WK( 0, 0),WK(-1,-1),WK_END },  // D->R
   1.440 +      { WK( 0, 0),WK(-1, 1),WK_END },  // L->D
   1.441 +      { WK( 0, 0),WK( 1, 1),WK_END }   // U->L
   1.442 +    },
   1.443 +
   1.444 +    // 1: clockwise
   1.445 +    {
   1.446 +      { WK( 0, 0),WK(-1,-1),WK_END },  // L->U
   1.447 +      { WK( 0, 0),WK(-1, 1),WK_END },  // U->R
   1.448 +      { WK( 0, 0),WK( 1, 1),WK_END },  // R->D
   1.449 +      { WK( 0, 0),WK( 1,-1),WK_END }   // D->L
   1.450 +    }
   1.451 +  }
   1.452 +};
   1.453 +
   1.454 +const LJRotSystem *const rotSystems[N_ROTATION_SYSTEMS] = {
   1.455 +  &rotSRS, &rotSega, &rotArika, &rotTengen,
   1.456 +  &rotNES, &rotGB, &rotTOD, &rotTDX
   1.457 +};