* Find the direction a tile is, seen from the structure. If the tile is * invalid it gives the direction the structure is currently looking at. * * Stack: 1 - Tile to get the direction to, or the current direction of the * structure in case the tile is invalid. * * @param script The script engine to operate on. * @return The direction (value between 0 and 7, shifted to the left with 5).
| 438 | * @return The direction (value between 0 and 7, shifted to the left with 5). |
| 439 | */ |
| 440 | uint16 Script_Structure_GetDirection(ScriptEngine *script) |
| 441 | { |
| 442 | Structure *s; |
| 443 | tile32 tile; |
| 444 | uint16 encoded; |
| 445 | |
| 446 | s = g_scriptCurrentStructure; |
| 447 | encoded = STACK_PEEK(1); |
| 448 | |
| 449 | if (!Tools_Index_IsValid(encoded)) return s->rotationSpriteDiff << 5; |
| 450 | |
| 451 | tile = Tools_Index_GetTile(encoded); |
| 452 | |
| 453 | return Orientation_Orientation256ToOrientation8(Tile_GetDirection(s->o.position, tile)) << 5; |
| 454 | } |
| 455 | |
| 456 | /** |
| 457 | * Unknown function 11B9. |
nothing calls this directly
no test coverage detected