MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Script_Structure_GetDirection

Function Script_Structure_GetDirection

src/script/structure.c:440–454  ·  view source on GitHub ↗

* 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).

Source from the content-addressed store, hash-verified

438 * @return The direction (value between 0 and 7, shifted to the left with 5).
439 */
440uint16 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.

Callers

nothing calls this directly

Calls 4

Tools_Index_IsValidFunction · 0.85
Tools_Index_GetTileFunction · 0.85
Tile_GetDirectionFunction · 0.85

Tested by

no test coverage detected