| 130 | //=========================================================================== |
| 131 | |
| 132 | static int tileSetHightileReplacement(FScanner& sc, int tilenum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor, bool indexed = false) |
| 133 | { |
| 134 | if ((uint32_t)tilenum >= (uint32_t)MAXTILES) return -1; |
| 135 | if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return -1; |
| 136 | |
| 137 | auto tex = tbuild->tile[tilenum].tileimage; |
| 138 | |
| 139 | if (tex == nullptr || tex->GetWidth() <= 0 || tex->GetHeight() <= 0) |
| 140 | { |
| 141 | sc.ScriptMessage("Warning: defined hightile replacement for empty tile %d.", tilenum); |
| 142 | return -1; // cannot add replacements to empty tiles, must create one beforehand |
| 143 | } |
| 144 | |
| 145 | FTextureID texid = TexMan.CheckForTexture(filename, ETextureType::Any, FTextureManager::TEXMAN_ForceLookup); |
| 146 | if (!texid.isValid()) |
| 147 | { |
| 148 | sc.ScriptMessage("%s: Replacement for tile %d does not exist or is invalid\n", filename, tilenum); |
| 149 | return -1; |
| 150 | } |
| 151 | tileSetHightileReplacement(tilenum, palnum, texid, alphacut, xscale, yscale, specpower, specfactor, indexed); |
| 152 | return 0; |
| 153 | } |
| 154 | |
| 155 | //========================================================================== |
| 156 | // |
no test coverage detected