* Set the ground sprite of the tile. * @param animation The Animation for which we change the ground sprite. * @param parameter The offset in the iconGroup to which the ground sprite is set. */
| 131 | * @param parameter The offset in the iconGroup to which the ground sprite is set. |
| 132 | */ |
| 133 | static void Animation_Func_SetGroundTile(Animation *animation, int16 parameter) |
| 134 | { |
| 135 | uint16 specialMap[1]; |
| 136 | uint16 *iconMap; |
| 137 | const uint16 *layout = g_table_structure_layoutTiles[animation->tileLayout]; |
| 138 | uint16 layoutTileCount = g_table_structure_layoutTileCount[animation->tileLayout]; |
| 139 | uint16 packed = Tile_PackTile(animation->tile); |
| 140 | int i; |
| 141 | |
| 142 | iconMap = &g_iconMap[g_iconMap[animation->iconGroup] + layoutTileCount * parameter]; |
| 143 | |
| 144 | /* Some special case for turrets */ |
| 145 | if ((parameter > 1) && (animation->iconGroup == ICM_ICONGROUP_BASE_DEFENSE_TURRET || animation->iconGroup == ICM_ICONGROUP_BASE_ROCKET_TURRET)) { |
| 146 | Structure *s = Structure_Get_ByPackedTile(packed); |
| 147 | assert(s != NULL); |
| 148 | assert(layoutTileCount == 1); |
| 149 | |
| 150 | specialMap[0] = s->rotationSpriteDiff + g_iconMap[g_iconMap[animation->iconGroup]] + 2; |
| 151 | iconMap = specialMap; |
| 152 | } |
| 153 | |
| 154 | for (i = 0; i < layoutTileCount; i++) { |
| 155 | uint16 position = packed + (*layout++); |
| 156 | uint16 tileID = *iconMap++; |
| 157 | Tile *t = &g_map[position]; |
| 158 | |
| 159 | if (t->groundTileID == tileID) continue; |
| 160 | t->groundTileID = tileID; |
| 161 | t->houseID = animation->houseID; |
| 162 | |
| 163 | if (Map_IsPositionUnveiled(position)) { |
| 164 | t->overlayTileID = 0; |
| 165 | } |
| 166 | |
| 167 | Map_Update(position, 0, false); |
| 168 | |
| 169 | Map_MarkTileDirty(position); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Forward the current Animation with the given amount of steps. |
no test coverage detected