diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-22 18:48:40 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-22 18:48:40 +0200 |
| commit | 6f750160507b87c9ea31899c0199e9b336e8ddae (patch) | |
| tree | 5bd80cd17b7d713d042593883cb16e9be7148342 /src | |
| parent | 77fbe3d7cbd8448f8124dba143bc5110344c6b49 (diff) | |
| parent | ac652bb6fb45099008e862e3ced650299dc3ebb7 (diff) | |
| download | nissy-core-6f750160507b87c9ea31899c0199e9b336e8ddae.tar.gz nissy-core-6f750160507b87c9ea31899c0199e9b336e8ddae.zip | |
Merge branch 'extend_moves'
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/constants.h | 83 | ||||
| -rw-r--r-- | src/core/moves.h | 16 |
2 files changed, 97 insertions, 2 deletions
diff --git a/src/core/constants.h b/src/core/constants.h index 824c0a5..e8b80ae 100644 --- a/src/core/constants.h +++ b/src/core/constants.h | |||
| @@ -251,6 +251,45 @@ | |||
| 251 | #define MOVE_B2 UINT8_C(16) | 251 | #define MOVE_B2 UINT8_C(16) |
| 252 | #define MOVE_B3 UINT8_C(17) | 252 | #define MOVE_B3 UINT8_C(17) |
| 253 | 253 | ||
| 254 | #define MOVE_Uw UINT8_C(18) | ||
| 255 | #define MOVE_Uw2 UINT8_C(19) | ||
| 256 | #define MOVE_Uw3 UINT8_C(20) | ||
| 257 | #define MOVE_Dw UINT8_C(21) | ||
| 258 | #define MOVE_Dw2 UINT8_C(22) | ||
| 259 | #define MOVE_Dw3 UINT8_C(23) | ||
| 260 | #define MOVE_Rw UINT8_C(24) | ||
| 261 | #define MOVE_Rw2 UINT8_C(25) | ||
| 262 | #define MOVE_Rw3 UINT8_C(26) | ||
| 263 | #define MOVE_Lw UINT8_C(27) | ||
| 264 | #define MOVE_Lw2 UINT8_C(28) | ||
| 265 | #define MOVE_Lw3 UINT8_C(29) | ||
| 266 | #define MOVE_Fw UINT8_C(30) | ||
| 267 | #define MOVE_Fw2 UINT8_C(31) | ||
| 268 | #define MOVE_Fw3 UINT8_C(32) | ||
| 269 | #define MOVE_Bw UINT8_C(33) | ||
| 270 | #define MOVE_Bw2 UINT8_C(34) | ||
| 271 | #define MOVE_Bw3 UINT8_C(35) | ||
| 272 | |||
| 273 | #define MOVE_M UINT8_C(36) | ||
| 274 | #define MOVE_M2 UINT8_C(37) | ||
| 275 | #define MOVE_M3 UINT8_C(38) | ||
| 276 | #define MOVE_S UINT8_C(39) | ||
| 277 | #define MOVE_S2 UINT8_C(40) | ||
| 278 | #define MOVE_S3 UINT8_C(41) | ||
| 279 | #define MOVE_E UINT8_C(42) | ||
| 280 | #define MOVE_E2 UINT8_C(43) | ||
| 281 | #define MOVE_E3 UINT8_C(44) | ||
| 282 | |||
| 283 | #define MOVE_x UINT8_C(45) | ||
| 284 | #define MOVE_x2 UINT8_C(46) | ||
| 285 | #define MOVE_x3 UINT8_C(47) | ||
| 286 | #define MOVE_y UINT8_C(48) | ||
| 287 | #define MOVE_y2 UINT8_C(49) | ||
| 288 | #define MOVE_y3 UINT8_C(50) | ||
| 289 | #define MOVE_z UINT8_C(51) | ||
| 290 | #define MOVE_z2 UINT8_C(52) | ||
| 291 | #define MOVE_z3 UINT8_C(53) | ||
| 292 | |||
| 254 | #define TRANS_UFr UINT8_C(0) | 293 | #define TRANS_UFr UINT8_C(0) |
| 255 | #define TRANS_ULr UINT8_C(1) | 294 | #define TRANS_ULr UINT8_C(1) |
| 256 | #define TRANS_UBr UINT8_C(2) | 295 | #define TRANS_UBr UINT8_C(2) |
| @@ -305,8 +344,9 @@ | |||
| 305 | #define AXIS_RL UINT8_C(1) | 344 | #define AXIS_RL UINT8_C(1) |
| 306 | #define AXIS_FB UINT8_C(2) | 345 | #define AXIS_FB UINT8_C(2) |
| 307 | 346 | ||
| 308 | #define NMOVES (1+MOVE_B3) | 347 | #define NMOVES (1+MOVE_B3) |
| 309 | #define NTRANS (1+TRANS_BLm) | 348 | #define NMOVES_EXTENDED (1+MOVE_z3) |
| 349 | #define NTRANS (1+TRANS_BLm) | ||
| 310 | 350 | ||
| 311 | #define MM_ALLMOVES UINT32_C(0x3FFFF) | 351 | #define MM_ALLMOVES UINT32_C(0x3FFFF) |
| 312 | #define MM_NOHALFTURNS UINT32_C(0x2DB6D) | 352 | #define MM_NOHALFTURNS UINT32_C(0x2DB6D) |
| @@ -448,6 +488,45 @@ STATIC const char *movestr[] = { | |||
| 448 | [MOVE_B] = "B", | 488 | [MOVE_B] = "B", |
| 449 | [MOVE_B2] = "B2", | 489 | [MOVE_B2] = "B2", |
| 450 | [MOVE_B3] = "B'", | 490 | [MOVE_B3] = "B'", |
| 491 | |||
| 492 | [MOVE_Uw] = "Uw", | ||
| 493 | [MOVE_Uw2] = "Uw2", | ||
| 494 | [MOVE_Uw3] = "Uw'", | ||
| 495 | [MOVE_Dw] = "Dw", | ||
| 496 | [MOVE_Dw2] = "Dw2", | ||
| 497 | [MOVE_Dw3] = "Dw'", | ||
| 498 | [MOVE_Rw] = "Rw", | ||
| 499 | [MOVE_Rw2] = "Rw2", | ||
| 500 | [MOVE_Rw3] = "Rw'", | ||
| 501 | [MOVE_Lw] = "Lw", | ||
| 502 | [MOVE_Lw2] = "Lw2", | ||
| 503 | [MOVE_Lw3] = "Lw'", | ||
| 504 | [MOVE_Fw] = "Fw", | ||
| 505 | [MOVE_Fw2] = "Fw2", | ||
| 506 | [MOVE_Fw3] = "Fw'", | ||
| 507 | [MOVE_Bw] = "Bw", | ||
| 508 | [MOVE_Bw2] = "Bw2", | ||
| 509 | [MOVE_Bw3] = "Bw'", | ||
| 510 | |||
| 511 | [MOVE_M] = "M", | ||
| 512 | [MOVE_M2] = "M2", | ||
| 513 | [MOVE_M3] = "M'", | ||
| 514 | [MOVE_S] = "S", | ||
| 515 | [MOVE_S2] = "S2", | ||
| 516 | [MOVE_S3] = "S'", | ||
| 517 | [MOVE_E] = "E", | ||
| 518 | [MOVE_E2] = "E2", | ||
| 519 | [MOVE_E3] = "E'", | ||
| 520 | |||
| 521 | [MOVE_x] = "x", | ||
| 522 | [MOVE_x2] = "x2", | ||
| 523 | [MOVE_x3] = "x'", | ||
| 524 | [MOVE_y] = "y", | ||
| 525 | [MOVE_y2] = "y2", | ||
| 526 | [MOVE_y3] = "y'", | ||
| 527 | [MOVE_z] = "z", | ||
| 528 | [MOVE_z2] = "z2", | ||
| 529 | [MOVE_z3] = "z'", | ||
| 451 | }; | 530 | }; |
| 452 | 531 | ||
| 453 | STATIC const char *transstr[] = { | 532 | STATIC const char *transstr[] = { |
diff --git a/src/core/moves.h b/src/core/moves.h index 7e80946..8ed267d 100644 --- a/src/core/moves.h +++ b/src/core/moves.h | |||
| @@ -36,6 +36,10 @@ STATIC oriented_cube_t applymoves(oriented_cube_t, const char *); | |||
| 36 | LOG("Unknown move: %c\n", *VAR_B); \ | 36 | LOG("Unknown move: %c\n", *VAR_B); \ |
| 37 | return RET_ERROR; \ | 37 | return RET_ERROR; \ |
| 38 | } \ | 38 | } \ |
| 39 | if (*(VAR_B+1) == 'w') { \ | ||
| 40 | VAR_MOVE_NOMOD += 18; \ | ||
| 41 | VAR_B++; \ | ||
| 42 | } \ | ||
| 39 | if ((VAR_MOD = readmodifier(*(VAR_B+1))) != 0) \ | 43 | if ((VAR_MOD = readmodifier(*(VAR_B+1))) != 0) \ |
| 40 | VAR_B++; \ | 44 | VAR_B++; \ |
| 41 | ARG_MOVE = VAR_MOVE_NOMOD + VAR_MOD; \ | 45 | ARG_MOVE = VAR_MOVE_NOMOD + VAR_MOD; \ |
| @@ -58,6 +62,18 @@ readmove(char c) | |||
| 58 | return MOVE_F; | 62 | return MOVE_F; |
| 59 | case 'B': | 63 | case 'B': |
| 60 | return MOVE_B; | 64 | return MOVE_B; |
| 65 | case 'M': | ||
| 66 | return MOVE_M; | ||
| 67 | case 'S': | ||
| 68 | return MOVE_S; | ||
| 69 | case 'E': | ||
| 70 | return MOVE_E; | ||
| 71 | case 'x': | ||
| 72 | return MOVE_x; | ||
| 73 | case 'y': | ||
| 74 | return MOVE_y; | ||
| 75 | case 'z': | ||
| 76 | return MOVE_z; | ||
| 61 | default: | 77 | default: |
| 62 | return UINT8_ERROR; | 78 | return UINT8_ERROR; |
| 63 | } | 79 | } |
