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

Function Sprites_GetSprite

src/sprites.c:61–75  ·  view source on GitHub ↗

* Gets the given sprite inside the given buffer. * * @param buffer The buffer containing sprites. * @param index The index of the sprite to get. * @return The sprite. */

Source from the content-addressed store, hash-verified

59 * @return The sprite.
60 */
61static const uint8 *Sprites_GetSprite(const uint8 *buffer, uint16 index)
62{
63 uint32 offset;
64
65 if (buffer == NULL) return NULL;
66 if (READ_LE_UINT16(buffer) <= index) return NULL;
67
68 buffer += 2;
69
70 offset = READ_LE_UINT32(buffer + 4 * index);
71
72 if (offset == 0) return NULL;
73
74 return buffer + offset;
75}
76
77/**
78 * Loads the sprites.

Callers 1

Sprites_LoadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected